Name
IsSamplePlaying -- check if a sample is playing
Synopsis
playing = IsSamplePlaying(id)
Function
This function checks if the sample specified by id is currently playing and returns True if it is, False otherwise.

Inputs
id
identifier for a sample
Results
playing
True if the sample specified by id is playing, False otherwise
Example
LoadSample(1, "Sound/Samples/ChurchOrgan.wav")
PlaySample(1)
Repeat
  Wait(2)
Until IsSamplePlaying(1) = False
FreeSample(1)
The above code loads the sample "Sound/Samples/ChurchOrgan.wav", plays it and then waits for it to finish. After that, the sample is freed. If you just want to do something like above, it is easier for you to use the WaitSampleEnd() command. But if you want to do some things during the sample is playing, you will have to do it this way (using IsSamplePlaying() and a loop).

Show TOC