Playing sound samples
The openFrameworks' ofSoundPlayer
class is designed for playing and controlling sound samples. The basic usage of the ofSoundPlayer
sound object is the following:
Loading a sound sample, specifying its filename using:
sound.loadSound( fileName );
Playing the sample using:
sound.play();
Updating the sound engine using the global function:
ofSoundUpdate();
You need to call the
ofSoundUpdate();
function intestApp::update()
for all the samples to play correctly.
There are a number of functions for controlling sample playback. They are as follows:
The
stop()
function stops sample playing.The
getIsPlaying()
function returnstrue
if our sample is currently playing.The
setPaused( pause )
function enables or disables pause in sample playing, withpause
of typebool
.The
setPosition( pos )
function sets sample playing position, wherepos
is afloat
value from0.0
to1.0
. Here0.0
means the start of the sample and1.0
means the end of the sample.The
getPosition()
function returns the current...