[fpc-pascal] playing sound files (linux and windows)

Alexander Grau alex at grauonline.de
Tue Jun 15 09:37:48 CEST 2010


Graeme Geldenhuys schrieb:
> On 14/06/2010, Alexander Grau wrote:
>   
>> If someone would like to add a PlaySoundFile API to LCL/FPC, drop me a
>> note and we will donate the Mac code for it :-) ...
>>     
>
> Thanks for that. A quick test removing the SND_ASYNC option plays
> multiple sound files in quick succession - just what I wanted.  I'll
> experiment with libsndfile tomorrow, to see if I can accomplish the
> same under Linux.
>
> As long as I can find out the various options for each platform, I can
> very easily put together my own sound playing API/Class, so that is
> not much of a problem.
>
>   
For Linux, I think it can be simple as opening a file and writing the 
raw audio data to it - using a simple WAV header reader or even an MP3 
decoder for FPC, it should be possible to directly use the sound device  
(/dev/dsp):

http://www.opensound.com/pguide/audio.html

This is not the most elegant (or easiest) solution, however it has no 
dependencies to any libraries :)

I think for getting a simple playSoundFile() API to FPC/LCL on all 
platforms, dependencies to 3rd-party libs can be avoided.

Regards,
Alexander




More information about the fpc-pascal mailing list