A sample is a short sound that is completely loaded in memory, can be played multiple times at once and offers very flexible playback parameters.
More...
List of all members.
Public Member Functions |
| Sample (const std::wstring &filename) |
| Constructs a sample that can be played on the specified audio system and loads the sample from a file.
|
| Sample (Reader reader) |
| Constructs a sample that can be played on the specified audio system and loads the sample data from a stream.
|
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.
|
GOSU_DEPRECATED | Sample (Audio &audio, const std::wstring &filename) |
GOSU_DEPRECATED | Sample (Audio &audio, Reader reader) |
Detailed Description
A sample is a short sound that is completely loaded in memory, can be played multiple times at once and offers very flexible playback parameters.
Use samples for everything that's not music.
Definition at line 64 of file Audio.hpp.
Constructor & Destructor Documentation
Gosu::Sample::Sample |
( |
const std::wstring & |
filename | ) |
[explicit] |
Constructs a sample that can be played on the specified audio system and loads the sample from a file.
Gosu::Sample::Sample |
( |
Reader |
reader | ) |
[explicit] |
Constructs a sample that can be played on the specified audio system and loads the sample data from a stream.
GOSU_DEPRECATED Gosu::Sample::Sample |
( |
Audio & |
audio, |
|
|
const std::wstring & |
filename |
|
) |
| |
GOSU_DEPRECATED Gosu::Sample::Sample |
( |
Audio & |
audio, |
|
|
Reader |
reader |
|
) |
| |
Member Function Documentation
SampleInstance Gosu::Sample::play |
( |
double |
volume = 1 , |
|
|
double |
speed = 1 , |
|
|
bool |
looping = false |
|
) |
| const |
Plays the sample without panning.
- Parameters:
-
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.
- Parameters:
-
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. |
The documentation for this class was generated from the following file: