Play wav

From Bennu Wiki
Jump to navigation Jump to search


Definition

INT play_wav ( <INT waveID> , <INT repeats> , [<INT channel>] )

Plays a sound effect previously loaded with load_wav().

Parameters

INT waveID - The WaveID of the sound effect to be played.
INT repeats - Number of times to repeat the sound effect. Use -1 for an infinite loop.
[INT channel] - The sound channel the sound effect is to be played on (-1 for any, default).

Returns

INT : The sound channel the sound effect is now playing on.

-1 - Error: sound inactive; invalid waveID
>=0 - The sound channel the sound effect is now playing on.


Example

Program
Private
    int wave;
Begin
    wave = load_wav("my_wav.wav");
    play_wav(wave,0);
    Loop
        frame;
    End
End

Used in example: load_wav()


Sound Functions
Fade_music_in()Fade_music_off()Is_playing_song()Is_playing_wav()Load_song()Load_wav()Pause_song()Pause_wav()Play_song()Play_wav()Reserve_channels()Resume_song()Resume_wav()Reverse_stereo()Set_channel_volume()Set_distance()Set_music_position()Set_panning()Set_position()Set_song_volume()Set_Wav_Volume()Sound_close()Sound_init()Stop_song()Stop_wav()Unload_song()Unload_wav()