EXPORT_CLASSclass TMixer

The overall mixer object.

Public Fields

[more]SigC::Signal0<void> MusicFinished
Signal called when the current song finishes

Public Methods

[more]void Init(int sampling_rate, Uint16 format, int output_channels = 2, int chunksize = -1)
Initialize the mixer.
[more]void Init(const Attr& attr)
Initialize the mixer.
[more]void Close()
Close the mixer. Stop all playing samples and music and close the mixer.
[more]int SetChannels( int channels )
Set the number of mixer channels (you should never need to do this).
[more]int GetChannels() const
[more]int GetSamplingRate() const
[more]int GetChunkSize() const
[more]Uint16 GetFormat() const
[more]std::auto_ptr<TSampleInstance> StartSample( TSample& sample, int loops = 1, int volume = 128, int fadein = 0, int playfor = -1 ) throw( EMixerError )
Start playing sample.
[more]void StartMusic( TSong& song, int loops = 1, int fadein = 0 ) throw(EMixerError)
Start playing song.
[more]void PauseMusic()
Pause the music
[more]void ResumeMusic()
Resume playing the music
[more]void RewindMusic()
Rewind the music.
[more]void StopMusic( int fadeout = 0 )
Stop the music after fading for fadeout ms
[more]void SetMusicVolume( int vol )
Set the music volume
[more]int GetMusicVolume() const
Get the music volume.
[more]bool IsMusicPaused() const
[more]bool IsMusicPlaying() const
[more]bool IsMusicStopped() const

Public Members

[more]struct Attr
This structure contains all the parameters nessecary to initialize the mixer.


Documentation

The overall mixer object. It provides all the sample and music playing function.
ostruct Attr
This structure contains all the parameters nessecary to initialize the mixer.

See Also:
TMixerAttr

ovoid Init(int sampling_rate, Uint16 format, int output_channels = 2, int chunksize = -1)
Initialize the mixer. Mixer parameters are provided as seperate values. No other mixer functions can be used before this is called.

ovoid Init(const Attr& attr)
Initialize the mixer. Mixer parameters are provided as a TMixerAttr object. No other mixer functions can be used before this is called.

ovoid Close()

oint SetChannels( int channels )
Set the number of mixer channels (you should never need to do this). This is useful if you know you are going to be using a lot of channels and don't want them to be allocated dynamicly.

Returns:
the number of mixer channels allocated at the end of the operation.

oint GetChannels() const
Returns:
The number channels currently allocated.
See Also:
TMixer::SetChannels

oint GetSamplingRate() const
Returns:
The sampling rate of the mixer.

oint GetChunkSize() const
Returns:
The size of the chunk beginning mixed and sent to the audio device.

oUint16 GetFormat() const
Returns:
The sample format.

ostd::auto_ptr<TSampleInstance> StartSample( TSample& sample, int loops = 1, int volume = 128, int fadein = 0, int playfor = -1 ) throw( EMixerError )
Start playing sample.

Don't do:
std::auto_ptr<TSampleInstance> inst;
inst = Mixer.StartSample(...);

Do:
std::auto_ptr<TSampleInstance> inst;
inst.reset( Mixer.StartSample(...).release() );

Or:
TSampleInstance* inst;
inst = Mixer.StartSample(...).release();

This is because G++ versions before 3.0 have a broken auto_ptr.

Parameters:
loops - Setting loops to 1 will play the sample one setting it to 2 will play it twice.
volume - The volume at which to start the sample. (In the range of 0-128.)
fadein - The number of ms over which to fade in the sample.
playfor - Automaticly stop the sample after this number of ms. If it is -1 don't stop it.
Returns:
An auto_ptr to a TSampleInstance representing the sample that was started.

ovoid StartMusic( TSong& song, int loops = 1, int fadein = 0 ) throw(EMixerError)
Start playing song. It will be looped loops time and faded in for fadein ms.

The fade in feature doesn't work and I don't know why. (help me!)

ovoid PauseMusic()
Pause the music

ovoid ResumeMusic()
Resume playing the music

ovoid RewindMusic()
Rewind the music. This can cause some problems when used on MP3s.

ovoid StopMusic( int fadeout = 0 )
Stop the music after fading for fadeout ms

ovoid SetMusicVolume( int vol )
Set the music volume

oint GetMusicVolume() const
Get the music volume.
Returns:
the current music volume.

obool IsMusicPaused() const
Returns:
true if music is paused and false otherwise.

obool IsMusicPlaying() const
Returns:
true if music is playing and false otherwise.

obool IsMusicStopped() const
Returns:
true if music is stopped (not paused, stopped) and false otherwise.

oSigC::Signal0<void> MusicFinished
Signal called when the current song finishes


This class has no child classes.

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.