The Basic Zone

    function sndPlaySound
      {API sound playing function}

The sndPlaySound API function is one of the easiest means for WaveForm sound playback in your delphi App's. Just at the MMSystem unit to your uses list and you can use it in every place of your unit. The declaration is something like this:

Where FileName is of type Pchar and Flags of type Word. An example of this function would be :

If you have got a filename in pascal string format, you can eassily transform it to Pchar by putting the string between brackets ( ) and putting Pchar in front of it, like this :

If you set the FileName property to NIL, the currently playing wave sound device stops playing.

More Info about possible Flags can be found in the Delphi Help Files.

If you don't want to use the MMSystem unit you could ad the following line to your units Interface section :

then in your implemation section add the following :

In your unit, you can now use the playWaveFile function instead of the sndPlaySound function and you don't have to use the MMSystem unit.


Back to the Basic Zone Home Page
Back to Geocities
Back up