Original Author Paul Laughton, 2011
Page 189
De Re BASIC!
A playing sound is called a sound stream. Individual sound streams can be paused (SoundPool.pause),
individually or as a group, resumed (SoundPool.resume) and stopped (SoundPool.stop). Other stream
parameters (priority, volume and rate) can be changed on the fly.
The SoundPool.release command closes the SoundPool. A new SoundPool can then be opened for a
different phase of the game. SoundPool.release is automatically called when the program run is
terminated.
Commands
Soundpool.open <MaxStreams_nexp>
The MaxStreams expression specifies the number of Soundpool streams that can be played at once. If
the number of streams to be played exceeds this value, the lowest priority streams will be terminated.
Note: A stream playing via audio.play is not counted as a Soundpool stream.
Soundpool.load <soundID_nvar>, <file_path_sexp>
The file specified in <file_path_sexp> is loaded. Its sound ID is returned in <soundID_nvar>. The sound ID
is used to play the sound and also to unload the sound. The sound ID will be returned as zero if the file
was not loaded for some reason.
The default file path is "sdcard/rfo-basic/data/"
Note: It can take a few hundred milliseconds for the sound to be loaded. Insert a "Pause 500" statement
after the load if you want to play the sound immediately following the load command.
Soundpool.unload <soundID_nexp>
The specified loaded sound is unloaded.
Soundpool.play <streamID_nvar>, <soundID_nexp>, <rightVolume_nexp>,
<leftVolume_nexp>, <priority_nexp>, <loop_nexp>, <rate_nexp>
Starts the specified sound ID playing.
The stream ID is returned in <streamID_nvar>. If the stream was not started, the value returned will be
zero. The stream ID is used to pause, resume and stop the stream. It is also used in the stream
modification commands (Soundpool.setrate, Soundpool.setvolume, Soundpool.setpriority and
Soundpool.setloop).
The left and right volume values must be in the range of 0 to 0.99 with zero being silent.
The priority is a positive value or zero. The lowest priority is zero.
The loop value of -1 will loop the playing stream forever. Values other than -1 specify the number of
times the stream will be replayed. A value of 1 will play the stream twice.