Pentagram::AudioMixer Class Reference

#include <AudioMixer.h>

List of all members.

Public Member Functions

 AudioMixer (int sample_rate, bool stereo, int num_channels)
 ~AudioMixer (void)
MidiDrivergetMidiDriver () const
void reset ()
void createProcesses ()
int playSample (AudioSample *sample, int loop, int priority, bool paused, uint32 pitch_shift, int lvol, int rvol)
bool isPlaying (int chan)
void stopSample (int chan)
void setPaused (int chan, bool paused)
bool isPaused (int chan)
void setVolume (int chan, int lvol, int rvol)
void getVolume (int chan, int &lvol, int &rvol)
void openMidiOutput ()
void closeMidiOutput ()

Static Public Member Functions

static AudioMixerget_instance ()

Private Member Functions

void init_midi ()
void MixAudio (sint16 *stream, uint32 bytes)
void Lock ()
void Unlock ()

Static Private Member Functions

static void sdlAudioCallback (void *userdata, uint8 *stream, int len)

Private Attributes

bool audio_ok
uint32 sample_rate
bool stereo
MidiDrivermidi_driver
int midi_volume
int num_channels
AudioChannel ** channels

Static Private Attributes

static AudioMixerthe_audio_mixer = 0


Detailed Description

Definition at line 27 of file AudioMixer.h.


Constructor & Destructor Documentation

Pentagram::AudioMixer::AudioMixer ( int  sample_rate,
bool  stereo,
int  num_channels 
)

Definition at line 35 of file AudioMixer.cpp.

References audio_ok, channels, con, PentZip::int(), Lock(), MM_INFO, num_channels, pout, Console::Print(), sample_rate, sdlAudioCallback(), stereo, the_audio_mixer, and Unlock().

Pentagram::AudioMixer::~AudioMixer ( void   ) 

Definition at line 95 of file AudioMixer.cpp.

References channels, closeMidiOutput(), con, MM_INFO, num_channels, Console::Print(), and the_audio_mixer.


Member Function Documentation

void Pentagram::AudioMixer::closeMidiOutput (  ) 

Definition at line 289 of file AudioMixer.cpp.

References con, MidiDriver::destroyMidiDriver(), Lock(), midi_driver, MM_INFO, Console::Print(), and Unlock().

Referenced by GUIApp::shutdownGame(), and ~AudioMixer().

void Pentagram::AudioMixer::createProcesses (  ) 

Definition at line 84 of file AudioMixer.cpp.

References Kernel::addProcess(), Kernel::get_instance(), and midi_driver.

Referenced by GUIApp::newGame().

static AudioMixer* Pentagram::AudioMixer::get_instance (  )  [inline, static]

Definition at line 35 of file AudioMixer.h.

References the_audio_mixer.

Referenced by MusicProcess::loadData().

MidiDriver* Pentagram::AudioMixer::getMidiDriver (  )  const [inline]

Definition at line 33 of file AudioMixer.h.

References midi_driver.

void Pentagram::AudioMixer::getVolume ( int  chan,
int &  lvol,
int &  rvol 
)

Definition at line 231 of file AudioMixer.cpp.

References audio_ok, channels, Pentagram::AudioChannel::getVolume(), Lock(), num_channels, and Unlock().

void Pentagram::AudioMixer::init_midi (  )  [private]

bool Pentagram::AudioMixer::isPaused ( int  chan  ) 

Definition at line 207 of file AudioMixer.cpp.

References audio_ok, channels, Pentagram::AudioChannel::isPaused(), Lock(), num_channels, and Unlock().

bool Pentagram::AudioMixer::isPlaying ( int  chan  ) 

Definition at line 172 of file AudioMixer.cpp.

References audio_ok, channels, Pentagram::AudioChannel::isPlaying(), Lock(), num_channels, and Unlock().

Referenced by MixAudio(), AudioProcess::pauseAllSamples(), playSample(), AudioProcess::playSFX(), AudioProcess::playSpeech(), AudioProcess::run(), AudioProcess::stopAllExceptSpeech(), AudioProcess::stopSFX(), AudioProcess::stopSpeech(), and AudioProcess::unpauseAllSamples().

void Pentagram::AudioMixer::Lock (  )  [private]

Definition at line 109 of file AudioMixer.cpp.

Referenced by AudioMixer(), closeMidiOutput(), getVolume(), isPaused(), isPlaying(), openMidiOutput(), playSample(), reset(), setPaused(), setVolume(), and stopSample().

void Pentagram::AudioMixer::MixAudio ( sint16 stream,
uint32  bytes 
) [private]

Definition at line 250 of file AudioMixer.cpp.

References audio_ok, channels, isPlaying(), MidiDriver::isSampleProducer(), midi_driver, num_channels, and MidiDriver::produceSamples().

void Pentagram::AudioMixer::openMidiOutput (  ) 

Definition at line 261 of file AudioMixer.cpp.

References audio_ok, con, MidiDriver::createInstance(), SettingManager::get(), SettingManager::get_instance(), Lock(), midi_driver, midi_volume, MM_INFO, Console::Print(), sample_rate, SettingManager::setDefault(), MidiDriver::setGlobalVolume(), stereo, and Unlock().

Referenced by GUIApp::startupGame().

int Pentagram::AudioMixer::playSample ( AudioSample sample,
int  loop,
int  priority,
bool  paused,
uint32  pitch_shift,
int  lvol,
int  rvol 
)

Definition at line 138 of file AudioMixer.cpp.

References audio_ok, channels, isPlaying(), Lock(), num_channels, and Unlock().

Referenced by AudioProcess::playSample().

void Pentagram::AudioMixer::reset (  ) 

Definition at line 119 of file AudioMixer.cpp.

References audio_ok, channels, con, MidiDriver::finishSequence(), Lock(), MidiDriver::maxSequences(), midi_driver, MM_INFO, num_channels, Console::Print(), and Unlock().

Referenced by GUIApp::resetEngine(), and GUIApp::shutdownGame().

static void Pentagram::AudioMixer::sdlAudioCallback ( void *  userdata,
uint8 stream,
int  len 
) [static, private]

Referenced by AudioMixer().

void Pentagram::AudioMixer::setPaused ( int  chan,
bool  paused 
)

Definition at line 196 of file AudioMixer.cpp.

References audio_ok, channels, Lock(), num_channels, Pentagram::AudioChannel::setPaused(), and Unlock().

Referenced by AudioProcess::pauseAllSamples(), and AudioProcess::unpauseAllSamples().

void Pentagram::AudioMixer::setVolume ( int  chan,
int  lvol,
int  rvol 
)

Definition at line 220 of file AudioMixer.cpp.

References audio_ok, channels, Lock(), num_channels, Pentagram::AudioChannel::setVolume(), and Unlock().

Referenced by AudioProcess::run(), and AudioProcess::setVolumeSFX().

void Pentagram::AudioMixer::stopSample ( int  chan  ) 

Definition at line 185 of file AudioMixer.cpp.

References audio_ok, channels, Lock(), num_channels, Pentagram::AudioChannel::stop(), and Unlock().

Referenced by AudioProcess::stopAllExceptSpeech(), AudioProcess::stopSFX(), and AudioProcess::stopSpeech().

void Pentagram::AudioMixer::Unlock (  )  [private]

Definition at line 114 of file AudioMixer.cpp.

Referenced by AudioMixer(), closeMidiOutput(), getVolume(), isPaused(), isPlaying(), openMidiOutput(), playSample(), reset(), setPaused(), setVolume(), and stopSample().


Member Data Documentation

bool Pentagram::AudioMixer::audio_ok [private]

Definition at line 54 of file AudioMixer.h.

Referenced by AudioMixer(), getVolume(), isPaused(), isPlaying(), MixAudio(), openMidiOutput(), playSample(), reset(), setPaused(), setVolume(), and stopSample().

AudioChannel** Pentagram::AudioMixer::channels [private]

Definition at line 61 of file AudioMixer.h.

Referenced by AudioMixer(), getVolume(), isPaused(), isPlaying(), MixAudio(), playSample(), reset(), setPaused(), setVolume(), stopSample(), and ~AudioMixer().

MidiDriver* Pentagram::AudioMixer::midi_driver [private]

Definition at line 57 of file AudioMixer.h.

Referenced by closeMidiOutput(), createProcesses(), getMidiDriver(), MixAudio(), openMidiOutput(), and reset().

int Pentagram::AudioMixer::midi_volume [private]

Definition at line 58 of file AudioMixer.h.

Referenced by openMidiOutput().

int Pentagram::AudioMixer::num_channels [private]

Definition at line 60 of file AudioMixer.h.

Referenced by AudioMixer(), getVolume(), isPaused(), isPlaying(), MixAudio(), playSample(), reset(), setPaused(), setVolume(), stopSample(), and ~AudioMixer().

uint32 Pentagram::AudioMixer::sample_rate [private]

Definition at line 55 of file AudioMixer.h.

Referenced by AudioMixer(), and openMidiOutput().

bool Pentagram::AudioMixer::stereo [private]

Definition at line 56 of file AudioMixer.h.

Referenced by AudioMixer(), and openMidiOutput().

AudioMixer * Pentagram::AudioMixer::the_audio_mixer = 0 [static, private]

Definition at line 68 of file AudioMixer.h.

Referenced by AudioMixer(), get_instance(), and ~AudioMixer().


The documentation for this class was generated from the following files:
Generated on Fri Jul 27 22:30:29 2007 for pentagram by  doxygen 1.4.7