Public Member Functions | |
Sample (Audio &audio, const std::wstring &filename) | |
Sample (Audio &audio, Reader reader) | |
SampleInstance | play (double volume=1, double speed=1, bool looping=false) const |
SampleInstance | playPan (double pan, double volume=1, double speed=1, bool looping=false) const |
Use samples for everything that's not music.
Gosu::Sample::Sample | ( | Audio & | audio, | |
const std::wstring & | filename | |||
) |
Constructs a sample that can be played on the specified audio system and loads the sample from a file.
Gosu::Sample::Sample | ( | Audio & | audio, | |
Reader | reader | |||
) |
Constructs a sample that can be played on the specified audio system and loads the sample data from a stream.
SampleInstance Gosu::Sample::play | ( | double | volume = 1 , |
|
double | speed = 1 , |
|||
bool | looping = false | |||
) | const |
Plays the sample without panning.
volume | Can be anything from 0.0 (silence) to 1.0 (full volume). | |
speed | Playback speed is only limited by FMOD's capabilities and can accept very high or low values. Use 1.0 for normal playback speed. |
SampleInstance Gosu::Sample::playPan | ( | double | pan, | |
double | volume = 1 , |
|||
double | speed = 1 , |
|||
bool | looping = false | |||
) | const |
Plays the sample with panning.
Even if pan is 0.0, the sample will not be as loud as if it were played by calling play() due to the way the panning works.
pan | Can be anything from -1.0 (left) to 1.0 (right). | |
volume | Can be anything from 0.0 (silence) to 1.0 (full volume). | |
speed | Playback speed is only limited by FMOD's (or SDL_mixer's, respectively) capabilities and can accept very high or low values. Use 1.0 for normal playback speed. |