-
Book Overview & Buying
-
Table Of Contents
Mastering openFrameworks: Creative Coding Demystified
By :
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 in testApp::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 returns true if our sample is currently playing.
The setPaused( pause ) function enables or disables pause in sample playing, with pause of type bool.
The setPosition( pos ) function sets sample playing position, where pos is a float value from 0.0 to 1.0. Here 0.0 means the start of the sample and 1.0 means the end of the sample.
The getPosition() function returns the current...
Change the font size
Change margin width
Change background colour