Public Member Functions | |
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. | |
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. | |
~Sample () | |
SampleInstance | play (double volume=1, double speed=1, bool looping=false) const |
Plays the sample without panning. | |
SampleInstance | playPan (double pan, double volume=1, double speed=1, bool looping=false) const |
Plays the sample with panning. |
Use samples for everything that's not music.
Definition at line 76 of file Audio.hpp.
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.
Constructs a sample that can be played on the specified audio system and loads the sample data from a stream.
Gosu::Sample::~Sample | ( | ) |
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 the underlying audio library, 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 by the underlying audio library, and can accept very high or low values. Use 1.0 for normal playback speed. |