minor non-functional changes
This commit is contained in:
parent
7dc347c29f
commit
5a6f74e114
|
|
@ -19,23 +19,22 @@
|
|||
#include "audio_manager.h"
|
||||
#include "config_audio.h"
|
||||
|
||||
AudioManager* AudioManager::_global_ptr = (AudioManager*)0L;
|
||||
AudioManager::UpdateFunc* AudioManager::_update_func =
|
||||
(AudioManager::UpdateFunc*)0L;
|
||||
AudioManager::ShutdownFunc* AudioManager::_shutdown_func =
|
||||
(AudioManager::ShutdownFunc*)0L;
|
||||
// Statics (all default to zero):
|
||||
AudioManager* AudioManager::_global_ptr;
|
||||
AudioManager::UpdateFunc* AudioManager::_update_func;
|
||||
AudioManager::ShutdownFunc* AudioManager::_shutdown_func;
|
||||
mutex AudioManager::_manager_mutex;
|
||||
bool AudioManager::_quit;
|
||||
thread* AudioManager::_spawned = (thread*)0L;
|
||||
AudioManager::LoopSet* AudioManager::_loopset = (AudioManager::LoopSet*)0L;
|
||||
AudioManager::LoopSet* AudioManager::_loopcopy = (AudioManager::LoopSet*)0L;
|
||||
bool AudioManager::_sfx_active = false;
|
||||
bool AudioManager::_music_active = false;
|
||||
bool AudioManager::_hard_sfx_active = false;
|
||||
bool AudioManager::_hard_music_active = false;
|
||||
bool AudioManager::_master_volume_change = false;
|
||||
float AudioManager::_master_sfx_volume = 0.;
|
||||
float AudioManager::_master_music_volume = 0.;
|
||||
thread* AudioManager::_spawned;
|
||||
AudioManager::LoopSet* AudioManager::_loopset;
|
||||
AudioManager::LoopSet* AudioManager::_loopcopy;
|
||||
bool AudioManager::_sfx_active;
|
||||
bool AudioManager::_music_active;
|
||||
bool AudioManager::_hard_sfx_active;
|
||||
bool AudioManager::_hard_music_active;
|
||||
bool AudioManager::_master_volume_change;
|
||||
float AudioManager::_master_sfx_volume;
|
||||
float AudioManager::_master_music_volume;
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
// Function: AudioManager::destructor
|
||||
|
|
@ -45,7 +44,7 @@ float AudioManager::_master_music_volume = 0.;
|
|||
AudioManager::
|
||||
~AudioManager() {
|
||||
shutdown();
|
||||
_global_ptr = (AudioManager*)0L;
|
||||
_global_ptr = 0;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
|
@ -87,7 +86,8 @@ void AudioManager::
|
|||
ns_update() {
|
||||
// handle looping
|
||||
if (_loopcopy) {
|
||||
for (LoopSet::iterator i=_loopcopy->begin(); i!=_loopcopy->end(); ++i) {
|
||||
LoopSet::iterator i=_loopcopy->begin();
|
||||
for (; i!=_loopcopy->end(); ++i) {
|
||||
AudioSound* sound = *i;
|
||||
if (sound->status() == AudioSound::READY) {
|
||||
audio_debug("AudioManager::ns_update looping '"
|
||||
|
|
@ -179,7 +179,7 @@ ns_set_loop(AudioSound* sound, bool state) {
|
|||
}
|
||||
if (state) {
|
||||
_loopset->insert(sound);
|
||||
} else if (_loopset->find(sound) != _loopset->end()) {
|
||||
} else {
|
||||
_loopset->erase(sound);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -76,9 +76,7 @@ static void initialize() {
|
|||
return;
|
||||
}
|
||||
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "in winAudio initialize" << endl;
|
||||
}
|
||||
audio_debug("in winAudio initialize");
|
||||
|
||||
// rumor has it this will work, if it doesn't we need to create an invisible
|
||||
// application window for this kind of thing
|
||||
|
|
@ -169,16 +167,11 @@ static void initialize() {
|
|||
|
||||
AudioManager::set_update_func(update_win);
|
||||
have_initialized = true;
|
||||
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "out of winAudio initialize" << endl;
|
||||
}
|
||||
audio_debug("out of winAudio initialize");
|
||||
}
|
||||
|
||||
static void shutdown() {
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "in winaudio shutdown" << endl;
|
||||
}
|
||||
audio_debug("in winaudio shutdown");
|
||||
|
||||
// release the primary sound buffer
|
||||
if (soundPrimaryBuffer) {
|
||||
|
|
@ -205,46 +198,34 @@ static void shutdown() {
|
|||
|
||||
// shutdown COM
|
||||
CoUninitialize();
|
||||
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "out of winaudio shutdown" << endl;
|
||||
}
|
||||
audio_debug("out of winaudio shutdown");
|
||||
}
|
||||
|
||||
WinSample::~WinSample() {
|
||||
// we may or may not be leaking the _data
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "winsample destructor called" << endl;
|
||||
}
|
||||
audio_debug("winsample destructor called");
|
||||
}
|
||||
|
||||
float WinSample::length() const {
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "winsample length called" << endl;
|
||||
}
|
||||
audio_debug("winsample length called");
|
||||
return _len / (audio_mix_freq * 2. * 2.);
|
||||
}
|
||||
|
||||
AudioTraits::PlayingClass* WinSample::get_state() const {
|
||||
WinSamplePlaying* ret = new WinSamplePlaying((WinSample*)this);
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winsample get_state returning 0x" << (void*)ret
|
||||
<< endl;
|
||||
audio_debug("winsample get_state returning 0x" << (void*)ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AudioTraits::PlayerClass* WinSample::get_player() const {
|
||||
AudioTraits::PlayerClass* ret = WinSamplePlayer::get_instance();
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winsample get_player returning 0x" << (void*)ret
|
||||
<< endl;
|
||||
audio_debug("winsample get_player returning 0x" << (void*)ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AudioTraits::DeletePlayingFunc* WinSample::get_delstate() const {
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winsample get_delstate returning 0x"
|
||||
<< (void*)(WinSamplePlaying::destroy) << endl;
|
||||
audio_debug("winsample get_delstate returning 0x"
|
||||
<< (void*)(WinSamplePlaying::destroy));
|
||||
return WinSamplePlaying::destroy;
|
||||
}
|
||||
|
||||
|
|
@ -582,48 +563,37 @@ void WinMusic::init() {
|
|||
CHECK_RESULT(result, "failed to assign performance channels");
|
||||
*/
|
||||
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "out of WinMusic::init() _performance = "
|
||||
audio_debug("out of WinMusic::init() _performance = "
|
||||
<< (void*)_performance << " _synth = "
|
||||
<< (void*)_synth << " _buffer = " << (void*)_buffer
|
||||
<< endl;
|
||||
<< (void*)_synth << " _buffer = " << (void*)_buffer);
|
||||
}
|
||||
|
||||
float WinMusic::length() const {
|
||||
// DO THIS
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "winmusic length" << endl;
|
||||
}
|
||||
audio_debug("winmusic length");
|
||||
return -1.;
|
||||
}
|
||||
|
||||
AudioTraits::PlayingClass* WinMusic::get_state() const {
|
||||
WinMusicPlaying* ret = new WinMusicPlaying((WinMusic*)this);
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winmusic get_state returning 0x"
|
||||
<< (void*)ret << endl;
|
||||
audio_debug("winmusic get_state returning 0x" << (void*)ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AudioTraits::PlayerClass* WinMusic::get_player() const {
|
||||
AudioTraits::PlayerClass* ret = WinMusicPlayer::get_instance();
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winmusic get_player returning 0x" << (void*)ret
|
||||
<< endl;
|
||||
audio_debug("winmusic get_player returning 0x" << (void*)ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
AudioTraits::DeletePlayingFunc* WinMusic::get_delstate() const {
|
||||
if (audio_cat.is_debug())
|
||||
audio_cat->debug() << "winmusic get_delstate returning 0x"
|
||||
<< (void*)(WinMusicPlaying::destroy) << endl;
|
||||
audio_debug("winmusic get_delstate returning 0x"
|
||||
<< (void*)(WinMusicPlaying::destroy));
|
||||
return WinMusicPlaying::destroy;
|
||||
}
|
||||
|
||||
WinMusic* WinMusic::load_midi(Filename filename) {
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "in WinMusic::load_midi()" << endl;
|
||||
}
|
||||
audio_debug("in WinMusic::load_midi()");
|
||||
initialize();
|
||||
|
||||
if (!audio_is_active) {
|
||||
|
|
@ -633,9 +603,7 @@ WinMusic* WinMusic::load_midi(Filename filename) {
|
|||
// WinMusic* ret = (WinMusic*)0L;
|
||||
WinMusic* ret = new WinMusic();
|
||||
if (ret->_performance && ret->_music) {
|
||||
if (audio_cat.is_debug()) {
|
||||
audio_cat->debug() << "for some reason, have to stop" << endl;
|
||||
}
|
||||
audio_debug("for some reason, have to stop");
|
||||
ret->_performance->Stop(NULL, NULL, 0, 0);
|
||||
}
|
||||
ret->_music = NULL;
|
||||
|
|
|
|||
|
|
@ -53,16 +53,18 @@ ConfigureFn(config_audio) {
|
|||
Config::ConfigTable::Symbol::iterator i;
|
||||
audio_mode_flags = new string;
|
||||
for (i=mode.begin(); i!=mode.end(); ++i) {
|
||||
if (!audio_mode_flags->empty())
|
||||
if (!audio_mode_flags->empty()) {
|
||||
*audio_mode_flags += " ";
|
||||
}
|
||||
*audio_mode_flags += (*i).Val();
|
||||
}
|
||||
Config::ConfigTable::Symbol parms;
|
||||
config_audio.GetAll("audio-driver-param", parms);
|
||||
audio_driver_params = new string;
|
||||
for (i=parms.begin(); i!=parms.end(); ++i) {
|
||||
if (!audio_driver_params->empty())
|
||||
if (!audio_driver_params->empty()) {
|
||||
*audio_driver_params += " ";
|
||||
}
|
||||
*audio_driver_params += (*i).Val();
|
||||
}
|
||||
|
||||
|
|
@ -70,33 +72,37 @@ ConfigureFn(config_audio) {
|
|||
"/dev/dsp"));
|
||||
|
||||
string stmp = config_audio.GetString("audio-thread-priority", "NORMAL");
|
||||
for (string::iterator q=stmp.begin(); q!=stmp.end(); ++q)
|
||||
for (string::iterator q=stmp.begin(); q!=stmp.end(); ++q) {
|
||||
(*q) = toupper(*q);
|
||||
if (stmp == "LOW")
|
||||
}
|
||||
if (stmp == "LOW") {
|
||||
audio_thread_priority = 0;
|
||||
else if (stmp == "NORMAL")
|
||||
} else if (stmp == "NORMAL") {
|
||||
audio_thread_priority = 1;
|
||||
else if (stmp == "HIGH")
|
||||
} else if (stmp == "HIGH") {
|
||||
audio_thread_priority = 2;
|
||||
else
|
||||
} else{
|
||||
audio_thread_priority = -1;
|
||||
}
|
||||
}
|
||||
|
||||
void audio_load_loaders() {
|
||||
static bool did_load = false;
|
||||
|
||||
if (did_load)
|
||||
if (did_load) {
|
||||
return;
|
||||
}
|
||||
Config::ConfigTable::Symbol::iterator i;
|
||||
Config::ConfigTable::Symbol loaders;
|
||||
config_audio.GetAll("audio-loader", loaders);
|
||||
for (i=loaders.begin(); i!=loaders.end(); ++i) {
|
||||
Filename dlname = Filename::dso_filename("libaudio_load_" + (*i).Val() +
|
||||
".so");
|
||||
audio_cat->info() << "loading '" << (*i).Val() << "' loader" << endl;
|
||||
audio_info("loading '" << (*i).Val() << "' loader");
|
||||
void* tmp = load_dso(dlname);
|
||||
if (tmp == (void*)0L)
|
||||
audio_cat->info() << "unable to load: " << load_dso_error() << endl;
|
||||
if (tmp == (void*)0L) {
|
||||
audio_info("unable to load: " << load_dso_error());
|
||||
}
|
||||
}
|
||||
did_load = true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue