Gosu::Sample Class Reference

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 (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


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.


Constructor & Destructor Documentation

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.


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 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.

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 FMOD's (or SDL_mixer's, respectively) capabilities 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:

Generated on Fri Apr 17 23:35:43 2009 for Gosu by  doxygen 1.5.5