Assorted fmod fixes

This commit is contained in:
Josh Yelon 2006-09-18 23:11:31 +00:00
parent 0445017945
commit 02fa407aea
9 changed files with 1229 additions and 1203 deletions

View File

@ -23,7 +23,7 @@
#begin lib_target
#define TARGET fmod_audio
#define BUILD_TARGET $[HAVE_FMOD]
#define BUILD_TARGET $[HAVE_FMODEX]
#define USE_PACKAGES fmod
#define BUILDING_DLL BUILDING_FMOD_AUDIO
#define LOCAL_LIBS audio event

View File

@ -17,7 +17,7 @@
////////////////////////////////////////////////////////////////////
#include "pandabase.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
#include "config_fmodAudio.h"

View File

@ -21,7 +21,7 @@
#include "pandabase.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
#include "notifyCategoryProxy.h"
#include "dconfig.h"

View File

@ -20,7 +20,7 @@
#include "pandabase.h"
#include "dcast.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
//Panda Headers
#include "config_audio.h"
@ -36,7 +36,8 @@ TypeHandle FmodAudioDSP::_type_handle;
// This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
FmodAudioDSP::FmodAudioDSP(AudioManager *manager, AudioManager::DSP_category cat) {
FmodAudioDSP::
FmodAudioDSP(AudioManager *manager, AudioManager::DSP_category cat) {
// Intentionally blank.
audio_debug("FmodAudioDSP::FmodAudioDSP() Creating new DSP " );
@ -54,10 +55,7 @@ FmodAudioDSP::FmodAudioDSP(AudioManager *manager, AudioManager::DSP_category cat
set_in_chain(false);
cerr << get_dsp_name() << endl;
audio_debug("DSP Loaded");
}
@ -68,8 +66,8 @@ FmodAudioDSP::FmodAudioDSP(AudioManager *manager, AudioManager::DSP_category cat
// Access: Published, Virtual
// Description: DESTRUCTOR!!!
////////////////////////////////////////////////////////////////////
FmodAudioDSP::~FmodAudioDSP() {
FmodAudioDSP::
~FmodAudioDSP() {
audio_debug("FmodAudioSound::FmodAudioDSP() Destruction!!! " );
//Local Variables that are needed.
@ -82,7 +80,6 @@ FmodAudioDSP::~FmodAudioDSP() {
ERRCHECK(result);
audio_debug("DSP GONE");
}
@ -93,8 +90,8 @@ FmodAudioDSP::~FmodAudioDSP() {
// See the FMOD-EX documentation.
// [This resets an FMOD DSP to its default values]
////////////////////////////////////////////////////////////////////
void FmodAudioDSP::reset() {
void FmodAudioDSP::
reset() {
audio_debug("FmodAudioSound::reset() Reset DSP to default settings." );
//Local Variables that are needed.
@ -104,7 +101,6 @@ void FmodAudioDSP::reset() {
ERRCHECK(result);
audio_debug("DSP Reset.");
}
////////////////////////////////////////////////////////////////////
@ -114,7 +110,8 @@ void FmodAudioDSP::reset() {
// See the FMOD-EX documentation.
// [This removes the DSP from an Effects Chain]
////////////////////////////////////////////////////////////////////
void FmodAudioDSP::remove() {
void FmodAudioDSP::
remove() {
audio_debug("FmodAudioSound::remove() Removes a DSP from and effect chain." );
//Local Variables that are needed.
@ -124,7 +121,6 @@ void FmodAudioDSP::remove() {
ERRCHECK(result);
audio_debug("DSP Removed from relative effects chain.");
}
////////////////////////////////////////////////////////////////////
@ -134,7 +130,8 @@ void FmodAudioDSP::remove() {
// See the FMOD-EX documentation.
// [This turns the Bypass for an Effect on and off]/
////////////////////////////////////////////////////////////////////
void FmodAudioDSP::set_bypass(bool bypass) {
void FmodAudioDSP::
set_bypass(bool bypass) {
audio_debug("FmodAudioSound::set_bypass() ." );
//Local Variables that are needed.
@ -152,7 +149,8 @@ void FmodAudioDSP::set_bypass(bool bypass) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
bool FmodAudioDSP::get_bypass() {
bool FmodAudioDSP::
get_bypass() {
audio_debug("FmodAudioSound::get_bypass() ." );
//Local Variables that are needed.
@ -164,7 +162,6 @@ bool FmodAudioDSP::get_bypass() {
ERRCHECK(result);
return bypass;
}
@ -175,8 +172,8 @@ bool FmodAudioDSP::get_bypass() {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
void FmodAudioDSP::set_parameter(const string &name, float value) {
void FmodAudioDSP::
set_parameter(const string &name, float value) {
int parameterIndex = find_parameter(name);
if (parameterIndex < 0) {
return;
@ -187,7 +184,6 @@ void FmodAudioDSP::set_parameter(const string &name, float value) {
result = _dsp->setParameter(parameterIndex, value);
ERRCHECK(result);
}
@ -197,7 +193,8 @@ void FmodAudioDSP::set_parameter(const string &name, float value) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
int FmodAudioDSP::get_num_parameters() {
int FmodAudioDSP::
get_num_parameters() {
audio_debug("FmodAudioSound::get_num_parameters() ." );
//Local Variables that are needed.
@ -217,8 +214,8 @@ int FmodAudioDSP::get_num_parameters() {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
string FmodAudioDSP::get_parameter_name(int parameterIndex) {
// intentionally blank
string FmodAudioDSP::
get_parameter_name(int parameterIndex) {
audio_debug("FmodAudioSound::get_parameter_name()" );
@ -260,7 +257,8 @@ string FmodAudioDSP::get_parameter_name(int parameterIndex) {
// and the units for measuring the Delay is in Milliseconds.
// The Label returns Milliseconds letting you know that.
////////////////////////////////////////////////////////////////////
string FmodAudioDSP::get_parameter_description(int parameterIndex) {
string FmodAudioDSP::
get_parameter_description(int parameterIndex) {
// intentionally blank
audio_debug("FmodAudioSound::get_parameter_description()." );
@ -289,7 +287,8 @@ string FmodAudioDSP::get_parameter_description(int parameterIndex) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
float FmodAudioDSP::get_parameter_min(int parameterIndex) {
float FmodAudioDSP::
get_parameter_min(int parameterIndex) {
audio_debug("FmodAudioSound::get_parameter_min()." );
@ -316,7 +315,8 @@ float FmodAudioDSP::get_parameter_min(int parameterIndex) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
float FmodAudioDSP::get_parameter_max(int parameterIndex) {
float FmodAudioDSP::
get_parameter_max(int parameterIndex) {
audio_debug("FmodAudioSound::get_parameter_min()." );
@ -344,7 +344,8 @@ float FmodAudioDSP::get_parameter_max(int parameterIndex) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
float FmodAudioDSP::get_parameter_value(const string &name) {
float FmodAudioDSP::
get_parameter_value(const string &name) {
int parameterIndex = find_parameter(name);
if (parameterIndex < 0) {
@ -370,7 +371,8 @@ float FmodAudioDSP::get_parameter_value(const string &name) {
// Access: Private
// Description: Convert a parameter name to an fmod parameter index.
////////////////////////////////////////////////////////////////////
int FmodAudioDSP::find_parameter(const string &name) {
int FmodAudioDSP::
find_parameter(const string &name) {
int np = get_num_parameters();
for (int i=0; i<np; i++) {
if ( name == get_parameter_name(i) ) {
@ -389,8 +391,8 @@ int FmodAudioDSP::find_parameter(const string &name) {
// Description: This is a thin wrapper around FMOD-EX.
// See the FMOD-EX documentation.
////////////////////////////////////////////////////////////////////
string FmodAudioDSP::get_dsp_name() {
string FmodAudioDSP::
get_dsp_name() {
audio_debug("FmodAudioSound::get_dsp_name()." );
//Local Variables that are needed.
@ -410,7 +412,6 @@ string FmodAudioDSP::get_dsp_name() {
//returnInfo.append("\n");
return returnInfo;
}
@ -422,13 +423,11 @@ string FmodAudioDSP::get_dsp_name() {
// This is to make sure you 'remove' an effect from a chain
// before you move it somewhere else or destroy it.
////////////////////////////////////////////////////////////////////
bool FmodAudioDSP::get_in_chain() {
bool FmodAudioDSP::
get_in_chain() {
audio_debug("FmodAudioSound::get_in_chain()." );
return _in_chain;
}
@ -438,14 +437,12 @@ bool FmodAudioDSP::get_in_chain() {
// Description: This is a functiont to set if a DSP have been assigned
// to the GLOBAL or a SOUND's effect chain.
////////////////////////////////////////////////////////////////////
void FmodAudioDSP::set_in_chain(bool chain_state) {
void FmodAudioDSP::
set_in_chain(bool chain_state) {
audio_debug("FmodAudioSound::set_in_chain()." );
_in_chain = chain_state;
}
#endif //]

View File

@ -72,7 +72,7 @@
#include <pandabase.h>
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
#include "audioManager.h"
#include "audioDSP.h"

View File

@ -23,7 +23,7 @@
#include "config_audio.h"
#include "dcast.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
//Panda headers.
#include "config_audio.h"
@ -76,7 +76,8 @@ PT(AudioManager) Create_AudioManager() {
// Access: Public
// Description: Constructor
////////////////////////////////////////////////////////////////////
FmodAudioManager::FmodAudioManager() {
FmodAudioManager::
FmodAudioManager() {
//OK Lets create the FMOD Audio Manager.
audio_debug("FmodAudioManager::FmodAudioManager()");
@ -123,12 +124,10 @@ FmodAudioManager::FmodAudioManager() {
//Stick Surround Sound 5.1 thing Here.
audio_debug("Checking for Surround Sound Flag.")
cerr << fmod_use_surround_sound << endl ;
audio_debug("Checking for Surround Sound Flag.");
if (fmod_use_surround_sound) {
audio_debug("Setting FMOD to use 5.1 Surround Sound.")
audio_debug("Setting FMOD to use 5.1 Surround Sound.");
result = _system->setSpeakerMode( FMOD_SPEAKERMODE_5POINT1 );
ERRCHECK(result);
}
@ -170,7 +169,8 @@ FmodAudioManager::FmodAudioManager() {
// Access: Public
// Description: DESTRCUTOR !!!
////////////////////////////////////////////////////////////////////
FmodAudioManager::~FmodAudioManager() {
FmodAudioManager::
~FmodAudioManager() {
// Be sure to delete associated sounds before deleting the manager!
audio_debug("~FmodAudioManager(): Closing Down");
@ -198,7 +198,8 @@ FmodAudioManager::~FmodAudioManager() {
// Description: This just check to make sure the FMOD System is
// up and running correctly.
////////////////////////////////////////////////////////////////////
bool FmodAudioManager::is_valid() {
bool FmodAudioManager::
is_valid() {
audio_debug("FmodAudioManager::is_valid() = " << _is_valid );
return _is_valid;
}
@ -208,7 +209,8 @@ bool FmodAudioManager::is_valid() {
// Access: Public
// Description: This is what creates a sound instance.
////////////////////////////////////////////////////////////////////
PT(AudioSound) FmodAudioManager::get_sound(const string &file_name, bool positional) {
PT(AudioSound) FmodAudioManager::
get_sound(const string &file_name, bool positional) {
audio_debug("FmodAudioManager::get_sound(file_name=\""<<file_name<<"\")");
@ -234,14 +236,14 @@ PT(AudioSound) FmodAudioManager::get_sound(const string &file_name, bool positio
// Access: Published
// Description: This is what creates a DSP instance.
////////////////////////////////////////////////////////////////////
PT(AudioDSP) FmodAudioManager::create_dsp(DSP_category index) {
PT(AudioDSP) FmodAudioManager::
create_dsp(DSP_category index) {
audio_debug("FmodAudioManager()::create_dsp");
// Build a new AudioSound from the audio data.
PT(FmodAudioDSP) fmodAudioDSP = new FmodAudioDSP(this, index);
return (AudioDSP*)fmodAudioDSP;
}
@ -252,7 +254,8 @@ PT(AudioDSP) FmodAudioManager::create_dsp(DSP_category index) {
// DSP effects here, affect all the SOUNDS being played
// in panda.
////////////////////////////////////////////////////////////////////
bool FmodAudioManager::add_dsp( PT(AudioDSP) x) {
bool FmodAudioManager::
add_dsp( PT(AudioDSP) x) {
// intentionally blank
FMOD_RESULT result;
@ -421,8 +424,7 @@ setSpeakerSetup(AudioManager::SPEAKERMODE_category cat) {
////////////////////////////////////////////////////////////////////
void FmodAudioManager::set_volume(float volume) {
audio_debug("FmodAudioManager::set_volume()" );
audio_debug("This function has no effect in this version." )
audio_debug("This function has no effect in this version." );
}
////////////////////////////////////////////////////////////////////
@ -432,9 +434,10 @@ void FmodAudioManager::set_volume(float volume) {
// There isn't a specific system volume function in FMOD-EX,
// so this function is moot now.
////////////////////////////////////////////////////////////////////
float FmodAudioManager::get_volume() const {
float FmodAudioManager::
get_volume() const {
audio_debug("FmodAudioManager::get_volume() returning ");
audio_debug("This function has no effect in this version." )
audio_debug("This function has no effect in this version." );
return 0;
}
@ -444,9 +447,9 @@ float FmodAudioManager::get_volume() const {
// Description: Turn on/off
// Again, this function is pretty much moot in this version now.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::set_active(bool active) {
void FmodAudioManager::
set_active(bool active) {
audio_debug("FmodAudioManager::set_active(flag="<<active<<")");
}
////////////////////////////////////////////////////////////////////
@ -454,7 +457,8 @@ void FmodAudioManager::set_active(bool active) {
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
bool FmodAudioManager::get_active() const {
bool FmodAudioManager::
get_active() const {
audio_debug("FmodAudioManager::get_active() returning "<<_active);
return _active;
}
@ -464,16 +468,13 @@ bool FmodAudioManager::get_active() const {
// Access: Public
// Description: Stop playback on all sounds managed by this manager.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::stop_all_sounds() {
void FmodAudioManager::
stop_all_sounds() {
audio_debug("FmodAudioManager::stop_all_sounds()" );
for (SoundSet::iterator i = _all_sounds.begin(); i != _all_sounds.end(); ++i) {
(*i)->stop();
}
}
////////////////////////////////////////////////////////////////////
@ -483,7 +484,8 @@ void FmodAudioManager::stop_all_sounds() {
// positioned sounds. Normally, you'd want to call this
// once per iteration of your main loop.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_update() {
void FmodAudioManager::
audio_3d_update() {
audio_debug("FmodAudioManager::audio_3d_update()");
audio_debug("Calling FMOD's update function");
@ -506,7 +508,8 @@ void FmodAudioManager::audio_3d_update() {
// But if you decide to do any 3D audio work in here you have to keep it in mind.
// I told you, so you can't say I didn't.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_set_listener_attributes(float px, float py, float pz, float vx, float vy, float vz, float fx, float fy, float fz, float ux, float uy, float uz) {
void FmodAudioManager::
audio_3d_set_listener_attributes(float px, float py, float pz, float vx, float vy, float vz, float fx, float fy, float fz, float ux, float uy, float uz) {
audio_debug("FmodAudioManager::audio_3d_set_listener_attributes()");
FMOD_RESULT result;
@ -537,7 +540,8 @@ void FmodAudioManager::audio_3d_set_listener_attributes(float px, float py, floa
// Access: Public
// Description: Get position of the "ear" that picks up 3d sounds
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_get_listener_attributes(float *px, float *py, float *pz, float *vx, float *vy, float *vz, float *fx, float *fy, float *fz, float *ux, float *uy, float *uz) {
void FmodAudioManager::
audio_3d_get_listener_attributes(float *px, float *py, float *pz, float *vx, float *vy, float *vz, float *fx, float *fy, float *fz, float *ux, float *uy, float *uz) {
audio_error("audio3dGetListenerAttributes: currently unimplemented. Get the attributes of the attached object");
}
@ -549,7 +553,8 @@ void FmodAudioManager::audio_3d_get_listener_attributes(float *px, float *py, fl
// Description: Set units per meter (Fmod uses meters internally for
// its sound-spacialization calculations)
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_set_distance_factor(float factor) {
void FmodAudioManager::
audio_3d_set_distance_factor(float factor) {
audio_debug( "FmodAudioManager::audio_3d_set_distance_factor( factor= " << factor << ")" );
FMOD_RESULT result;
@ -568,7 +573,8 @@ void FmodAudioManager::audio_3d_set_distance_factor(float factor) {
// Description: Gets units per meter (Fmod uses meters internally for
// its sound-spacialization calculations)
////////////////////////////////////////////////////////////////////
float FmodAudioManager::audio_3d_get_distance_factor() const {
float FmodAudioManager::
audio_3d_get_distance_factor() const {
audio_debug("FmodAudioManager::audio_3d_get_distance_factor()");
return _distance_factor;
@ -580,7 +586,8 @@ float FmodAudioManager::audio_3d_get_distance_factor() const {
// Description: Exaggerates or diminishes the Doppler effect.
// Defaults to 1.0
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_set_doppler_factor(float factor) {
void FmodAudioManager::
audio_3d_set_doppler_factor(float factor) {
audio_debug("FmodAudioManager::audio_3d_set_doppler_factor(factor="<<factor<<")");
FMOD_RESULT result;
@ -597,7 +604,8 @@ void FmodAudioManager::audio_3d_set_doppler_factor(float factor) {
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
float FmodAudioManager::audio_3d_get_doppler_factor() const {
float FmodAudioManager::
audio_3d_get_doppler_factor() const {
audio_debug("FmodAudioManager::audio_3d_get_doppler_factor()");
return _doppler_factor;
@ -609,7 +617,8 @@ float FmodAudioManager::audio_3d_get_doppler_factor() const {
// Description: Control the effect distance has on audability.
// Defaults to 1.0
////////////////////////////////////////////////////////////////////
void FmodAudioManager::audio_3d_set_drop_off_factor(float factor) {
void FmodAudioManager::
audio_3d_set_drop_off_factor(float factor) {
audio_debug("FmodAudioManager::audio_3d_set_drop_off_factor("<<factor<<")");
FMOD_RESULT result;
@ -626,7 +635,8 @@ void FmodAudioManager::audio_3d_set_drop_off_factor(float factor) {
// Access: Public
// Description:
////////////////////////////////////////////////////////////////////
float FmodAudioManager::audio_3d_get_drop_off_factor() const {
float FmodAudioManager::
audio_3d_get_drop_off_factor() const {
audio_debug("FmodAudioManager::audio_3d_get_drop_off_factor()");
return _drop_off_factor;
@ -640,7 +650,8 @@ float FmodAudioManager::audio_3d_get_drop_off_factor() const {
// Access: Public
// Description: NOT USED FOR FMOD-EX!!!
////////////////////////////////////////////////////////////////////
void FmodAudioManager::set_concurrent_sound_limit(unsigned int limit) {
void FmodAudioManager::
set_concurrent_sound_limit(unsigned int limit) {
}
@ -649,8 +660,9 @@ void FmodAudioManager::set_concurrent_sound_limit(unsigned int limit) {
// Access: Public
// Description: NOT USED FOR FMOD-EX!!!
////////////////////////////////////////////////////////////////////
unsigned int FmodAudioManager::get_concurrent_sound_limit() const {
return 0;
unsigned int FmodAudioManager::
get_concurrent_sound_limit() const {
return 1000000;
}
////////////////////////////////////////////////////////////////////
@ -658,7 +670,8 @@ unsigned int FmodAudioManager::get_concurrent_sound_limit() const {
// Access: Private
// Description: NOT USED FOR FMOD-EX!!!
////////////////////////////////////////////////////////////////////
void FmodAudioManager::reduce_sounds_playing_to(unsigned int count) {
void FmodAudioManager::
reduce_sounds_playing_to(unsigned int count) {
}
@ -669,7 +682,8 @@ void FmodAudioManager::reduce_sounds_playing_to(unsigned int count) {
// Description: NOT USED FOR FMOD-EX!!!
// Clears a sound out of the sound cache.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::uncache_sound(const string& file_name) {
void FmodAudioManager::
uncache_sound(const string& file_name) {
audio_debug("FmodAudioManager::uncache_sound(\""<<file_name<<"\")");
}
@ -681,7 +695,8 @@ void FmodAudioManager::uncache_sound(const string& file_name) {
// Description: NOT USED FOR FMOD-EX!!!
// Clear out the sound cache.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::clear_cache() {
void FmodAudioManager::
clear_cache() {
audio_debug("FmodAudioManager::clear_cache()");
}
@ -692,7 +707,8 @@ void FmodAudioManager::clear_cache() {
// Description: NOT USED FOR FMOD-EX!!!
// Set the number of sounds that the cache can hold.
////////////////////////////////////////////////////////////////////
void FmodAudioManager::set_cache_limit(unsigned int count) {
void FmodAudioManager::
set_cache_limit(unsigned int count) {
audio_debug("FmodAudioManager::set_cache_limit(count="<<count<<")");
}
@ -703,7 +719,8 @@ void FmodAudioManager::set_cache_limit(unsigned int count) {
// Description: NOT USED FOR FMOD-EX!!!
// Gets the number of sounds that the cache can hold.
////////////////////////////////////////////////////////////////////
unsigned int FmodAudioManager::get_cache_limit() const {
unsigned int FmodAudioManager::
get_cache_limit() const {
audio_debug("FmodAudioManager::get_cache_limit() returning ");
//return _cache_limit;
return 0;

View File

@ -71,7 +71,7 @@
#include "pandabase.h"
#include "pset.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
#include "audioManager.h"

View File

@ -23,7 +23,7 @@
#include "pandabase.h"
#include "dcast.h"
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
//Panda Headers
#include "config_audio.h"
@ -41,7 +41,8 @@ TypeHandle FmodAudioSound::_type_handle;
// otherwise specified.
////////////////////////////////////////////////////////////////////
FmodAudioSound::FmodAudioSound(AudioManager *manager, string file_name, bool positional) {
FmodAudioSound::
FmodAudioSound(AudioManager *manager, string file_name, bool positional) {
audio_debug("FmodAudioSound::FmodAudioSound() Creating new sound, filename: " << file_name );
//Local Variables that are needed.
@ -110,7 +111,6 @@ FmodAudioSound::FmodAudioSound(AudioManager *manager, string file_name, bool pos
audio_debug("Sound loaded as 2D");
}
}
@ -119,7 +119,8 @@ FmodAudioSound::FmodAudioSound(AudioManager *manager, string file_name, bool pos
// Access: public
// Description: DESTRUCTOR!!!
////////////////////////////////////////////////////////////////////
FmodAudioSound::~FmodAudioSound() {
FmodAudioSound::
~FmodAudioSound() {
audio_debug("FmodAudioSound::~FmodAudioSound() Closing this Sound Instance Down.");
@ -185,7 +186,8 @@ FmodAudioSound::~FmodAudioSound() {
// I just wanted to explain my reasoning here.
//
////////////////////////////////////////////////////////////////////
void FmodAudioSound::play() {
void FmodAudioSound::
play() {
audio_debug("FmodAudioSound::play() Going to play a sound." );
@ -230,7 +232,8 @@ void FmodAudioSound::play() {
// Access: Private
// Description: Prepares a sound [GENERAL]
////////////////////////////////////////////////////////////////////
void FmodAudioSound::prepareSound() {
void FmodAudioSound::
prepareSound() {
audio_debug("FmodAudioSound::prepareSound()" );
@ -267,7 +270,8 @@ void FmodAudioSound::prepareSound() {
// sound is finished playing.
//
////////////////////////////////////////////////////////////////////
void FmodAudioSound::prepare2DSound() {
void FmodAudioSound::
prepare2DSound() {
audio_debug("FmodAudioSound::prepare2DSound()" );
@ -290,7 +294,8 @@ void FmodAudioSound::prepare2DSound() {
// sound is finished playing.
//
////////////////////////////////////////////////////////////////////
void FmodAudioSound::prepare3DSound() {
void FmodAudioSound::
prepare3DSound() {
audio_debug("FmodAudioSound::prepare2DSound()" );
@ -311,8 +316,8 @@ void FmodAudioSound::prepare3DSound() {
// Access: public
// Description: Stop a sound
////////////////////////////////////////////////////////////////////
void FmodAudioSound::stop() {
void FmodAudioSound::
stop() {
audio_debug("FmodAudioSound::stop() Going to stop a sound." );
//LOCALS
@ -322,7 +327,6 @@ void FmodAudioSound::stop() {
ERRCHECK(result);
audio_debug("FmodAudioSound::stop() Sound should be stopped.");
}
@ -332,12 +336,10 @@ void FmodAudioSound::stop() {
// Access: public
// Description: Turns looping on and off
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_loop(bool loop) {
void FmodAudioSound::
set_loop(bool loop) {
audio_debug("FmodAudioSound::set_loop() Setting loop state to " << loop);
FMOD_RESULT result;
if ( loop ) {
result = _sound->setMode(FMOD_LOOP_NORMAL);
ERRCHECK(result);
@ -348,7 +350,6 @@ void FmodAudioSound::set_loop(bool loop) {
ERRCHECK(result);
audio_debug("FmodAudioSound::set_loop() This sound is set to one-shot." );
}
}
////////////////////////////////////////////////////////////////////
@ -356,7 +357,8 @@ void FmodAudioSound::set_loop(bool loop) {
// Access: public
// Description: Returns whether looping is on or off
////////////////////////////////////////////////////////////////////
bool FmodAudioSound::get_loop() const {
bool FmodAudioSound::
get_loop() const {
audio_debug( "FmodAudioSound::get_loop() Retreiving a sound's loop state." );
@ -389,7 +391,8 @@ bool FmodAudioSound::get_loop() const {
// (0 means don't loop, 1 means play twice, etc.
// We must convert!
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_loop_count(unsigned long loop_count) {
void FmodAudioSound::
set_loop_count(unsigned long loop_count) {
audio_debug("FmodAudioSound::set_loop_count() Setting the sound's loop count to: " << loop_count);
@ -409,7 +412,6 @@ void FmodAudioSound::set_loop_count(unsigned long loop_count) {
}
audio_debug("FmodAudioSound::set_loop_count() Sound's loop count should be set to: " << loop_count);
}
////////////////////////////////////////////////////////////////////
@ -417,7 +419,8 @@ void FmodAudioSound::set_loop_count(unsigned long loop_count) {
// Access: public
// Description: Return how many times a sound will loop.
////////////////////////////////////////////////////////////////////
unsigned long FmodAudioSound::get_loop_count() const {
unsigned long FmodAudioSound::
get_loop_count() const {
audio_debug("FmodAudioSound::get_loop_count() Getting the sound's loop count. ");
@ -440,7 +443,8 @@ unsigned long FmodAudioSound::get_loop_count() const {
// Access: public
// Description: Sets the play position within the sound
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_time(float start_time) {
void FmodAudioSound::
set_time(float start_time) {
FMOD_RESULT result;
audio_debug("FmodAudioSound::set_time() Going to set a sounds start position" );
@ -463,8 +467,8 @@ void FmodAudioSound::set_time(float start_time) {
// Access: public
// Description: Gets the play position within the sound
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_time() const {
float FmodAudioSound::
get_time() const {
audio_debug("FmodAudioSound::get_time() Going to get a sound's position" );
FMOD_RESULT result;
@ -476,7 +480,6 @@ float FmodAudioSound::get_time() const {
current_time = current_time / 1000;
return current_time;
}
////////////////////////////////////////////////////////////////////
@ -485,7 +488,8 @@ float FmodAudioSound::get_time() const {
// Description: 0.0 to 1.0 scale of volume converted to Fmod's
// internal 0.0 to 255.0 scale.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_volume(float vol) {
void FmodAudioSound::
set_volume(float vol) {
audio_debug("FmodAudioSound::set_volume() Going to set a sounds volume." );
@ -497,7 +501,6 @@ void FmodAudioSound::set_volume(float vol) {
ERRCHECK(result);
audio_debug("FmodAudioSound::set_volume() Setting volume to " << vol);
}
////////////////////////////////////////////////////////////////////
@ -505,8 +508,8 @@ void FmodAudioSound::set_volume(float vol) {
// Access: Private
// Description: Set the volume on a prepared Sound channel.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_volume_on_channel() {
void FmodAudioSound::
set_volume_on_channel() {
audio_debug("FmodAudioSound::set_volume() Going to set a sounds volume." );
FMOD_RESULT result;
@ -515,7 +518,6 @@ void FmodAudioSound::set_volume_on_channel() {
ERRCHECK(result);
audio_debug("FmodAudioSound::set_volume() Setting volume to " << _volume );
}
////////////////////////////////////////////////////////////////////
@ -523,7 +525,8 @@ void FmodAudioSound::set_volume_on_channel() {
// Access: public
// Description: Gets the current volume of a sound. 1 is Max. O is Min.
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_volume() const {
float FmodAudioSound::
get_volume() const {
audio_debug("FmodAudioSound::get_volume() Going to get a sound's volume." );
@ -535,8 +538,8 @@ float FmodAudioSound::get_volume() const {
// Access: public
// Description: -1.0 to 1.0 scale
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_balance(float bal) {
void FmodAudioSound::
set_balance(float bal) {
audio_debug("FmodAudioSound::set_balance() Going to set a sound's balance." );
FMOD_RESULT result;
@ -550,7 +553,6 @@ void FmodAudioSound::set_balance(float bal) {
ERRCHECK(result);
audio_debug("FmodAudioSound::set_balance() Setting Pan to " << bal);
}
////////////////////////////////////////////////////////////////////
@ -560,7 +562,8 @@ void FmodAudioSound::set_balance(float bal) {
// -1 should be all the way left.
// 1 is all the way to the right.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_balance_on_channel() {
void FmodAudioSound::
set_balance_on_channel() {
audio_debug("FmodAudioSound::set_balance() Going to set a sound's balance to " << _balance );
@ -570,7 +573,6 @@ void FmodAudioSound::set_balance_on_channel() {
ERRCHECK(result);
audio_debug("FmodAudioSound::set_balance() Setting Pan to " << _balance);
}
////////////////////////////////////////////////////////////////////
@ -580,7 +582,8 @@ void FmodAudioSound::set_balance_on_channel() {
// -1 should be all the way left.
// 1 is all the way to the right.
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_balance() const {
float FmodAudioSound::
get_balance() const {
audio_debug("FmodAudioSound::get_balance() Going to get a sound's balance." );
@ -597,7 +600,8 @@ float FmodAudioSound::get_balance() const {
// 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::set_play_rate(float rate) {
void FmodAudioSound::
set_play_rate(float rate) {
audio_debug("FmodAudioSound::set_play_rate() Going to set a sound's play rate to " << rate);
FMOD_RESULT result;
@ -617,7 +621,6 @@ void FmodAudioSound::set_play_rate(float rate) {
}
audio_debug("FmodAudioSound::set_play_rate() Sound's balance set to " << rate);
}
////////////////////////////////////////////////////////////////////
@ -625,7 +628,8 @@ void FmodAudioSound::set_play_rate(float rate) {
// Access: public
// Description: Set the play rate on a prepared Sound channel.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_play_rate_on_channel() {
void FmodAudioSound::
set_play_rate_on_channel() {
audio_debug("FmodAudioSound::set_play_rate() Going to set a sound's balance to " << _playrate);
FMOD_RESULT result;
@ -653,7 +657,8 @@ void FmodAudioSound::set_play_rate_on_channel() {
// Access: public
// Description:
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_play_rate() const {
float FmodAudioSound::
get_play_rate() const {
audio_debug("FmodAudioSound::set_play_rate() Going to get a sound's balance.");
@ -666,7 +671,8 @@ float FmodAudioSound::get_play_rate() const {
// Access: public
// Description: Get name of sound file
////////////////////////////////////////////////////////////////////
const string& FmodAudioSound::get_name() const {
const string& FmodAudioSound::
get_name() const {
audio_debug("FmodAudioSound::get_name() Going to get a sound's file name.");
return _file_name;
@ -678,7 +684,8 @@ const string& FmodAudioSound::get_name() const {
// Description: Get length
// FMOD returns the time in MS so we have to convert to seconds.
////////////////////////////////////////////////////////////////////
float FmodAudioSound::length() const {
float FmodAudioSound::
length() const {
audio_debug("FmodAudioSound::length() Going to get a sound's length in second.");
@ -708,9 +715,9 @@ float FmodAudioSound::length() const {
// But if you decide to do any 3D audio work in here you have to keep it in mind.
// I told you, so you can't say I didn't.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_3d_attributes(float px, float py, float pz, float vx, float vy, float vz) {
audio_debug("FmodAudioSound::set_3d_attributes() Setting a sound's 3D Coordinates.")
void FmodAudioSound::
set_3d_attributes(float px, float py, float pz, float vx, float vy, float vz) {
audio_debug("FmodAudioSound::set_3d_attributes() Setting a sound's 3D Coordinates.");
FMOD_RESULT result;
@ -724,8 +731,6 @@ void FmodAudioSound::set_3d_attributes(float px, float py, float pz, float vx, f
result = _channel->set3DAttributes( &_location, &_velocity );
ERRCHECK(result);
}
////////////////////////////////////////////////////////////////////
@ -734,7 +739,8 @@ void FmodAudioSound::set_3d_attributes(float px, float py, float pz, float vx, f
// Description: Get position and velocity of this sound
// Currently unimplemented. Get the attributes of the attached object.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::get_3d_attributes(float *px, float *py, float *pz, float *vx, float *vy, float *vz) {
void FmodAudioSound::
get_3d_attributes(float *px, float *py, float *pz, float *vx, float *vy, float *vz) {
audio_error("get3dAttributes: Currently unimplemented. Get the attributes of the attached object.");
}
@ -745,7 +751,8 @@ void FmodAudioSound::get_3d_attributes(float *px, float *py, float *pz, float *v
// Description: Set the distance that this sound begins to fall off. Also
// affects the rate it falls off.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_3d_min_distance(float dist) {
void FmodAudioSound::
set_3d_min_distance(float dist) {
audio_debug("FmodAudioSound::set_3d_min_distance() Setting the sound's 3D min distance ( min= " << dist << " ) ");
@ -764,7 +771,8 @@ void FmodAudioSound::set_3d_min_distance(float dist) {
// Access: public
// Description: Get the distance that this sound begins to fall off
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_3d_min_distance() const {
float FmodAudioSound::
get_3d_min_distance() const {
audio_debug("FmodAudioSound::get_3d_min_distance() ");
@ -776,7 +784,8 @@ float FmodAudioSound::get_3d_min_distance() const {
// Access: public
// Description: Set the distance that this sound stops falling off
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_3d_max_distance(float dist) {
void FmodAudioSound::
set_3d_max_distance(float dist) {
audio_debug("FmodAudioSound::set_3d_max_distance() Setting the sound's 3D max distance ( max= " << dist << " ) ");
@ -794,7 +803,8 @@ void FmodAudioSound::set_3d_max_distance(float dist) {
// Access: public
// Description: Get the distance that this sound stops falling off
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_3d_max_distance() const {
float FmodAudioSound::
get_3d_max_distance() const {
audio_debug("FmodAudioSound::get_3d_max_distance() ");
@ -811,9 +821,8 @@ float FmodAudioSound::get_3d_max_distance() const {
// DSPs set here will only affect it respective sound.
//
////////////////////////////////////////////////////////////////////
bool FmodAudioSound::add_dsp( PT(AudioDSP) x) {
// intentionally blank
bool FmodAudioSound::
add_dsp( PT(AudioDSP) x) {
audio_debug("FmodAudioManager()::add_dsp");
FMOD_RESULT result;
@ -855,9 +864,8 @@ bool FmodAudioSound::add_dsp( PT(AudioDSP) x) {
// Access: Published
// Description: Sets the DSPs on a prepared Sound channel.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::add_dsp_on_channel() {
// intentionally blank
void FmodAudioSound::
add_dsp_on_channel() {
audio_debug("FmodAudioManager()::add_dsp_on_channel");
FMOD_RESULT result;
@ -868,7 +876,6 @@ void FmodAudioSound::add_dsp_on_channel() {
ERRCHECK( result );
}
}
////////////////////////////////////////////////////////////////////
@ -879,8 +886,9 @@ void FmodAudioSound::add_dsp_on_channel() {
// So in theory you could reuse the DSP for something else.
// In the Global Chain or another sound.
////////////////////////////////////////////////////////////////////
bool FmodAudioSound::remove_dsp(PT(AudioDSP) x) {
// intentionally blank
bool FmodAudioSound::
remove_dsp(PT(AudioDSP) x) {
// intentionally blank
audio_debug("FmodAudioManager()::remove_dsp()");
@ -900,8 +908,7 @@ bool FmodAudioSound::remove_dsp(PT(AudioDSP) x) {
return true;
} else
{
} else {
audio_debug("FmodAudioManager()::remove_dsp()");
audio_debug("This DSP doesn't exist in this chain.");
@ -909,7 +916,6 @@ bool FmodAudioSound::remove_dsp(PT(AudioDSP) x) {
return false;
}
}
@ -935,7 +941,8 @@ bool FmodAudioSound::remove_dsp(PT(AudioDSP) x) {
// BTW This will also work in Stereo speaker systems, but since
// PANDA/FMOD has a balance [pan] function what is the point?
////////////////////////////////////////////////////////////////////
float FmodAudioSound::get_speaker_mix(int speaker) {
float FmodAudioSound::
get_speaker_mix(int speaker) {
// intentionally blank
audio_debug("FmodAudioSound::getSpeakerMix()");
@ -996,10 +1003,8 @@ float FmodAudioSound::get_speaker_mix(int speaker) {
break;
default:
cerr << "You specified a speaker which doesn't exist.";
}
return returnValue;
}
@ -1018,7 +1023,8 @@ float FmodAudioSound::get_speaker_mix(int speaker) {
// 8 = Side Right
// Speakers which don't exist in some systems will simply be ignored.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_speaker_mix(float frontleft, float frontright, float center, float sub, float backleft, float backright, float sideleft, float sideright) {
void FmodAudioSound::
set_speaker_mix(float frontleft, float frontright, float center, float sub, float backleft, float backright, float sideleft, float sideright) {
// intentionally blank
audio_debug("FmodAudioSound::setSpeakerMix()");
@ -1043,7 +1049,8 @@ void FmodAudioSound::set_speaker_mix(float frontleft, float frontright, float ce
// Access: Published
// Description: Set the Speaker Mix for a sound on a prepared Sound channel.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_speaker_mix_on_channel() {
void FmodAudioSound::
set_speaker_mix_on_channel() {
// intentionally blank
audio_debug("FmodAudioSound::setSpeakerMix()");
@ -1067,7 +1074,8 @@ void FmodAudioSound::set_speaker_mix_on_channel() {
// where 'set_speaker_mix()' or 'set_balace()' will override any
// previous speaker balance setups. It all depends on which was called last.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_speaker_mix_or_balance_on_channel() {
void FmodAudioSound::
set_speaker_mix_or_balance_on_channel() {
// intentionally blank
audio_debug("FmodAudioSound::set_speaker_mix_or_balance_on_channel()");
@ -1105,7 +1113,8 @@ void FmodAudioSound::set_speaker_mix_or_balance_on_channel() {
// This is what FMOD uses to determine is a sound will
// play if all the other real channels have been used up.
////////////////////////////////////////////////////////////////////
int FmodAudioSound::get_priority() {
int FmodAudioSound::
get_priority() {
audio_debug("FmodAudioSound::get_priority()");
return _priority;
}
@ -1116,7 +1125,8 @@ int FmodAudioSound::get_priority() {
// Description: Sets the Sound Priority [Whether is will be played
// over other sound when real audio channels become short.
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_priority(int priority) {
void FmodAudioSound::
set_priority(int priority) {
// intentionally blank
audio_debug("FmodAudioSound::set_priority()");
@ -1134,9 +1144,10 @@ void FmodAudioSound::set_priority(int priority) {
// Access: public
// Description: Get status of the sound.
////////////////////////////////////////////////////////////////////
AudioSound::SoundStatus FmodAudioSound::status() const {
// If the stream's channel isn't playing anything, then the stream
// definitely isn't playing.
AudioSound::SoundStatus FmodAudioSound::
status() const {
// If the stream's channel isn't playing anything, then the stream
// definitely isn't playing.
audio_debug("FmodAudioSound::status() ");
@ -1169,9 +1180,10 @@ AudioSound::SoundStatus FmodAudioSound::status() const {
//
//
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_active(bool active) {
void FmodAudioSound::
set_active(bool active) {
audio_debug( "set_active(active=" << active << ")" );
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.")
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.");
}
@ -1185,11 +1197,10 @@ void FmodAudioSound::set_active(bool active) {
// This is not exactly how the orignal use of this function btu I figured I might
// as well get some use out of it.
////////////////////////////////////////////////////////////////////
bool FmodAudioSound::get_active() const {
bool FmodAudioSound::
get_active() const {
audio_debug("FmodAudioSound::get_active() Going to get a sound's activity.");
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.")
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.");
return false;
}
@ -1200,11 +1211,11 @@ bool FmodAudioSound::get_active() const {
// Called by finishedCallback function when a sound
// terminates (but doesn't loop).
////////////////////////////////////////////////////////////////////
void FmodAudioSound::finished() {
void FmodAudioSound::
finished() {
audio_debug("FmodAudioSound::finished()");
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.")
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.");
stop();
}
////////////////////////////////////////////////////////////////////
@ -1215,10 +1226,10 @@ void FmodAudioSound::finished() {
// by in python by an accept method
//
////////////////////////////////////////////////////////////////////
void FmodAudioSound::set_finished_event(const string& event) {
void FmodAudioSound::
set_finished_event(const string& event) {
audio_debug("FmodAudioSound::set_finished_event(event="<<event<<")");
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.")
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.");
}
////////////////////////////////////////////////////////////////////
@ -1229,9 +1240,10 @@ void FmodAudioSound::set_finished_event(const string& event) {
//
//
////////////////////////////////////////////////////////////////////
const string& FmodAudioSound::get_finished_event() const {
const string& FmodAudioSound::
get_finished_event() const {
audio_debug("FmodAudioSound::get_finished_event() returning " << _finished_event );
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.")
audio_debug("NOT USED ANYMORE in FMOD-EX version of PANDA.");
return _finished_event;
}

View File

@ -71,7 +71,7 @@
#include <pandabase.h>
#ifdef HAVE_FMOD //[
#ifdef HAVE_FMODEX //[
#include "audioSound.h"