From ece078a5cd42d4a50394e69e341dcde544cb2853 Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 3 Jun 2009 00:49:04 +0000 Subject: [PATCH] revert Schell Games changes to fmod--seems crashy, might be code rot --- panda/src/audiotraits/fmodAudioManager.cxx | 58 ++++----- panda/src/audiotraits/fmodAudioManager.h | 38 +++--- panda/src/audiotraits/fmodAudioSound.cxx | 122 +++++++++--------- panda/src/audiotraits/fmodAudioSound.h | 25 ++-- .../src/audiotraits/fmod_audio_composite1.cxx | 2 +- 5 files changed, 122 insertions(+), 123 deletions(-) diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 379c29c85c..4d9fd85848 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -38,13 +38,13 @@ TypeHandle FmodAudioManager::_type_handle; -FMOD::System *FmodAudioManager::_system; +FMOD::System *FmodAudioManager::_system; pset FmodAudioManager::_all_managers; bool FmodAudioManager::_system_is_valid = false; -// This sets the distance factor for 3D audio to use feet. +// This sets the distance factor for 3D audio to use feet. // FMOD uses meters by default. // Since Panda use feet we need to compensate for that with a factor of 3.28 // @@ -80,7 +80,7 @@ AudioManager *Create_FmodAudioManager() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::Constructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// FmodAudioManager:: FmodAudioManager() { @@ -90,7 +90,7 @@ FmodAudioManager() { unsigned int version; _all_managers.insert(this); - + //Init 3D attributes _position.x = 0; _position.y = 0; @@ -120,7 +120,7 @@ FmodAudioManager() { // Let check the Version of FMOD to make sure the Headers and Libraries are correct. result = _system->getVersion(&version); fmod_audio_errcheck("_system->getVersion()", result); - + if (version < FMOD_VERSION){ audio_error("You are using an old version of FMOD. This program requires:" << FMOD_VERSION); } @@ -133,7 +133,7 @@ FmodAudioManager() { } //Now we Initialize the System. - int nchan = fmod_number_of_sound_channels; + int nchan = fmod_number_of_sound_channels; result = _system->init(nchan, FMOD_INIT_NORMAL, 0); fmod_audio_errcheck("_system->init()", result); @@ -172,7 +172,7 @@ FmodAudioManager() { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::Destructor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// FmodAudioManager:: ~FmodAudioManager() { @@ -196,7 +196,7 @@ FmodAudioManager:: //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::is_valid // Access: Public -// Description: This just check to make sure the FMOD System is +// Description: This just check to make sure the FMOD System is // up and running correctly. //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: @@ -318,7 +318,7 @@ make_dsp(const FilterProperties::FilterConfig &conf) { } dsp->setUserData(USER_DSP_MAGIC); - + return dsp; } @@ -359,7 +359,7 @@ update_dsp_chain(FMOD::DSP *head, FilterProperties *config) { return; } } - + for (int i=0; i<(int)(conf.size()); i++) { FMOD::DSP *dsp = make_dsp(conf[i]); if (dsp == 0) break; @@ -381,8 +381,8 @@ update_dsp_chain(FMOD::DSP *head, FilterProperties *config) { // Access: Public // Description: Configure the global DSP filter chain. // -// FMOD has a relatively powerful DSP -// implementation. It is likely that most +// FMOD has a relatively powerful DSP +// implementation. It is likely that most // configurations will be supported. //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: @@ -407,7 +407,7 @@ PT(AudioSound) FmodAudioManager:: get_sound(const string &file_name, bool positional, int) { //Needed so People use Panda's Generic UNIX Style Paths for Filename. //path.to_os_specific() converts it back to the proper OS version later on. - + Filename path = file_name; VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); @@ -489,7 +489,7 @@ getSpeakerSetup() { // Access: Published // Description: This is to set up FMOD to use a MultiChannel Setup. // This method is pretty much useless. -// To set a speaker setup in FMOD for Surround Sound, +// To set a speaker setup in FMOD for Surround Sound, // stereo, or whatever you have to set the SpeakerMode // BEFORE you Initialize FMOD. // Since Panda Inits the FmodAudioManager right when you @@ -515,7 +515,7 @@ setSpeakerSetup(AudioManager::SpeakerModeCategory cat) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::set_volume(float volume) // Access: Public -// Description: +// Description: // There isn't a specific system volume function in FMOD-EX, // so this function is moot now. //////////////////////////////////////////////////////////////////// @@ -526,7 +526,7 @@ void FmodAudioManager::set_volume(float volume) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::get_volume() // Access: Public -// Description: +// Description: // There isn't a specific system volume function in FMOD-EX, // so this function is moot now. //////////////////////////////////////////////////////////////////// @@ -548,8 +548,8 @@ set_active(bool active) { _active = active; // Tell our AudioSounds to adjust: - for (SoundSet::iterator i = _all_sounds.begin(); - i != _all_sounds.end(); + for (SoundSet::iterator i = _all_sounds.begin(); + i != _all_sounds.end(); ++i) { (*i)->set_active(_active); } @@ -559,7 +559,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::get_active() // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// bool FmodAudioManager:: get_active() const { @@ -617,10 +617,10 @@ audio_3d_set_listener_attributes(float px, float py, float pz, float vx, float v audio_debug("FmodAudioManager::audio_3d_set_listener_attributes()"); FMOD_RESULT result; - + _position.x = px; _position.y = pz; - _position.z = py; + _position.z = py; _velocity.x = vx; _velocity.y = vz; @@ -633,7 +633,7 @@ audio_3d_set_listener_attributes(float px, float py, float pz, float vx, float v _up.x = ux; _up.y = uz; _up.z = uy; - + result = _system->set3DListenerAttributes( 0, &_position, &_velocity, &_forward, &_up); fmod_audio_errcheck("_system->set3DListenerAttributes()", result); @@ -660,7 +660,7 @@ audio_3d_get_listener_attributes(float *px, float *py, float *pz, float *vx, flo void FmodAudioManager:: audio_3d_set_distance_factor(float factor) { audio_debug( "FmodAudioManager::audio_3d_set_distance_factor( factor= " << factor << ")" ); - + FMOD_RESULT result; _distance_factor = factor; @@ -687,7 +687,7 @@ audio_3d_get_distance_factor() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_set_doppler_factor // Access: Public -// Description: Exaggerates or diminishes the Doppler effect. +// Description: Exaggerates or diminishes the Doppler effect. // Defaults to 1.0 //////////////////////////////////////////////////////////////////// void FmodAudioManager:: @@ -706,7 +706,7 @@ audio_3d_set_doppler_factor(float factor) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_get_doppler_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// float FmodAudioManager:: audio_3d_get_doppler_factor() const { @@ -737,7 +737,7 @@ audio_3d_set_drop_off_factor(float factor) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::audio_3d_get_drop_off_factor // Access: Public -// Description: +// Description: //////////////////////////////////////////////////////////////////// float FmodAudioManager:: audio_3d_get_drop_off_factor() const { @@ -802,7 +802,7 @@ uncache_sound(const string& file_name) { void FmodAudioManager:: clear_cache() { audio_debug("FmodAudioManager::clear_cache()"); - + } //////////////////////////////////////////////////////////////////// @@ -842,7 +842,7 @@ open_callback(const char *name, int, unsigned int *file_size, // An invalid attempt to open an unnamed file. return FMOD_ERR_FILE_NOTFOUND; } - + VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); PT(VirtualFile) file = vfs->get_file(Filename(name)); @@ -903,7 +903,7 @@ read_callback(void *handle, void *buffer, unsigned int size_bytes, return FMOD_OK; } } - + //////////////////////////////////////////////////////////////////// // Function: FmodAudioManager::seek_callback // Access: Private, Static diff --git a/panda/src/audiotraits/fmodAudioManager.h b/panda/src/audiotraits/fmodAudioManager.h index a3aa0b8d14..98539b4d97 100644 --- a/panda/src/audiotraits/fmodAudioManager.h +++ b/panda/src/audiotraits/fmodAudioManager.h @@ -98,23 +98,23 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { virtual ~FmodAudioManager(); virtual bool is_valid(); - + virtual PT(AudioSound) get_sound(const string&, bool positional = false, int mode=SM_heuristic); virtual PT(AudioSound) get_sound(MovieAudio *, bool positional = false, int mode=SM_heuristic); - + virtual int getSpeakerSetup(); virtual void setSpeakerSetup(SpeakerModeCategory cat); virtual void set_volume(float); virtual float get_volume() const; - + virtual void set_active(bool); virtual bool get_active() const; virtual void stop_all_sounds(); virtual void update(); - + // This controls the "set of ears" that listens to 3D spacialized sound // px, py, pz are position coordinates. Can be 0.0f to ignore. // vx, vy, vz are a velocity vector in UNITS PER SECOND (default: meters). @@ -122,7 +122,7 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { // ux, uy and uz are the respective components of a unit up-vector // These changes will NOT be invoked until audio_3d_update() is called. virtual void audio_3d_set_listener_attributes(float px, float py, float pz, - float vx, float xy, float xz, + float vx, float xy, float xz, float fx, float fy, float fz, float ux, float uy, float uz); @@ -131,13 +131,13 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { float *vx, float *vy, float *vz, float *fx, float *fy, float *fz, float *ux, float *uy, float *uz); - + // Control the "relative distance factor" for 3D spacialized audio. Default is 1.0 // Fmod uses meters internally, so give a float in Units-per meter // Don't know what Miles uses. virtual void audio_3d_set_distance_factor(float factor); virtual float audio_3d_get_distance_factor() const; - void most_recently_used(const string& path); + // Control the presence of the Doppler effect. Default is 1.0 // Exaggerated Doppler, use >1.0 // Diminshed Doppler, use <1.0 @@ -164,27 +164,27 @@ class EXPCL_FMOD_AUDIO FmodAudioManager : public AudioManager { //////////////////////////////////////////////////////////////////// private: - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK open_callback(const char *name, int unicode, unsigned int *file_size, void **handle, void **user_data); - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK close_callback(void *handle, void *user_data); - static FMOD_RESULT F_CALLBACK + static FMOD_RESULT F_CALLBACK read_callback(void *handle, void *buffer, unsigned int size_bytes, unsigned int *bytes_read, void *user_data); - - static FMOD_RESULT F_CALLBACK + + static FMOD_RESULT F_CALLBACK seek_callback(void *handle, unsigned int pos, void *user_data); - + FMOD::DSP *make_dsp(const FilterProperties::FilterConfig &conf); void update_dsp_chain(FMOD::DSP *head, FilterProperties *config); virtual bool configure_filters(FilterProperties *config); - + private: - - static FMOD::System *_system; + + static FMOD::System *_system; static pset _all_managers; static bool _system_is_valid; @@ -201,10 +201,10 @@ private: // DLS info for MIDI files string _dlsname; FMOD_CREATESOUNDEXINFO _midi_info; - + bool _is_valid; bool _active; - + // The set of all sounds. Needed only to implement stop_all_sounds. typedef pset SoundSet; SoundSet _all_sounds; @@ -225,7 +225,7 @@ private: return get_class_type(); } virtual TypeHandle force_init_type() { - init_type(); + init_type(); return get_class_type(); } diff --git a/panda/src/audiotraits/fmodAudioSound.cxx b/panda/src/audiotraits/fmodAudioSound.cxx index d38a70c265..7ce265b73f 100644 --- a/panda/src/audiotraits/fmodAudioSound.cxx +++ b/panda/src/audiotraits/fmodAudioSound.cxx @@ -23,9 +23,7 @@ //Panda Headers #include "config_audio.h" -#include "config_util.h" #include "fmodAudioSound.h" -#include "virtualFileSystem.h" #include "string_utils.h" TypeHandle FmodAudioSound::_type_handle; @@ -39,7 +37,7 @@ TypeHandle FmodAudioSound::_type_handle; //////////////////////////////////////////////////////////////////// FmodAudioSound:: -FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { +FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: " << file_name ); _active = manager->get_active(); @@ -78,54 +76,54 @@ FmodAudioSound(AudioManager *manager, Filename file_name, bool positional) { result = _manager->_system->getSpeakerMode( &_speakermode ); fmod_audio_errcheck("_system->getSpeakerMode()", result); - // Load the sound into memory - string raw_data; - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - if (!vfs->read_file(file_name, raw_data, true)) { - audio_warning("Unable to read " << file_name); - return; + // Calculate the approximate uncompressed size of the sound. + int size = file_name.get_file_size(); + string ext = downcase(file_name.get_extension()); + if (ext != "wav") size *= 10; + + int flag = positional ? FMOD_3D : FMOD_2D; + int streamflag = (size > 250000) ? FMOD_CREATESTREAM : FMOD_CREATESAMPLE; + if (ext == "mid") { + streamflag = FMOD_CREATESTREAM; + sound_info = &_manager->_midi_info; + + if (sound_info->dlsname != NULL) { + audio_debug("Using DLS file " << sound_info->dlsname); + } } - // Setup info that FMOD needs in order to load from memory. - FMOD_CREATESOUNDEXINFO soundExInfo; - memset(&soundExInfo, 0, sizeof(FMOD_CREATESOUNDEXINFO)); - soundExInfo.cbsize = sizeof(FMOD_CREATESOUNDEXINFO); - soundExInfo.length = raw_data.size(); - - if (positional == true) { - result = _manager->_system->createSound(raw_data.data(), FMOD_SOFTWARE | FMOD_3D | FMOD_OPENMEMORY, &soundExInfo, &_sound); - fmod_audio_errcheck("_manager->_system->createSound", result); - - //This is just to collect the defaults of the sound, so we don't - //Have to query FMOD everytime for the info. - //It is also important we get the '_sampleFrequency' variable here, for the - //'set_play_rate()' and 'get_play_rate()' methods later; - - result = _sound->getDefaults( &_sampleFrequency, &_volume , &_balance, &_priority); - fmod_audio_errcheck("_sound->getDefaults", result); - - audio_debug("Sound loaded as 3D"); - } else { - result = _manager->_system->createSound(raw_data.data(), FMOD_SOFTWARE | FMOD_2D | FMOD_OPENMEMORY, &soundExInfo, &_sound); - fmod_audio_errcheck("_manager->_system->createSound", result); - - //This is just to collect the defaults of the sound, so we don't - //Have to query FMOD everytime for the info. - //It is also important we get the '_sampleFrequency' variable here, for the - //'set_play_rate()' and 'get_play_rate()' methods later; - - result = _sound->getDefaults( &_sampleFrequency, &_volume , &_balance, &_priority); + result = _manager->_system->createSound( file_name.c_str(), FMOD_SOFTWARE | streamflag | flag , + sound_info, &_sound); + if (result != FMOD_OK) { + audio_error("createSound(" << file_name << "): " << FMOD_ErrorString(result)); // We couldn't load the sound file. Create a blank sound record // instead. + char blank_data[100]; + FMOD_CREATESOUNDEXINFO exinfo; + memset(&exinfo, 0, sizeof(exinfo)); + memset(blank_data, 0, sizeof(blank_data)); + exinfo.cbsize = sizeof(exinfo); + exinfo.length = sizeof(blank_data); + exinfo.numchannels = 1; + exinfo.defaultfrequency = 8000; + exinfo.format = FMOD_SOUND_FORMAT_PCM16; + result = _manager->_system->createSound( blank_data, FMOD_SOFTWARE | flag | FMOD_OPENMEMORY | FMOD_OPENRAW, &exinfo, &_sound); fmod_audio_errcheck("createSound (blank)", result); - audio_debug("Sound loaded as 2D"); } // Some WAV files contain a loop bit. This is not handled // consistently. Override it. _sound->setLoopCount(1); _sound->setMode(FMOD_LOOP_OFF); + + //This is just to collect the defaults of the sound, so we don't + //Have to query FMOD everytime for the info. + //It is also important we get the '_sampleFrequency' variable here, for the + //'set_play_rate()' and 'get_play_rate()' methods later; + + result = _sound->getDefaults( &_sampleFrequency, &_volume , &_balance, &_priority); + fmod_audio_errcheck("_sound->getDefaults()", result); } @@ -164,9 +162,9 @@ play() { // reference count of the associated FmodAudioSound. //////////////////////////////////////////////////////////////////// FMOD_RESULT F_CALLBACK sound_end_callback(FMOD_CHANNEL * channel, - FMOD_CHANNEL_CALLBACKTYPE type, - void *commanddata1, - void *commanddata2) { + FMOD_CHANNEL_CALLBACKTYPE type, + void *commanddata1, + void *commanddata2) { if (type == FMOD_CHANNEL_CALLBACKTYPE_END) { FMOD::Channel *fc = (FMOD::Channel *)channel; void *userdata = NULL; @@ -228,7 +226,7 @@ get_loop() const { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_loop_count // Access: public -// Description: +// Description: // Panda uses 0 to mean loop forever. // Fmod uses negative numbers to mean loop forever. // (0 means don't loop, 1 means play twice, etc. @@ -245,12 +243,12 @@ set_loop_count(unsigned long loop_count) { if (loop_count == 0) { result = _sound->setLoopCount( -1 ); fmod_audio_errcheck("_sound->setLoopCount()", result); - result =_sound->setMode(FMOD_LOOP_NORMAL); + result =_sound->setMode(FMOD_LOOP_NORMAL); fmod_audio_errcheck("_sound->setMode()", result); } else if (loop_count == 1) { result = _sound->setLoopCount( 1 ); fmod_audio_errcheck("_sound->setLoopCount()", result); - result =_sound->setMode(FMOD_LOOP_OFF); + result =_sound->setMode(FMOD_LOOP_OFF); fmod_audio_errcheck("_sound->setMode()", result); } else { result = _sound->setLoopCount( loop_count ); @@ -295,9 +293,9 @@ set_time(float start_time) { _paused = true; return; } - + int startTime = (int)(start_time * 1000); - + if (_channel != 0) { // try backing up current sound. result = _channel->setPosition( startTime , FMOD_TIMEUNIT_MS ); @@ -316,7 +314,7 @@ set_time(float start_time) { } } } - + if (_channel == 0) { result = _manager->_system->playSound(FMOD_CHANNEL_FREE, _sound, true, &_channel); fmod_audio_errcheck("_system->playSound()", result); @@ -335,7 +333,7 @@ set_time(float start_time) { result = _channel->setPaused(false); fmod_audio_errcheck("_channel->setPaused()", result); - + _self_ref = this; } } @@ -359,7 +357,7 @@ get_time() const { return 0.0f; } fmod_audio_errcheck("_channel->getPosition()", result); - + return ((double)current_time) / 1000.0; } @@ -418,7 +416,7 @@ set_balance(float bal) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_balance // Access: public -// Description: -1.0 to 1.0 scale +// Description: -1.0 to 1.0 scale // -1 should be all the way left. // 1 is all the way to the right. //////////////////////////////////////////////////////////////////// @@ -434,7 +432,7 @@ get_balance() const { // The rate is a multiple of the sound, normal playback speed. // IE 2 would play back 2 times fast, 3 would play 3 times, and so on. // This can also be set to a negative number so a sound plays backwards. -// But rememeber if the sound is not playing, you must set the +// But rememeber if the sound is not playing, you must set the // sound's time to its end to hear a song play backwards. //////////////////////////////////////////////////////////////////// void FmodAudioSound:: @@ -446,7 +444,7 @@ set_play_rate(float rate) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::get_play_rate // Access: public -// Description: +// Description: //////////////////////////////////////////////////////////////////// float FmodAudioSound:: get_play_rate() const { @@ -462,7 +460,7 @@ void FmodAudioSound:: set_play_rate_on_channel() { FMOD_RESULT result; float frequency = _sampleFrequency * _playrate; - + if (_channel != 0) { result = _channel->setFrequency( frequency ); if (result == FMOD_ERR_INVALID_HANDLE) { @@ -520,7 +518,7 @@ set_3d_attributes(float px, float py, float pz, float vx, float vy, float vz) { _location.x = px; _location.y = pz; _location.z = py; - + _velocity.x = vx; _velocity.y = vz; _velocity.z = vy; @@ -531,7 +529,7 @@ set_3d_attributes(float px, float py, float pz, float vx, float vy, float vz) { //////////////////////////////////////////////////////////////////// // Function: FmodAudioSound::set_3d_attributes_on_channel // Access: public -// Description: +// Description: //////////////////////////////////////////////////////////////////// void FmodAudioSound:: set_3d_attributes_on_channel() { @@ -540,7 +538,7 @@ set_3d_attributes_on_channel() { result = _sound->getMode(&soundMode); fmod_audio_errcheck("_sound->getMode()", result); - + if ((_channel != 0) && (soundMode & FMOD_3D)) { result = _channel->set3DAttributes( &_location, &_velocity ); if (result == FMOD_ERR_INVALID_HANDLE) { @@ -636,7 +634,7 @@ get_speaker_mix(AudioManager::SpeakerId speaker) { float center; float sub; float backleft; - float backright; + float backright; float sideleft; float sideright; @@ -716,7 +714,7 @@ set_speaker_mix_or_balance_on_channel() { _mix[AudioManager::SPK_backleft], _mix[AudioManager::SPK_backright], _mix[AudioManager::SPK_sideleft], - _mix[AudioManager::SPK_sideright] + _mix[AudioManager::SPK_sideright] ); } if (result == FMOD_ERR_INVALID_HANDLE) { @@ -817,7 +815,7 @@ set_active(bool active) { //////////////////////////////////////////////////////////////////// -// Function: FmodAudioSound::get_active +// Function: FmodAudioSound::get_active // Access: public // Description: Returns whether the sound has been marked "active". //////////////////////////////////////////////////////////////////// @@ -840,7 +838,7 @@ finished() { // Function: FmodAudioSound::set_finished_event // Access: public // Description: NOT USED ANYMORE!!! -// Assign a string for the finished event to be referenced +// Assign a string for the finished event to be referenced // by in python by an accept method // //////////////////////////////////////////////////////////////////// @@ -855,7 +853,7 @@ set_finished_event(const string& event) { // Description:NOT USED ANYMORE!!! // Return the string the finished event is referenced by // -// +// //////////////////////////////////////////////////////////////////// const string& FmodAudioSound:: get_finished_event() const { diff --git a/panda/src/audiotraits/fmodAudioSound.h b/panda/src/audiotraits/fmodAudioSound.h index 9c7455e15f..c5ccd88f47 100644 --- a/panda/src/audiotraits/fmodAudioSound.h +++ b/panda/src/audiotraits/fmodAudioSound.h @@ -85,34 +85,34 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { FmodAudioSound(AudioManager *manager, Filename fn, bool positional ); ~FmodAudioSound(); - + // For best compatability, set the loop_count, start_time, // volume, and balance, prior to calling play(). You may // set them while they're playing, but it's implementation // specific whether you get the results. void play(); void stop(); - + // loop: false = play once; true = play forever. // inits to false. void set_loop(bool loop=true); bool get_loop() const; - + // loop_count: 0 = forever; 1 = play once; n = play n times. // inits to 1. void set_loop_count(unsigned long loop_count=1); unsigned long get_loop_count() const; - + // 0 = begining; length() = end. // inits to 0.0. void set_time(float start_time=0.0); float get_time() const; - + // 0 = minimum; 1.0 = maximum. // inits to 1.0. void set_volume(float volume=1.0); float get_volume() const; - + // -1.0 is hard left // 0.0 is centered // 1.0 is hard right @@ -126,7 +126,7 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { float get_play_rate() const; const string &get_name() const; - + // return: playing time in seconds. float length() const; @@ -141,11 +141,12 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { void set_3d_max_distance(float dist); float get_3d_max_distance() const; - + AudioSound::SoundStatus status() const; virtual float get_speaker_mix(AudioManager::SpeakerId speaker); virtual void set_speaker_mix(float frontleft, float frontright, float center, float sub, float backleft, float backright, float sideleft, float sideright); + void set_active(bool active=true); bool get_active() const; @@ -160,7 +161,7 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { Filename _file_name; - float _volume; + float _volume; float _balance; float _playrate; int _priority; @@ -187,10 +188,10 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { virtual int get_priority(); virtual void set_priority(int priority); - + bool _active; bool _paused; - + string _finished_event; // This reference-counting pointer is set to this while the sound is @@ -222,7 +223,7 @@ class EXPCL_FMOD_AUDIO FmodAudioSound : public AudioSound { return get_class_type(); } virtual TypeHandle force_init_type() { - init_type(); + init_type(); return get_class_type(); } diff --git a/panda/src/audiotraits/fmod_audio_composite1.cxx b/panda/src/audiotraits/fmod_audio_composite1.cxx index bdba12c7b6..da514bbdd5 100644 --- a/panda/src/audiotraits/fmod_audio_composite1.cxx +++ b/panda/src/audiotraits/fmod_audio_composite1.cxx @@ -2,4 +2,4 @@ #include "config_fmodAudio.cxx" #include "fmodAudioManager.cxx" #include "fmodAudioSound.cxx" - +