Logo Search packages:      
Sourcecode: scummvm version File versions  Download package

Audio::MixerImpl Class Reference

#include <mixer_intern.h>

Inheritance diagram for Audio::MixerImpl:


List of all members.

Detailed Description

The (default) implementation of the ScummVM audio mixing subsystem.

Backends are responsible for allocating (and later releasing) an instance of this class, which engines can access via OSystem::getMixer().

Initialisation of instances of this class usually happens as follows: 1) Creat a new Audio::MixerImpl instance. 2) Set the hardware output sample rate via the setSampleRate() method. 3) Hook up the mixCallback() in a suitable audio processing thread/callback. 4) Change the mixer into ready mode via setReady(true). 5) Start audio processing (e.g. by resuming the audio thread, if applicable).

In the future, we might make it possible for backends to provide (partial) alternative implementations of the mixer, e.g. to make better use of native sound mixing support on low-end devices.

See also:

Definition at line 54 of file mixer_intern.h.

Public Types

enum  { kMaxChannelVolume = 255, kMaxMixerVolume = 256 }
enum  RawFlags {
  FLAG_UNSIGNED = 1 << 0, FLAG_16BITS = 1 << 1, FLAG_LITTLE_ENDIAN = 1 << 2, FLAG_STEREO = 1 << 3,
  FLAG_REVERSE_STEREO = 1 << 4, FLAG_AUTOFREE = 1 << 5, FLAG_LOOP = 1 << 6
enum  SoundType { kPlainSoundType = 0, kMusicSoundType = 1, kSFXSoundType = 2, kSpeechSoundType = 3 }

Public Member Functions

virtual uint getOutputRate () const
virtual uint32 getSoundElapsedTime (SoundHandle handle)
virtual int getSoundID (SoundHandle handle)
virtual int getVolumeForSoundType (SoundType type) const
virtual bool hasActiveChannelOfType (SoundType type)
virtual bool isReady () const
virtual bool isSoundHandleActive (SoundHandle handle)
virtual bool isSoundIDActive (int id)
void mixCallback (byte *samples, uint len)
 MixerImpl (OSystem *system)
virtual void pauseAll (bool paused)
virtual void pauseHandle (SoundHandle handle, bool paused)
virtual void pauseID (int id, bool paused)
virtual void playInputStream (SoundType type, SoundHandle *handle, AudioStream *input, int id=-1, byte volume=255, int8 balance=0, bool autofreeStream=true, bool permanent=false, bool reverseStereo=false)
virtual void playRaw (SoundType type, SoundHandle *handle, void *sound, uint32 size, uint rate, byte flags, int id=-1, byte volume=255, int8 balance=0, uint32 loopStart=0, uint32 loopEnd=0)
virtual void setChannelBalance (SoundHandle handle, int8 balance)
virtual void setChannelVolume (SoundHandle handle, byte volume)
void setOutputRate (uint sampleRate)
void setReady (bool ready)
virtual void setVolumeForSoundType (SoundType type, int volume)
virtual void stopAll ()
virtual void stopHandle (SoundHandle handle)
virtual void stopID (int id)

Protected Member Functions

void insertChannel (SoundHandle *handle, Channel *chan)

Private Types

enum  { NUM_CHANNELS = 16 }

Private Attributes

Channel_channels [NUM_CHANNELS]
uint32 _handleSeed
bool _mixerReady
Common::Mutex _mutex
uint _sampleRate
int _volumeForSoundType [4]

The documentation for this class was generated from the following files:

Generated by  Doxygen 1.6.0   Back to index