Audio Class Reference

#include <Audio.h>

Collaboration diagram for Audio:

Collaboration graph
[legend]
List of all members.

Public Member Functions

void Init_sfx (void)
void honest_sample_rates (void)
void cancel_streams (void)
void pause_audio (void)
void resume_audio (void)
void play (uint8 *sound_data, uint32 len, bool)
void playfile (const char *, bool)
bool playing (void)
void start_music (int num, bool continuous, int bank=0)
void start_music (const char *fname, int num, bool continuous)
void start_music (XMIDIEventList *midfile, bool continuous)
void start_music_combat (Combat_song song, bool continuous, int bank=0)
void stop_music ()
int play_sound_effect (int num, int volume=SDL_MIX_MAXVOLUME, int dir=0, int repeat=0)
int play_wave_sfx (int num, int volume=SDL_MIX_MAXVOLUME, int dir=0, int repeat=0)
void stop_sound_effects ()
bool start_speech (int num, bool wait=false)
bool is_speech_enabled () const
void set_speech_enabled (bool ena)
bool is_music_enabled () const
void set_music_enabled (bool ena)
bool are_effects_enabled () const
void set_effects_enabled (bool ena)
bool is_audio_enabled () const
void set_audio_enabled (bool ena)
bool is_music_looping_allowed () const
void set_allow_music_looping (bool ena)
bool can_sfx (const std::string &game) const
bool is_track_playing (int num)
int get_sample_rate ()
bool is_stereo ()
MyMidiPlayerget_midi ()
Flexget_sfx_file ()

Static Public Member Functions

static void Init (void)
static void Destroy (void)
static Audioget_ptr (void)
static int game_sfx (int sfx)
static void channel_complete_callback (int chan)

Public Attributes

bool audio_enabled
SDL_AudioSpec actual
Flexsfx_file

Private Member Functions

 UNREPLICATABLE_CLASS (Audio)
 Audio ()
 ~Audio ()
void Init (int _samplerate, int _channels)
uint8convert_VOC (uint8 *, uint32 &)
void build_speech_vector (void)

Private Attributes

bool truthful_
bool speech_enabled
bool music_enabled
bool effects_enabled
bool allow_music_looping
bool SDL_open
SFX_cachedsfxs
MyMidiPlayermidi
bool initialized
SDL_AudioSpec wanted
Mix_Chunk * wave

Static Private Attributes

static Audioself
static int * bg2si_sfxs

Friends

class Tired_of_compiler_warnings

Detailed Description

Definition at line 51 of file Audio.h.


Constructor & Destructor Documentation

Audio::Audio (  )  [private]

Definition at line 237 of file Audio.cc.

References allow_music_looping, audio_enabled, config, effects_enabled, midi, music_enabled, s, Configuration::set(), speech_enabled, and Configuration::value().

Referenced by Init().

Here is the call graph for this function:

Audio::~Audio (  )  [private]

Definition at line 391 of file Audio.cc.

References CERR, initialized, midi, SFX_cached::next, SDL_open, sfx_file, sfxs, and stop_music().

Here is the call graph for this function:


Member Function Documentation

Audio::UNREPLICATABLE_CLASS ( Audio   )  [private]

void Audio::Init ( int  _samplerate,
int  _channels 
) [private]

Definition at line 262 of file Audio.cc.

References actual, audio_enabled, build_speech_vector(), calc_sample_buffer(), channel_complete_callback(), COUT, initialized, midi, and SDL_open.

Here is the call graph for this function:

uint8 * Audio::convert_VOC ( uint8 ,
uint32  
) [private]

Definition at line 429 of file Audio.cc.

References actual, CERR, chunks_to_block(), COUT, decode_ADPCM_4(), is_stereo(), LEADING_VOC_SLOP, resample(), resample_new(), resample_new_mono(), and TRAILING_VOC_SLOP.

Referenced by play().

Here is the call graph for this function:

void Audio::build_speech_vector ( void   )  [private]

Definition at line 939 of file Audio.cc.

Referenced by Init().

void Audio::Init ( void   )  [static]

Definition at line 207 of file Audio.cc.

References Audio(), and SAMPLERATE.

Referenced by BuildGameMap(), Init(), and set_audio_enabled().

Here is the call graph for this function:

void Audio::Destroy ( void   )  [static]

Definition at line 221 of file Audio.cc.

Referenced by BuildGameMap(), and Play().

Audio * Audio::get_ptr ( void   )  [static]

Definition at line 227 of file Audio.cc.

Referenced by ActionPlayMusic(), Egg_object::activate(), Gump_manager::add_gump(), Game::create_game(), Usecode_internal::do_speech(), Dragging_info::Dragging_info(), Dragging_info::drop(), Dragging_info::drop_on_map(), SI_Game::end_game(), BG_Game::end_game(), Combat_schedule::ending(), Usecode_script::exec(), Actor::figure_hit_points(), File_gump::File_gump(), Game_window::get_focus(), Object_sfx::get_shape_sfx(), Background_noise::handle_event(), Handle_event(), Earthquake::handle_event(), Lightning_effect::handle_event(), Explosion_effect::handle_event(), Init(), MyMidiPlayer::init_device(), AudioOptions_gump::load_settings(), Game_window::lose_focus(), Combat_schedule::monster_died(), Game::play_audio(), SI_Game::play_intro(), BG_Game::play_intro(), ExCineVoc::play_it(), Game::play_midi(), Game_window::read(), Game_window::read_gwin(), ExultMenu::run(), AudioOptions_gump::save_settings(), BG_Game::scene_butterfly(), BG_Game::scene_guardian(), BG_Game::scene_moongate(), Object_sfx::set_obj(), ExultMenu::setup(), Game::show_menu(), Combat_schedule::start_battle(), Combat_schedule::start_strike(), SoundTester::test_sound(), File_gump::toggle_option(), Usecode_internal::UI_play_music(), Usecode_internal::UI_play_sound_effect(), Usecode_internal::UI_play_sound_effect2(), Usecode_internal::UI_restart_game(), Usecode_internal::UI_run_endgame(), Usecode_internal::UI_set_schedule_type(), Usecode_internal::UI_start_speech(), and Game_window::write_gwin().

static int Audio::game_sfx ( int  sfx  )  [inline, static]

Definition at line 88 of file Audio.h.

References bg2si_sfxs.

Referenced by Egg_object::activate(), Gump_manager::add_gump(), Dragging_info::Dragging_info(), Dragging_info::drop(), Dragging_info::drop_on_map(), Object_sfx::get_shape_sfx(), Background_noise::handle_event(), Earthquake::handle_event(), Lightning_effect::handle_event(), and Explosion_effect::handle_event().

void Audio::Init_sfx ( void   ) 

Definition at line 360 of file Audio.cc.

References bg2si_sfxs, bgconv, config, Game::get_game_type(), Game::get_gametitle(), s, SERPENT_ISLE, sfx_file, U7exists(), and Configuration::value().

Referenced by Init().

Here is the call graph for this function:

void Audio::honest_sample_rates ( void   )  [inline]

Definition at line 93 of file Audio.h.

References truthful_.

void Audio::cancel_streams ( void   ) 

Definition at line 743 of file Audio.cc.

References audio_enabled.

Referenced by SI_Game::end_game(), SI_Game::play_intro(), BG_Game::play_intro(), Game_window::read(), SoundTester::test_sound(), and Usecode_internal::UI_play_music().

void Audio::pause_audio ( void   ) 

Definition at line 750 of file Audio.cc.

References audio_enabled.

Referenced by Game_window::lose_focus().

void Audio::resume_audio ( void   ) 

Definition at line 758 of file Audio.cc.

References audio_enabled.

Referenced by Game_window::get_focus().

void Audio::play ( uint8 sound_data,
uint32  len,
bool   
)

Definition at line 718 of file Audio.cc.

References audio_enabled, convert_VOC(), and speech_enabled.

Referenced by BG_Game::end_game(), SI_Game::play_intro(), ExCineVoc::play_it(), playfile(), and start_speech().

Here is the call graph for this function:

void Audio::playfile ( const char *  ,
bool   
)

Definition at line 767 of file Audio.cc.

References audio_enabled, len, play(), and U7open().

Referenced by Game::play_audio(), and BG_Game::scene_guardian().

Here is the call graph for this function:

bool Audio::playing ( void   ) 

Definition at line 799 of file Audio.cc.

void Audio::start_music ( int  num,
bool  continuous,
int  bank = 0 
)

Definition at line 805 of file Audio.cc.

References allow_music_looping, audio_enabled, midi, music_enabled, and MyMidiPlayer::start_music().

Referenced by ActionPlayMusic(), Egg_object::activate(), SI_Game::end_game(), BG_Game::end_game(), Usecode_script::exec(), Background_noise::handle_event(), SI_Game::play_intro(), Game::play_midi(), Game_window::read_gwin(), ExultMenu::run(), SoundTester::test_sound(), and Usecode_internal::UI_play_music().

Here is the call graph for this function:

void Audio::start_music ( const char *  fname,
int  num,
bool  continuous 
)

Definition at line 811 of file Audio.cc.

References allow_music_looping, audio_enabled, midi, music_enabled, and MyMidiPlayer::start_music().

Here is the call graph for this function:

void Audio::start_music ( XMIDIEventList midfile,
bool  continuous 
)

Definition at line 817 of file Audio.cc.

References allow_music_looping, audio_enabled, midi, music_enabled, and MyMidiPlayer::start_track().

Here is the call graph for this function:

void Audio::start_music_combat ( Combat_song  song,
bool  continuous,
int  bank = 0 
)

Definition at line 823 of file Audio.cc.

References allow_music_looping, audio_enabled, CERR, CSAttacked1, CSAttacked2, CSBattle_Over, CSDanger, CSHidden_Danger, CSRun_Away, CSVictory, Game::get_game_type(), midi, music_enabled, SERPENT_ISLE, and MyMidiPlayer::start_music().

Referenced by Combat_schedule::ending(), Combat_schedule::monster_died(), and Combat_schedule::start_battle().

Here is the call graph for this function:

void Audio::stop_music (  ) 

Definition at line 902 of file Audio.cc.

References audio_enabled, midi, and MyMidiPlayer::stop_music().

Referenced by SI_Game::end_game(), BG_Game::end_game(), SI_Game::play_intro(), BG_Game::play_intro(), Game_window::read_gwin(), ExultMenu::run(), AudioOptions_gump::save_settings(), BG_Game::scene_guardian(), set_audio_enabled(), Game::show_menu(), SoundTester::test_sound(), File_gump::toggle_option(), Usecode_internal::UI_restart_game(), Usecode_internal::UI_set_schedule_type(), and ~Audio().

Here is the call graph for this function:

int Audio::play_sound_effect ( int  num,
int  volume = SDL_MIX_MAXVOLUME,
int  dir = 0,
int  repeat = 0 
)

Definition at line 946 of file Audio.cc.

References audio_enabled, effects_enabled, midi, play_wave_sfx(), sfx_file, and MyMidiPlayer::start_sound_effect().

Referenced by Egg_object::activate(), Gump_manager::add_gump(), Dragging_info::Dragging_info(), Dragging_info::drop(), Dragging_info::drop_on_map(), Usecode_script::exec(), Actor::figure_hit_points(), Background_noise::handle_event(), Earthquake::handle_event(), Lightning_effect::handle_event(), Explosion_effect::handle_event(), BG_Game::scene_guardian(), Object_sfx::set_obj(), Combat_schedule::start_strike(), SoundTester::test_sound(), Usecode_internal::UI_play_sound_effect(), and Usecode_internal::UI_play_sound_effect2().

Here is the call graph for this function:

int Audio::play_wave_sfx ( int  num,
int  volume = SDL_MIX_MAXVOLUME,
int  dir = 0,
int  repeat = 0 
)

Definition at line 965 of file Audio.cc.

References bgconv, BLACK_GATE, SFX_cached::buf, CERR, effects_enabled, Game::get_game_type(), SFX_cached::len, SFX_cached::next, SFX_cached::num, Flex::number_of_objects(), Flex::retrieve(), sfx_file, sfxs, and wave.

Referenced by play_sound_effect().

Here is the call graph for this function:

void Audio::stop_sound_effects (  ) 

Definition at line 1062 of file Audio.cc.

References midi, sfx_file, and MyMidiPlayer::stop_sound_effects().

Referenced by AudioOptions_gump::save_settings(), set_audio_enabled(), File_gump::toggle_option(), and Usecode_internal::UI_run_endgame().

Here is the call graph for this function:

bool Audio::start_speech ( int  num,
bool  wait = false 
)

Definition at line 910 of file Audio.cc.

References audio_enabled, Game::get_game_type(), len, play(), U7object::retrieve(), SERPENT_ISLE, SISPEECH, speech_enabled, and U7SPEECH.

Referenced by Usecode_script::exec(), SoundTester::test_sound(), and Usecode_internal::UI_start_speech().

Here is the call graph for this function:

bool Audio::is_speech_enabled (  )  const [inline]

Definition at line 113 of file Audio.h.

References speech_enabled.

Referenced by SI_Game::end_game(), File_gump::File_gump(), AudioOptions_gump::load_settings(), SI_Game::play_intro(), and File_gump::toggle_option().

void Audio::set_speech_enabled ( bool  ena  )  [inline]

Definition at line 114 of file Audio.h.

References speech_enabled.

Referenced by AudioOptions_gump::save_settings(), and File_gump::toggle_option().

bool Audio::is_music_enabled (  )  const [inline]

Definition at line 115 of file Audio.h.

References music_enabled.

Referenced by File_gump::File_gump(), MyMidiPlayer::init_device(), AudioOptions_gump::load_settings(), and File_gump::toggle_option().

void Audio::set_music_enabled ( bool  ena  )  [inline]

Definition at line 116 of file Audio.h.

References music_enabled.

Referenced by AudioOptions_gump::save_settings(), and File_gump::toggle_option().

bool Audio::are_effects_enabled (  )  const [inline]

Definition at line 117 of file Audio.h.

References effects_enabled.

Referenced by File_gump::File_gump(), MyMidiPlayer::init_device(), AudioOptions_gump::load_settings(), and File_gump::toggle_option().

void Audio::set_effects_enabled ( bool  ena  )  [inline]

Definition at line 118 of file Audio.h.

References effects_enabled.

Referenced by AudioOptions_gump::save_settings(), and File_gump::toggle_option().

bool Audio::is_audio_enabled (  )  const [inline]

Definition at line 119 of file Audio.h.

References audio_enabled.

Referenced by AudioOptions_gump::load_settings().

void Audio::set_audio_enabled ( bool  ena  ) 

Definition at line 1074 of file Audio.cc.

References audio_enabled, Init(), initialized, SAMPLERATE, stop_music(), and stop_sound_effects().

Referenced by AudioOptions_gump::save_settings().

Here is the call graph for this function:

bool Audio::is_music_looping_allowed (  )  const [inline]

Definition at line 121 of file Audio.h.

References allow_music_looping.

Referenced by AudioOptions_gump::load_settings().

void Audio::set_allow_music_looping ( bool  ena  )  [inline]

Definition at line 122 of file Audio.h.

References allow_music_looping.

Referenced by AudioOptions_gump::save_settings().

bool Audio::can_sfx ( const std::string &  game  )  const

Definition at line 339 of file Audio.cc.

References config, s, U7exists(), and Configuration::value().

Referenced by ExultMenu::run().

Here is the call graph for this function:

void Audio::channel_complete_callback ( int  chan  )  [static]

Definition at line 322 of file Audio.cc.

Referenced by Init().

bool Audio::is_track_playing ( int  num  )  [inline]

Definition at line 126 of file Audio.h.

References MyMidiPlayer::is_track_playing(), and midi.

Here is the call graph for this function:

int Audio::get_sample_rate (  )  [inline]

Definition at line 130 of file Audio.h.

References actual.

bool Audio::is_stereo (  )  [inline]

Definition at line 131 of file Audio.h.

References actual.

Referenced by convert_VOC().

MyMidiPlayer* Audio::get_midi (  )  [inline]

Definition at line 133 of file Audio.h.

References midi.

Referenced by Game::create_game(), SI_Game::end_game(), BG_Game::end_game(), Background_noise::handle_event(), AudioOptions_gump::load_settings(), SI_Game::play_intro(), AudioOptions_gump::save_settings(), ExultMenu::setup(), and Game_window::write_gwin().

Flex* Audio::get_sfx_file (  )  [inline]

Definition at line 135 of file Audio.h.

References sfx_file.

Referenced by Object_sfx::get_shape_sfx().


Friends And Related Function Documentation

friend class Tired_of_compiler_warnings [friend]

Definition at line 82 of file Audio.h.


Member Data Documentation

Audio * Audio::self [static, private]

Definition at line 55 of file Audio.h.

int * Audio::bg2si_sfxs [static, private]

Definition at line 56 of file Audio.h.

Referenced by game_sfx(), and Init_sfx().

bool Audio::truthful_ [private]

Definition at line 57 of file Audio.h.

Referenced by honest_sample_rates().

bool Audio::speech_enabled [private]

Definition at line 58 of file Audio.h.

Referenced by Audio(), is_speech_enabled(), play(), set_speech_enabled(), and start_speech().

bool Audio::music_enabled [private]

Definition at line 58 of file Audio.h.

Referenced by Audio(), is_music_enabled(), set_music_enabled(), start_music(), and start_music_combat().

bool Audio::effects_enabled [private]

Definition at line 58 of file Audio.h.

Referenced by are_effects_enabled(), Audio(), play_sound_effect(), play_wave_sfx(), and set_effects_enabled().

bool Audio::allow_music_looping [private]

Definition at line 59 of file Audio.h.

Referenced by Audio(), is_music_looping_allowed(), set_allow_music_looping(), start_music(), and start_music_combat().

bool Audio::SDL_open [private]

Definition at line 60 of file Audio.h.

Referenced by Init(), and ~Audio().

SFX_cached* Audio::sfxs [private]

Definition at line 61 of file Audio.h.

Referenced by play_wave_sfx(), and ~Audio().

MyMidiPlayer* Audio::midi [private]

Definition at line 62 of file Audio.h.

Referenced by Audio(), get_midi(), Init(), is_track_playing(), play_sound_effect(), start_music(), start_music_combat(), stop_music(), stop_sound_effects(), and ~Audio().

bool Audio::initialized [private]

Definition at line 63 of file Audio.h.

Referenced by Init(), set_audio_enabled(), and ~Audio().

SDL_AudioSpec Audio::wanted [private]

Definition at line 64 of file Audio.h.

Mix_Chunk* Audio::wave [private]

Definition at line 65 of file Audio.h.

Referenced by play_wave_sfx().

bool Audio::audio_enabled

Definition at line 68 of file Audio.h.

Referenced by Audio(), cancel_streams(), Init(), is_audio_enabled(), pause_audio(), play(), play_sound_effect(), playfile(), resume_audio(), set_audio_enabled(), start_music(), start_music_combat(), start_speech(), and stop_music().

SDL_AudioSpec Audio::actual

Definition at line 69 of file Audio.h.

Referenced by convert_VOC(), get_sample_rate(), Init(), and is_stereo().

Flex* Audio::sfx_file

Definition at line 70 of file Audio.h.

Referenced by get_sfx_file(), Init_sfx(), play_sound_effect(), play_wave_sfx(), stop_sound_effects(), and ~Audio().


The documentation for this class was generated from the following files:
Generated on Mon Jul 9 14:47:01 2007 for ExultEngine by  doxygen 1.5.1