[fpc-pascal]Playing sounds in Fpc?

Michael Lang papalangi at t-online.de
Thu Jul 19 00:51:32 CEST 2001

Hi Thomas,

This doesn't work. Ppc386 says, that it doesn't know the
PlaySound-Procedure. The "uses windows;" should import it, but it
doesn't seem to work, at least not on my machine. Does it work on
anybody else's here?


   <*** Michael Lang ***>

On Wed, 18 Jul 2001 12:18:25 +0200, Thomas Schatzl wrote:

>Better use the Win32 PlaySound() method. It allows playback of all types of
>sound files registered within windows.
>{$mode delphi}
>    windows;
>procedure PlayMediaFile(file : String);
>    // plays a sound in background from a file
>    PlaySound(file, 0, SND_ASYNC or SND_FILENAME);
>should do the trick.
>There are a lot more flags for this api call, like playing the sound from
>memory or resource, looping it or stop playing - it's probably best to check
>out the Win32 help for this function.
>If you want a bit more control about the way the sound is played read the
>Media Control Interface (MCI) documentation. You may create some sort of
>"media player" using it easily (including video playback etc).
>Else you could try the DirectSound / DirectMusic API as well for most
>playback control.
>    Thomas

More information about the fpc-pascal mailing list