*** empty log message ***

This commit is contained in:
Dave Schuyler 2003-08-20 00:30:33 +00:00
parent 24b2117dbc
commit b11b16a896
4 changed files with 241 additions and 87 deletions

View File

@ -24,6 +24,11 @@ namespace {
static const string blank=""; static const string blank="";
} }
////////////////////////////////////////////////////////////////////
// Function:
// Access:
// Description: All of these functions are just stubs.
////////////////////////////////////////////////////////////////////
NullAudioSound::NullAudioSound() { NullAudioSound::NullAudioSound() {
// Intentionally blank. // Intentionally blank.
} }

View File

@ -19,6 +19,13 @@
#include "pandabase.h" #include "pandabase.h"
#ifdef HAVE_FMOD //[ #ifdef HAVE_FMOD //[
// Please remove this as part of updating fmod:
#error The fmod audio needs repair by the fmod implementers
#include "config_fmodAudio.h" #include "config_fmodAudio.h"
#include "fmodAudioManager.h" #include "fmodAudioManager.h"
#include "fmodAudioSound.h" #include "fmodAudioSound.h"

View File

@ -27,11 +27,15 @@
#include "config_express.h" #include "config_express.h"
#include "virtualFileSystem.h" #include "virtualFileSystem.h"
#include "nullAudioSound.h" #include "nullAudioSound.h"
#include <algorithm> #include <algorithm>
int MilesAudioManager::_active_managers = 0; int MilesAudioManager::_active_managers = 0;
HDLSFILEID MilesAudioManager::_dls_field = NULL; HDLSFILEID MilesAudioManager::_dls_field = NULL;
bool bMilesShutdownCalled = false;
namespace {
bool miles_shutdown_called = false;
}
PT(AudioManager) Create_AudioManager() { PT(AudioManager) Create_AudioManager() {
audio_debug("Create_AudioManager() Miles."); audio_debug("Create_AudioManager() Miles.");
@ -39,10 +43,10 @@ PT(AudioManager) Create_AudioManager() {
} }
void CustomMilesShutdown() { void CustomMilesShutdown() {
if (bMilesShutdownCalled) { if (miles_shutdown_called) {
return; return;
} }
bMilesShutdownCalled = true; miles_shutdown_called = true;
if (MilesAudioManager::_dls_field!=NULL) { if (MilesAudioManager::_dls_field!=NULL) {
HDLSDEVICE dls= NULL; HDLSDEVICE dls= NULL;
@ -198,7 +202,7 @@ MilesAudioManager::
} }
audio_debug(" AIL_quick_shutdown()"); audio_debug(" AIL_quick_shutdown()");
AIL_quick_shutdown(); AIL_quick_shutdown();
bMilesShutdownCalled = true; miles_shutdown_called = true;
} }
} }

View File

@ -31,8 +31,13 @@
#ifndef NDEBUG //[ #ifndef NDEBUG //[
namespace { namespace {
////////////////////////////////////////////////////////////////////
// Function: get_status_char
// Access:
// Description:
////////////////////////////////////////////////////////////////////
char char
getStatusChar(HAUDIO audio) { get_status_char(HAUDIO audio) {
if (!audio) { if (!audio) {
return '0'; // NULL. return '0'; // NULL.
} }
@ -46,11 +51,26 @@
return 'x'; // bad. return 'x'; // bad.
} }
} }
#define miles_audio_debug(x) \
audio_debug("MilesAudioSound "<<get_status_char(_audio)<<" \""<<get_name() \
<<"\" "<< x )
}
#else //][
#define miles_audio_debug(x) ((void)0)
#endif //]
namespace {
AILSEQUENCECB sequence_callback = 0; AILSEQUENCECB sequence_callback = 0;
AILSAMPLECB sample_callback = 0; AILSAMPLECB sample_callback = 0;
const user_data_index = 7; const user_data_index = 7;
////////////////////////////////////////////////////////////////////
// Function: pandaAudioAilCallback_Sequence
// Access: file scope
// Description: This function is part of a hack for finish callbacks
// when using the Miles quick API.
////////////////////////////////////////////////////////////////////
void AILCALLBACK void AILCALLBACK
pandaAudioAilCallback_Sequence(HSEQUENCE S) { pandaAudioAilCallback_Sequence(HSEQUENCE S) {
assert(S); assert(S);
@ -64,6 +84,12 @@
} }
} }
////////////////////////////////////////////////////////////////////
// Function: pandaAudioAilCallback_Sample
// Access: file scope
// Description: This function is part of a hack for finish callbacks
// when using the Miles quick API.
////////////////////////////////////////////////////////////////////
void AILCALLBACK void AILCALLBACK
pandaAudioAilCallback_Sample(HSAMPLE S) { pandaAudioAilCallback_Sample(HSAMPLE S) {
assert(S); assert(S);
@ -77,6 +103,15 @@
} }
} }
////////////////////////////////////////////////////////////////////
// Function: panda_AIL_quick_set_finished_callback
// Access: file scope
// Description: This function is part of a hack for finish callbacks
// when using the Miles quick API.
//
// This will determine whether the sound is a MIDI or
// a wave sample and setup the correct callback.
////////////////////////////////////////////////////////////////////
void void
panda_AIL_quick_set_finished_callback(HAUDIO audio, MilesAudioSound* sound) { panda_AIL_quick_set_finished_callback(HAUDIO audio, MilesAudioSound* sound) {
audio_debug("panda_AIL_quick_set_finished_callback(audio="<<((void*)audio) audio_debug("panda_AIL_quick_set_finished_callback(audio="<<((void*)audio)
@ -114,13 +149,11 @@
} }
#define miles_audio_debug(x) \ ////////////////////////////////////////////////////////////////////
audio_debug("MilesAudioSound "<<getStatusChar(_audio)<<" \""<<get_name() \ // Function: MilesAudioSound::
<<"\" "<< x ) // Access:
#else //][ // Description:
#define miles_audio_debug(x) ((void)0) ////////////////////////////////////////////////////////////////////
#endif //]
MilesAudioSound:: MilesAudioSound::
MilesAudioSound(MilesAudioManager* manager, MilesAudioSound(MilesAudioManager* manager,
HAUDIO audio, string file_name, float length) HAUDIO audio, string file_name, float length)
@ -136,6 +169,11 @@ MilesAudioSound(MilesAudioManager* manager,
_audio=AIL_quick_copy(audio); _audio=AIL_quick_copy(audio);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
MilesAudioSound:: MilesAudioSound::
~MilesAudioSound() { ~MilesAudioSound() {
miles_audio_debug("~MilesAudioSound()"); miles_audio_debug("~MilesAudioSound()");
@ -144,6 +182,11 @@ MilesAudioSound::
AIL_quick_unload(_audio); AIL_quick_unload(_audio);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
play() { play() {
#if 0 #if 0
@ -173,6 +216,11 @@ play() {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
stop() { stop() {
miles_audio_debug("stop()"); miles_audio_debug("stop()");
@ -187,6 +235,11 @@ stop() {
AIL_quick_halt(_audio); AIL_quick_halt(_audio);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
finished() { finished() {
miles_audio_debug("finished()"); miles_audio_debug("finished()");
@ -196,6 +249,11 @@ finished() {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_loop(bool loop) { set_loop(bool loop) {
miles_audio_debug("set_loop(loop="<<loop<<")"); miles_audio_debug("set_loop(loop="<<loop<<")");
@ -203,12 +261,22 @@ set_loop(bool loop) {
set_loop_count((loop)?0:1); set_loop_count((loop)?0:1);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
bool MilesAudioSound:: bool MilesAudioSound::
get_loop() const { get_loop() const {
miles_audio_debug("get_loop() returning "<<(_loop_count==0)); miles_audio_debug("get_loop() returning "<<(_loop_count==0));
return (_loop_count == 0); return (_loop_count == 0);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_loop_count(unsigned long loop_count) { set_loop_count(unsigned long loop_count) {
miles_audio_debug("set_loop_count(loop_count="<<loop_count<<")"); miles_audio_debug("set_loop_count(loop_count="<<loop_count<<")");
@ -228,12 +296,22 @@ set_loop_count(unsigned long loop_count) {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
unsigned long MilesAudioSound:: unsigned long MilesAudioSound::
get_loop_count() const { get_loop_count() const {
miles_audio_debug("get_loop_count() returning "<<_loop_count); miles_audio_debug("get_loop_count() returning "<<_loop_count);
return _loop_count; return _loop_count;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_time(float time) { set_time(float time) {
miles_audio_debug("set_time(time="<<time<<")"); miles_audio_debug("set_time(time="<<time<<")");
@ -241,6 +319,11 @@ set_time(float time) {
AIL_quick_set_ms_position(_audio, milisecond_time); AIL_quick_set_ms_position(_audio, milisecond_time);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
float MilesAudioSound:: float MilesAudioSound::
get_time() const { get_time() const {
S32 milisecond_time=AIL_quick_ms_position(_audio); S32 milisecond_time=AIL_quick_ms_position(_audio);
@ -249,6 +332,11 @@ get_time() const {
return time; return time;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_volume(float volume) { set_volume(float volume) {
miles_audio_debug("set_volume(volume="<<volume<<")"); miles_audio_debug("set_volume(volume="<<volume<<")");
@ -296,12 +384,22 @@ set_volume(float volume) {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
float MilesAudioSound:: float MilesAudioSound::
get_volume() const { get_volume() const {
miles_audio_debug("get_volume() returning "<<_volume); miles_audio_debug("get_volume() returning "<<_volume);
return _volume; return _volume;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_balance(float balance_right) { set_balance(float balance_right) {
miles_audio_debug("set_balance(balance_right="<<balance_right<<")"); miles_audio_debug("set_balance(balance_right="<<balance_right<<")");
@ -310,12 +408,22 @@ set_balance(float balance_right) {
set_volume(_volume); set_volume(_volume);
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
float MilesAudioSound:: float MilesAudioSound::
get_balance() const { get_balance() const {
audio_debug("MilesAudioSound::get_balance() returning "<<_balance); audio_debug("MilesAudioSound::get_balance() returning "<<_balance);
return _balance; return _balance;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
float MilesAudioSound:: float MilesAudioSound::
length() const { length() const {
if (_length == 0.0f) { if (_length == 0.0f) {
@ -358,6 +466,11 @@ length() const {
return _length; return _length;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_active(bool active) { set_active(bool active) {
miles_audio_debug("set_active(active="<<active<<")"); miles_audio_debug("set_active(active="<<active<<")");
@ -385,30 +498,55 @@ set_active(bool active) {
} }
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
bool MilesAudioSound:: bool MilesAudioSound::
get_active() const { get_active() const {
miles_audio_debug("get_active() returning "<<_active); miles_audio_debug("get_active() returning "<<_active);
return _active; return _active;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
void MilesAudioSound:: void MilesAudioSound::
set_finished_event(const string& event) { set_finished_event(const string& event) {
miles_audio_debug("set_finished_event(event="<<event<<")"); miles_audio_debug("set_finished_event(event="<<event<<")");
_finished_event = event; _finished_event = event;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
const string& MilesAudioSound:: const string& MilesAudioSound::
get_finished_event() const { get_finished_event() const {
miles_audio_debug("get_finished_event() returning "<<_finished_event); miles_audio_debug("get_finished_event() returning "<<_finished_event);
return _finished_event; return _finished_event;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
const string& MilesAudioSound:: const string& MilesAudioSound::
get_name() const { get_name() const {
//audio_debug("MilesAudioSound::get_name() returning "<<_file_name); //audio_debug("MilesAudioSound::get_name() returning "<<_file_name);
return _file_name; return _file_name;
} }
////////////////////////////////////////////////////////////////////
// Function: MilesAudioSound::
// Access:
// Description:
////////////////////////////////////////////////////////////////////
AudioSound::SoundStatus MilesAudioSound:: AudioSound::SoundStatus MilesAudioSound::
status() const { status() const {
if (!_audio) { if (!_audio) {