[fpc-pascal] simple sound implementation

Tomas Hajny XHajT03 at mbox.vol.cz
Sun Sep 2 12:12:24 CEST 2007


On 2 Sep 07, at 7:58, Marc Santhoff wrote:


Hi,

> I've read in the docs for the crt-unit that the procedure "sound()" does
> not work on windows.
> 
> Since I'm searching for a portable way of playing simple tones
> (frequency & duration) I want to know if there is something as
> replacement for the crt unit or if it still needs to be done.
> 
> FreeBSD has a simple speaker-device and is able to use it for simple
> freqency and duration sounds via ioctl as well as playing musical notes
> a simple acsii-notation. Maybe Linux, MacOS and others have similar
> possibilities?

Most operating systems (i.e. the more advanced 
ones than DOS, which was the original target of 
the Crt unit) require you to pass both frequency 
and duration at the same time rather than low 
level control in the sense of "turn sound on with 
frequency X", "wait", "turn sound off" assumed by 
the Crt unit. I guess that we could alternatively 
provide an overloaded Sound (Freq, Duration) 
routine for most platforms, maybe that would be 
useful situation similar to what you described in 
your second e-mail...

Tomas



More information about the fpc-pascal mailing list