Pause wav

From Bennu Wiki
Jump to: navigation, search


Definition

INT pause_wav (INT < channel > )

Pauses the currently playing wave channel.

Notes

The sound channel pauses immediately, but can be resumed later by calling resume_wav(). For a nicer effect, you may want to fade the music out before pausing. See set_channel_volume().

Parameters

INT channel - The WAV sound channel.


Returns

INT : Error.

-1 - Error: sound channel inactive.
0 - No error.

Example

// import modules
IMPORT "mod_say";
IMPORT "mod_debug";
IMPORT "mod_proc";
IMPORT "mod_key";
IMPORT "mod_sound";

GLOBAL
   int wav;
   int channel;
  
PROCESS main();  
BEGIN

  wav=load_wav("wav.wav");
  
  say("Test pause_wav...");
  say("ENTER = Pause Sound...");
  say("Press ESC to quit...");
  
  channel=play_wav(wav,-1);
  
  REPEAT
  
    IF(key(_enter))
      pause_wav(channel);
      FRAME(2500);
      resume_wav(channel);
    END
    
    FRAME;
  UNTIL(key(_esc))
END

Used in example: key(), say(), resume_wav(), play_wav(), 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_Wav_Volume()Set_channel_volume()Set_distance()Set_music_position()Set_panning()Set_position()Set_song_volume()Sound_close()Sound_init()Stop_song()Stop_wav()Unload_song()Unload_wav()