Browse Source

Assorted fmod fixes

Josh Yelon 19 years ago
parent
commit
02fa407aea

+ 1 - 1
panda/src/audiotraits/Sources.pp

@@ -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

+ 1 - 1
panda/src/audiotraits/config_fmodAudio.cxx

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

+ 1 - 1
panda/src/audiotraits/config_fmodAudio.h

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

+ 215 - 218
panda/src/audiotraits/fmodAudioDSP.cxx

@@ -20,7 +20,7 @@
 #include "pandabase.h"
 #include "dcast.h"
 
-#ifdef HAVE_FMOD //[
+#ifdef HAVE_FMODEX //[
 
 //Panda Headers
 #include "config_audio.h"
@@ -33,31 +33,29 @@ TypeHandle FmodAudioDSP::_type_handle;
 //     Function: FmodAudioDSP::FmodAudioDSP
 //       Access: Protected
 //  Description: Constructor
-//				 This is a thin wrapper around FMOD-EX.
+//               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 " );
+  audio_debug("FmodAudioDSP::FmodAudioDSP() Creating new DSP " );
+  
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-		//Local Variables that are needed.
-		FMOD_RESULT result;
+  //Assign the values we need
+  DCAST_INTO_V(_manager, manager);
 
-		//Assign the values we need
-		DCAST_INTO_V(_manager, manager);
+  FMOD_DSP_TYPE dsptype = (FMOD_DSP_TYPE)cat;
 
-		FMOD_DSP_TYPE dsptype = (FMOD_DSP_TYPE)cat;
+  result = _manager->_system->createDSPByType( dsptype, &_dsp);
+  ERRCHECK(result);
 
-		result = _manager->_system->createDSPByType( dsptype, &_dsp);
-		ERRCHECK(result);
-
-		set_in_chain(false);
-
-		cerr << get_dsp_name() << endl;
-
-		audio_debug("DSP Loaded");
+  set_in_chain(false);
 
+  audio_debug("DSP Loaded");
 }
 
 
@@ -68,21 +66,20 @@ FmodAudioDSP::FmodAudioDSP(AudioManager *manager, AudioManager::DSP_category cat
 //       Access: Published, Virtual
 //  Description: DESTRUCTOR!!!
 ////////////////////////////////////////////////////////////////////
-FmodAudioDSP::~FmodAudioDSP() {
-
-		audio_debug("FmodAudioSound::FmodAudioDSP()	Destruction!!! " );
+FmodAudioDSP::
+~FmodAudioDSP() {
+  audio_debug("FmodAudioSound::FmodAudioDSP() Destruction!!! " );
 
-		//Local Variables that are needed.
-		FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-		result = _dsp->remove();
-		ERRCHECK(result);
+  result = _dsp->remove();
+  ERRCHECK(result);
 
-		result = _dsp->release();
-		ERRCHECK(result);
+  result = _dsp->release();
+  ERRCHECK(result);
 
-		audio_debug("DSP GONE");
-	
+  audio_debug("DSP GONE");
 }
 
 
@@ -91,20 +88,19 @@ FmodAudioDSP::~FmodAudioDSP() {
 //       Access: Published, Virtual
 //  Description: This is a thin wrapper around FMOD-EX.
 //               See the FMOD-EX documentation.
-//				 [This resets an FMOD DSP to its default values]
+//               [This resets an FMOD DSP to its default values]
 ////////////////////////////////////////////////////////////////////
-void FmodAudioDSP::reset() {
+void FmodAudioDSP::
+reset() {
+  audio_debug("FmodAudioSound::reset() Reset DSP to default settings." );
 
-	audio_debug("FmodAudioSound::reset() Reset DSP to default settings." );
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
-
-	result = _dsp->reset();
-	ERRCHECK(result);
-
-	audio_debug("DSP Reset.");
+  result = _dsp->reset();
+  ERRCHECK(result);
 
+  audio_debug("DSP Reset.");
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -112,19 +108,19 @@ void FmodAudioDSP::reset() {
 //       Access: Published, Virtual
 //  Description: This is a thin wrapper around FMOD-EX.
 //               See the FMOD-EX documentation.
-//				 [This removes the DSP from an Effects Chain]
+//               [This removes the DSP from an Effects Chain]
 ////////////////////////////////////////////////////////////////////
-void FmodAudioDSP::remove() {
-	audio_debug("FmodAudioSound::remove() Removes a DSP from and effect chain." );
-
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+void FmodAudioDSP::
+remove() {
+  audio_debug("FmodAudioSound::remove() Removes a DSP from and effect chain." );
 
-	result = _dsp->remove();
-	ERRCHECK(result);
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	audio_debug("DSP Removed from relative effects chain.");
+  result = _dsp->remove();
+  ERRCHECK(result);
 
+  audio_debug("DSP Removed from relative effects chain.");
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -132,18 +128,19 @@ void FmodAudioDSP::remove() {
 //       Access: Published, Virtual
 //  Description: This is a thin wrapper around FMOD-EX.
 //               See the FMOD-EX documentation.
-//				 [This turns the Bypass for an Effect on and off]/
+//         [This turns the Bypass for an Effect on and off]/
 ////////////////////////////////////////////////////////////////////
-void FmodAudioDSP::set_bypass(bool bypass) {
-	audio_debug("FmodAudioSound::set_bypass() ." );
+void FmodAudioDSP::
+set_bypass(bool bypass) {
+  audio_debug("FmodAudioSound::set_bypass() ." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	result = _dsp->setBypass(bypass);
-	ERRCHECK(result);
+  result = _dsp->setBypass(bypass);
+  ERRCHECK(result);
 
-	audio_debug("DSP Bypass set to:" << bypass );
+  audio_debug("DSP Bypass set to:" << bypass );
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -152,19 +149,19 @@ void FmodAudioDSP::set_bypass(bool bypass) {
 //  Description: This is a thin wrapper around FMOD-EX.
 //               See the FMOD-EX documentation.
 ////////////////////////////////////////////////////////////////////
-bool FmodAudioDSP::get_bypass() {
-	audio_debug("FmodAudioSound::get_bypass() ." );
+bool FmodAudioDSP::
+get_bypass() {
+  audio_debug("FmodAudioSound::get_bypass() ." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	bool bypass;
+  bool bypass;
 
-	result = _dsp->getBypass(&bypass);
-	ERRCHECK(result);
-
-	return bypass;
+  result = _dsp->getBypass(&bypass);
+  ERRCHECK(result);
 
+  return bypass;
 }
 
 
@@ -175,19 +172,18 @@ 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) {
-	
-	int parameterIndex = find_parameter(name);
-	if (parameterIndex < 0) {
-		return;
-	}
-
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+void FmodAudioDSP::
+set_parameter(const string &name, float value) {
+  int parameterIndex = find_parameter(name);
+  if (parameterIndex < 0) {
+    return;
+  }
 
-	result = _dsp->setParameter(parameterIndex, value);
-	ERRCHECK(result);
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
+  result = _dsp->setParameter(parameterIndex, value);
+  ERRCHECK(result);
 }
 
 
@@ -197,18 +193,19 @@ 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() {
-	audio_debug("FmodAudioSound::get_num_parameters() ." );
+int FmodAudioDSP::
+get_num_parameters() {
+  audio_debug("FmodAudioSound::get_num_parameters() ." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	int numOfParameters;
+  int numOfParameters;
 
-	result = _dsp->getNumParameters(&numOfParameters);
-	ERRCHECK(result);
+  result = _dsp->getNumParameters(&numOfParameters);
+  ERRCHECK(result);
 
-	return numOfParameters;
+  return numOfParameters;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -217,30 +214,30 @@ 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()" );
+  audio_debug("FmodAudioSound::get_parameter_name()" );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	//int		parameterIndex;
-	char	parameterName[32]; 
-	char	parameterLabel[32]; 
-	char	parameterDescription[32];
-	int		parameterDescriptionLength = 0;
-	float	parameterMin;
-	float	parameterMax;
+  //int   parameterIndex;
+  char  parameterName[32]; 
+  char  parameterLabel[32]; 
+  char  parameterDescription[32];
+  int   parameterDescriptionLength = 0;
+  float parameterMin;
+  float parameterMax;
 
-	result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
-	ERRCHECK(result);
+  result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
+  ERRCHECK(result);
 
-	string returnInfo = (parameterName);
+  string returnInfo = (parameterName);
 
-	return returnInfo;
+  return returnInfo;
 
-	//return "";
+  //return "";
 }
 
 
@@ -249,37 +246,38 @@ string FmodAudioDSP::get_parameter_name(int parameterIndex) {
 //       Access: Published, Virtual
 //  Description: This is a thin wrapper around FMOD-EX.
 //               See the FMOD-EX documentation.
-//				 This Method actually returns FMOD's Parameter Label
-//				 Information, and not Description.
-//				 The reason is, that most of the FMOD's Description
-//				 Properties seem to be empty.
-//				 Also the Label sort of serves as as a description by
-//				 return the type of unit the cooresponding parameter
-//				 modifies for a DSP.
-//				 IE.  For the Echo.   The first parameter is 'Delay'
-//				 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) {
-	// intentionally blank
-
-	audio_debug("FmodAudioSound::get_parameter_description()." );
-
-	//Local Variables that are needed.
-	FMOD_RESULT result;
-
-	//int		parameterIndex;
-	char	parameterName[32]; 
-	char	parameterLabel[32]; 
-	char	parameterDescription[32];
-	int		parameterDescriptionLength = 0;
-	float	parameterMin;
-	float	parameterMax;
-
-	result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
-	ERRCHECK(result);
-
-	return parameterLabel;
+//               This Method actually returns FMOD's Parameter Label
+//               Information, and not Description.
+//               The reason is, that most of the FMOD's Description
+//               Properties seem to be empty.
+//               Also the Label sort of serves as as a description by
+//               return the type of unit the cooresponding parameter
+//               modifies for a DSP.
+//               IE.  For the Echo.   The first parameter is 'Delay'
+//               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) {
+  // intentionally blank
+
+  audio_debug("FmodAudioSound::get_parameter_description()." );
+
+  //Local Variables that are needed.
+  FMOD_RESULT result;
+
+  //int   parameterIndex;
+  char  parameterName[32]; 
+  char  parameterLabel[32]; 
+  char  parameterDescription[32];
+  int   parameterDescriptionLength = 0;
+  float parameterMin;
+  float parameterMax;
+
+  result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
+  ERRCHECK(result);
+
+  return parameterLabel;
 
 }
 
@@ -289,25 +287,26 @@ 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) {
-	
-	audio_debug("FmodAudioSound::get_parameter_min()." );
+float FmodAudioDSP::
+get_parameter_min(int parameterIndex) {
+  
+  audio_debug("FmodAudioSound::get_parameter_min()." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	//int		parameterIndex;
-	char	parameterName[32]; 
-	char	parameterLabel[32]; 
-	char	parameterDescription[32];
-	int		parameterDescriptionLength = 0;
-	float	parameterMin;
-	float	parameterMax;
+  //int   parameterIndex;
+  char  parameterName[32]; 
+  char  parameterLabel[32]; 
+  char  parameterDescription[32];
+  int   parameterDescriptionLength = 0;
+  float parameterMin;
+  float parameterMax;
 
-	result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
-	ERRCHECK(result);
+  result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
+  ERRCHECK(result);
 
-	return parameterMin;
+  return parameterMin;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -316,25 +315,26 @@ 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) {
-	
-	audio_debug("FmodAudioSound::get_parameter_min()." );
+float FmodAudioDSP::
+get_parameter_max(int parameterIndex) {
+  
+  audio_debug("FmodAudioSound::get_parameter_min()." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	//int		parameterIndex;
-	char	parameterName[32]; 
-	char	parameterLabel[32]; 
-	char	parameterDescription[32];
-	int		parameterDescriptionLength = 0;
-	float	parameterMin;
-	float	parameterMax;
+  //int   parameterIndex;
+  char  parameterName[32]; 
+  char  parameterLabel[32]; 
+  char  parameterDescription[32];
+  int   parameterDescriptionLength = 0;
+  float parameterMin;
+  float parameterMax;
 
-	result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
-	ERRCHECK(result);
+  result = _dsp->getParameterInfo(parameterIndex, parameterName, parameterLabel, parameterDescription, parameterDescriptionLength, &parameterMin, &parameterMax);
+  ERRCHECK(result);
 
-	return parameterMax;
+  return parameterMax;
 }
 
 
@@ -344,25 +344,26 @@ 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) {
-	
-	int parameterIndex = find_parameter(name);
-	if (parameterIndex < 0) {
-		return 0.0;
-	}
+float FmodAudioDSP::
+get_parameter_value(const string &name) {
+  
+  int parameterIndex = find_parameter(name);
+  if (parameterIndex < 0) {
+    return 0.0;
+  }
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
  
-	float	parameterValue; 
-	char	valuestr[32];
-	int		valuestrlen = 32;
+  float parameterValue; 
+  char  valuestr[32];
+  int   valuestrlen = 32;
 
 
-	result = _dsp->getParameter(parameterIndex, &parameterValue, valuestr, valuestrlen);
-	ERRCHECK(result);
+  result = _dsp->getParameter(parameterIndex, &parameterValue, valuestr, valuestrlen);
+  ERRCHECK(result);
 
-	return parameterValue;
+  return parameterValue;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -370,17 +371,18 @@ 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 np = get_num_parameters();
-	for (int i=0; i<np; i++) {
-		if ( name == get_parameter_name(i) ) {
+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) ) {
 
-			audio_debug("FmodAudioSound::find_parameter() returning: " << get_parameter_name(i) << " " << i );
+      audio_debug("FmodAudioSound::find_parameter() returning: " << get_parameter_name(i) << " " << i );
 
-			return i;
-		}
-	}
-	return -1;
+      return i;
+    }
+  }
+  return -1;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -389,28 +391,27 @@ 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() {
-	
-	audio_debug("FmodAudioSound::get_dsp_name()." );
+string FmodAudioDSP::
+get_dsp_name() {
+  audio_debug("FmodAudioSound::get_dsp_name()." );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
-	char	name[32];
-	unsigned int	version;
-	int		channels;
-	int		configwidth;
-	int		configheight;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
+  char  name[32];
+  unsigned int  version;
+  int   channels;
+  int   configwidth;
+  int   configheight;
 
-	result = _dsp->getInfo(name, &version, &channels, &configwidth, &configheight);
-	ERRCHECK(result);
+  result = _dsp->getInfo(name, &version, &channels, &configwidth, &configheight);
+  ERRCHECK(result);
 
-	string returnInfo = (name);
-	//returnInfo.append(" Version: ");
-	//returnInfo.append(version);
-	//returnInfo.append("\n");
-
-	return returnInfo;
+  string returnInfo = (name);
+  //returnInfo.append(" Version: ");
+  //returnInfo.append(version);
+  //returnInfo.append("\n");
 
+  return returnInfo;
 }
 
 
@@ -418,17 +419,15 @@ string FmodAudioDSP::get_dsp_name() {
 //     Function: FmodAudioDSP::get_in_chain()
 //       Access: Published, Virtual
 //  Description: This is a functiont to query if a DSP have been assigned
-//				 to the GLOBAL or a SOUND's effect chain.
-//				 This is to make sure you 'remove' an effect from a chain
-//				 before you move it somewhere else or destroy it.
+//         to the GLOBAL or a SOUND's effect chain.
+//         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() {
-	
-	audio_debug("FmodAudioSound::get_in_chain()." );
-
-	return _in_chain;
-
+bool FmodAudioDSP::
+get_in_chain() {
+  audio_debug("FmodAudioSound::get_in_chain()." );
 
+  return _in_chain;
 }
 
 
@@ -436,16 +435,14 @@ bool FmodAudioDSP::get_in_chain() {
 //     Function: FmodAudioDSP::set_in_chain()
 //       Access: Published, Virtual
 //  Description: This is a functiont to set if a DSP have been assigned
-//				 to the GLOBAL or a SOUND's effect chain.
+//         to the GLOBAL or a SOUND's effect chain.
 ////////////////////////////////////////////////////////////////////
-void FmodAudioDSP::set_in_chain(bool chain_state) {
-	
-	audio_debug("FmodAudioSound::set_in_chain()." );
-
-	_in_chain = chain_state;
+void FmodAudioDSP::
+set_in_chain(bool chain_state) {
+  audio_debug("FmodAudioSound::set_in_chain()." );
 
+  _in_chain = chain_state;
 }
 
 
-
 #endif //]

+ 1 - 1
panda/src/audiotraits/fmodAudioDSP.h

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

+ 331 - 314
panda/src/audiotraits/fmodAudioManager.cxx

@@ -23,7 +23,7 @@
 #include "config_audio.h"
 #include "dcast.h"
 
-#ifdef HAVE_FMOD //[
+#ifdef HAVE_FMODEX //[
 
 //Panda headers.
 #include "config_audio.h"
@@ -61,13 +61,13 @@ TypeHandle FmodAudioManager::_type_handle;
 //  Python Prompt
 /////////////////////////////////////////////////////////////////////
 void ERRCHECK(FMOD_RESULT result){
-	audio_debug("FMOD State: "<< result <<" "<< FMOD_ErrorString(result) );
+  audio_debug("FMOD State: "<< result <<" "<< FMOD_ErrorString(result) );
 }
 
 
 PT(AudioManager) Create_AudioManager() {
-	audio_debug("Create_AudioManager() Fmod.");
-	return new FmodAudioManager;
+  audio_debug("Create_AudioManager() Fmod.");
+  return new FmodAudioManager;
 }
 
 
@@ -76,92 +76,91 @@ PT(AudioManager) Create_AudioManager() {
 //       Access: Public
 //  Description: Constructor
 ////////////////////////////////////////////////////////////////////
-FmodAudioManager::FmodAudioManager() {
+FmodAudioManager::
+FmodAudioManager() {
 
-	//OK Lets create the FMOD Audio Manager.
-	audio_debug("FmodAudioManager::FmodAudioManager()");
+  //OK Lets create the FMOD Audio Manager.
+  audio_debug("FmodAudioManager::FmodAudioManager()");
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	//We need a varible temporary to check the FMOD Version.
-	unsigned int      version;
+  //We need a varible temporary to check the FMOD Version.
+  unsigned int      version;
 
-	//Init 3D attributes
-	_position.x = 0;
-	_position.y = 0;
-	_position.z = 0;
+  //Init 3D attributes
+  _position.x = 0;
+  _position.y = 0;
+  _position.z = 0;
 
-	_velocity.x = 0;
-	_velocity.y = 0;
-	_velocity.z = 0;
+  _velocity.x = 0;
+  _velocity.y = 0;
+  _velocity.z = 0;
 
-	_forward.x = 0;
-	_forward.y = 0;
-	_forward.z = 0;
+  _forward.x = 0;
+  _forward.y = 0;
+  _forward.z = 0;
 
-	_up.x = 0;
-	_up.y = 0;
-	_up.z = 0;
-		
+  _up.x = 0;
+  _up.y = 0;
+  _up.z = 0;
+    
 
 
-	audio_debug("FMOD::System_Create()");
-	result = FMOD::System_Create(&_system);
-	ERRCHECK(result);
+  audio_debug("FMOD::System_Create()");
+  result = FMOD::System_Create(&_system);
+  ERRCHECK(result);
 
-	//  Let check the Version of FMOD to make sure the Headers and Libraries are correct.
-	audio_debug("FMOD::System_Create()");
-	result = _system->getVersion(&version);
-	ERRCHECK(result);
+  //  Let check the Version of FMOD to make sure the Headers and Libraries are correct.
+  audio_debug("FMOD::System_Create()");
+  result = _system->getVersion(&version);
+  ERRCHECK(result);
 
-	audio_debug("FMOD VERSION:" << hex << version );
-	audio_debug("FMOD - Getting Version");
+  audio_debug("FMOD VERSION:" << hex << version );
+  audio_debug("FMOD - Getting Version");
 
-	if (version < FMOD_VERSION){
-		audio_debug("Error!  You are using an old version of FMOD.  This program requires:" << FMOD_VERSION);
-	}
+  if (version < FMOD_VERSION){
+    audio_debug("Error!  You are using an old version of FMOD.  This program requires:" << FMOD_VERSION);
+  }
 
-	//Stick Surround Sound 5.1 thing Here.
+  //Stick Surround Sound 5.1 thing Here.
 
-	audio_debug("Checking for Surround Sound Flag.")
+  audio_debug("Checking for Surround Sound Flag.");
 
-	cerr << fmod_use_surround_sound << endl ;
+  if (fmod_use_surround_sound) {
+    audio_debug("Setting FMOD to use 5.1 Surround Sound.");
+    result = _system->setSpeakerMode( FMOD_SPEAKERMODE_5POINT1 );
+    ERRCHECK(result);
+  }
 
-	if (fmod_use_surround_sound) {
-		audio_debug("Setting FMOD to use 5.1 Surround Sound.")
-		result = _system->setSpeakerMode( FMOD_SPEAKERMODE_5POINT1 );
-		ERRCHECK(result);
-	}
+  //Now we Initialize the System.
 
-	//Now we Initialize the System.
+  audio_debug("FMOD::System_Init");
+  result = _system->init(fmod_number_of_sound_channels, FMOD_INIT_NORMAL, 0);
+  ERRCHECK(result);
 
-	audio_debug("FMOD::System_Init");
-	result = _system->init(fmod_number_of_sound_channels, FMOD_INIT_NORMAL, 0);
-	ERRCHECK(result);
+  if (result == FMOD_OK){
+    audio_debug("FMOD Intialized OK, We are good to go Houston!");
+    _is_valid = true;
+  } else {
+    audio_debug("Something is still wrong with FMOD!  Check source.");
+    _is_valid = false;
+  }
 
-	if (result == FMOD_OK){
-		audio_debug("FMOD Intialized OK, We are good to go Houston!");
-		_is_valid = true;
-	} else {
-		audio_debug("Something is still wrong with FMOD!  Check source.");
-		_is_valid = false;
-	}
+  //  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
+  //
+  //  This can be over written.  You just need to call
+  //  audio_3d_set_distance_factor(float factor) and set you new factor.
+  
+  _doppler_factor = 1;
+  _distance_factor = 3.28;
+  _drop_off_factor = 1;
 
-	//	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
-	//
-	//  This can be over written.  You just need to call
-	//	audio_3d_set_distance_factor(float factor) and set you new factor.
-	
-	_doppler_factor = 1;
-	_distance_factor = 3.28;
-	_drop_off_factor = 1;
+  audio_debug("Setting 3D Audio settings: Doppler Factor, Distance Factor, Drop Off Factor");
 
-	audio_debug("Setting 3D Audio settings: Doppler Factor, Distance Factor, Drop Off Factor");
-
-	result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
-	ERRCHECK( result );
+  result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
+  ERRCHECK( result );
 
 }
 
@@ -170,25 +169,26 @@ FmodAudioManager::FmodAudioManager() {
 //       Access: Public
 //  Description: DESTRCUTOR !!!
 ////////////////////////////////////////////////////////////////////
-FmodAudioManager::~FmodAudioManager() {
-	// Be sure to delete associated sounds before deleting the manager!
-	audio_debug("~FmodAudioManager(): Closing Down");
+FmodAudioManager::
+~FmodAudioManager() {
+  // Be sure to delete associated sounds before deleting the manager!
+  audio_debug("~FmodAudioManager(): Closing Down");
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	//Release DSPs First
-	_system_dsp.clear();
+  //Release DSPs First
+  _system_dsp.clear();
 
-	//Release Sounds Next
-	_all_sounds.clear();
+  //Release Sounds Next
+  _all_sounds.clear();
 
-	//result = _system->close();
-	//ERRCHECK(result);
+  //result = _system->close();
+  //ERRCHECK(result);
 
-	result = _system->release();
-	ERRCHECK(result);
+  result = _system->release();
+  ERRCHECK(result);
 
-	audio_debug("~FmodAudioManager(): System Down.");
+  audio_debug("~FmodAudioManager(): System Down.");
 
 }
 
@@ -196,11 +196,12 @@ FmodAudioManager::~FmodAudioManager() {
 //     Function: FmodAudioManager::is_valid
 //       Access: Public
 //  Description: This just check to make sure the FMOD System is 
-//				 up and running correctly.
+//         up and running correctly.
 ////////////////////////////////////////////////////////////////////
-bool FmodAudioManager::is_valid() {
-	audio_debug("FmodAudioManager::is_valid() = " << _is_valid );
-	return _is_valid;
+bool FmodAudioManager::
+is_valid() {
+  audio_debug("FmodAudioManager::is_valid() = " << _is_valid );
+  return _is_valid;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -208,23 +209,24 @@ 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<<"\")");
+  audio_debug("FmodAudioManager::get_sound(file_name=\""<<file_name<<"\")");
 
-	//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;
+  //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;
 
-	// Build a new AudioSound from the audio data.
-	PT(AudioSound) audioSound = 0;
-	PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path.to_os_specific(), positional );
+  // Build a new AudioSound from the audio data.
+  PT(AudioSound) audioSound = 0;
+  PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path.to_os_specific(), positional );
 
-	_all_sounds.insert(fmodAudioSound);
+  _all_sounds.insert(fmodAudioSound);
 
-	audioSound = fmodAudioSound;
+  audioSound = fmodAudioSound;
 
-	return audioSound;
+  return audioSound;
 
 }
 
@@ -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) {
-	audio_debug("FmodAudioManager()::create_dsp");
-	
-	// Build a new AudioSound from the audio data.
-	PT(FmodAudioDSP) fmodAudioDSP = new FmodAudioDSP(this, index);
-
-	return (AudioDSP*)fmodAudioDSP;
+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;
 }
 
 
@@ -249,37 +251,38 @@ PT(AudioDSP) FmodAudioManager::create_dsp(DSP_category index) {
 //     Function: FmodAudioManager::add_dsp()
 //       Access: Published
 //  Description: This stick the DSP in the Global Effect Chain
-//				DSP effects here, affect all the SOUNDS being played
-//				in panda.
+//        DSP effects here, affect all the SOUNDS being played
+//        in panda.
 ////////////////////////////////////////////////////////////////////
-bool FmodAudioManager::add_dsp( PT(AudioDSP) x) {
-	// intentionally blank
+bool FmodAudioManager::
+add_dsp( PT(AudioDSP) x) {
+  // intentionally blank
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	FmodAudioDSP *fdsp;
+  FmodAudioDSP *fdsp;
 
-	DCAST_INTO_R(fdsp, x, false);
+  DCAST_INTO_R(fdsp, x, false);
 
-	if ( fdsp->get_in_chain() ) {
+  if ( fdsp->get_in_chain() ) {
 
-		audio_debug("FmodAudioManager()::add_dsp");
-		audio_debug("This DSP has already been assigned to the system or a sound.");
+    audio_debug("FmodAudioManager()::add_dsp");
+    audio_debug("This DSP has already been assigned to the system or a sound.");
 
-		return false;
+    return false;
 
-	} else
-	{
+  } else
+  {
 
-		result = _system->addDSP( fdsp->_dsp );
-		ERRCHECK( result );
+    result = _system->addDSP( fdsp->_dsp );
+    ERRCHECK( result );
 
-		_system_dsp.insert(fdsp);
+    _system_dsp.insert(fdsp);
 
-		fdsp->set_in_chain(true);
+    fdsp->set_in_chain(true);
 
-		return true;
-	}
+    return true;
+  }
 
 }
 
@@ -288,37 +291,37 @@ bool FmodAudioManager::add_dsp( PT(AudioDSP) x) {
 //       Access: Published
 //  Description: This removes the DSP from the Global Effect chain but does not destroy it.
 //               Just remember a "Removed"  DSP is still availible for use 
-//				 in another chain Global or a specific sound.
+//         in another chain Global or a specific sound.
 ////////////////////////////////////////////////////////////////////
 bool FmodAudioManager::
 remove_dsp(PT(AudioDSP) x) {
-	// intentionally blank
+  // intentionally blank
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	FmodAudioDSP *fdsp;
-	DCAST_INTO_R(fdsp, x, false);
+  FmodAudioDSP *fdsp;
+  DCAST_INTO_R(fdsp, x, false);
 
-	if ( fdsp->get_in_chain() ) {
+  if ( fdsp->get_in_chain() ) {
 
-		result = fdsp->_dsp->remove();
-		ERRCHECK( result );
+    result = fdsp->_dsp->remove();
+    ERRCHECK( result );
 
-		_system_dsp.erase(fdsp);
+    _system_dsp.erase(fdsp);
 
-		fdsp->set_in_chain(false);
+    fdsp->set_in_chain(false);
 
-		return true;
+    return true;
 
-	} else
-	{
+  } else
+  {
 
-		audio_debug("FmodAudioManager()::remove_dsp()");
-		audio_debug("This DSP doesn't exist in this chain.");
+    audio_debug("FmodAudioManager()::remove_dsp()");
+    audio_debug("This DSP doesn't exist in this chain.");
 
-		return false;
+    return false;
 
-	}
+  }
 
 }
 
@@ -330,85 +333,85 @@ remove_dsp(PT(AudioDSP) x) {
 ////////////////////////////////////////////////////////////////////
 int FmodAudioManager::
 getSpeakerSetup() {
-	// intentionally blank
-
-	FMOD_RESULT result;
-	FMOD_SPEAKERMODE speakerMode;
-	int returnMode;
-
-	result = _system->getSpeakerMode( &speakerMode );
-	ERRCHECK( result );
-
-	switch (speakerMode) {
-		case	FMOD_SPEAKERMODE_RAW:
-			returnMode = 0;
-			break;
-		case	FMOD_SPEAKERMODE_MONO:
-			returnMode = 1;
-			break;
-		case	FMOD_SPEAKERMODE_STEREO:
-			returnMode = 2;
-			break;
-		case	FMOD_SPEAKERMODE_QUAD:
-			returnMode = 3;
-			break;
-		case	FMOD_SPEAKERMODE_SURROUND:
-			returnMode = 4;
-			break;
-		case	FMOD_SPEAKERMODE_5POINT1:
-			returnMode = 5;
-			break;
-		case	FMOD_SPEAKERMODE_7POINT1:
-			returnMode = 6;
-			break;
-		case	FMOD_SPEAKERMODE_PROLOGIC:
-			returnMode = 7;
-			break;
-		case	FMOD_SPEAKERMODE_MAX:
-			returnMode = 8;
-			break;
-		default:
-			returnMode = -1;
-		}
-
-	return returnMode;
+  // intentionally blank
+
+  FMOD_RESULT result;
+  FMOD_SPEAKERMODE speakerMode;
+  int returnMode;
+
+  result = _system->getSpeakerMode( &speakerMode );
+  ERRCHECK( result );
+
+  switch (speakerMode) {
+    case  FMOD_SPEAKERMODE_RAW:
+      returnMode = 0;
+      break;
+    case  FMOD_SPEAKERMODE_MONO:
+      returnMode = 1;
+      break;
+    case  FMOD_SPEAKERMODE_STEREO:
+      returnMode = 2;
+      break;
+    case  FMOD_SPEAKERMODE_QUAD:
+      returnMode = 3;
+      break;
+    case  FMOD_SPEAKERMODE_SURROUND:
+      returnMode = 4;
+      break;
+    case  FMOD_SPEAKERMODE_5POINT1:
+      returnMode = 5;
+      break;
+    case  FMOD_SPEAKERMODE_7POINT1:
+      returnMode = 6;
+      break;
+    case  FMOD_SPEAKERMODE_PROLOGIC:
+      returnMode = 7;
+      break;
+    case  FMOD_SPEAKERMODE_MAX:
+      returnMode = 8;
+      break;
+    default:
+      returnMode = -1;
+    }
+
+  return returnMode;
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: FmodAudioManager::setSpeakerSetup()
 //       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, 
-//				 stereo, or whatever you have to set the SpeakerMode
-//				 BEFORE you Initialize FMOD.
-//				 Since Panda Inits the FmodAudioManager right when you
-//				 Start it up, you are never given an oppertunity to call
-//				 this function.
-//				 That is why I stuck a BOOL in the CONFIG.PRC file, whichs
-//				 lets you flag if you want to use a Multichannel or not.
-//				 That will set the speaker setup when an instance of this
-//				 class is constructed.
-//				 Still I put this here as a measure of good faith, since you
-//				 can query the speaker setup after everything in Init.
-//				 Also, maybe someone will completely hack Panda someday, in which
-//				 one can init or re-init the AudioManagers after Panda is running.
+//         This method is pretty much useless.
+//         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
+//         Start it up, you are never given an oppertunity to call
+//         this function.
+//         That is why I stuck a BOOL in the CONFIG.PRC file, whichs
+//         lets you flag if you want to use a Multichannel or not.
+//         That will set the speaker setup when an instance of this
+//         class is constructed.
+//         Still I put this here as a measure of good faith, since you
+//         can query the speaker setup after everything in Init.
+//         Also, maybe someone will completely hack Panda someday, in which
+//         one can init or re-init the AudioManagers after Panda is running.
 ////////////////////////////////////////////////////////////////////
 void FmodAudioManager::
 setSpeakerSetup(AudioManager::SPEAKERMODE_category cat) {
-	// intentionally blank
+  // intentionally blank
 
-	audio_debug("FmodAudioSound::setSpeakerSetup() " );
+  audio_debug("FmodAudioSound::setSpeakerSetup() " );
 
-	//Local Variables that are needed.
-	FMOD_RESULT result;
+  //Local Variables that are needed.
+  FMOD_RESULT result;
 
-	FMOD_SPEAKERMODE speakerModeType = (FMOD_SPEAKERMODE)cat;
+  FMOD_SPEAKERMODE speakerModeType = (FMOD_SPEAKERMODE)cat;
 
-	result = _system->setSpeakerMode( speakerModeType);
-	ERRCHECK(result);
+  result = _system->setSpeakerMode( speakerModeType);
+  ERRCHECK(result);
 
-	audio_debug("Speaker Mode Set");
+  audio_debug("Speaker Mode Set");
 
 }
 
@@ -416,37 +419,37 @@ setSpeakerSetup(AudioManager::SPEAKERMODE_category cat) {
 //     Function: FmodAudioManager::set_volume(float volume)
 //       Access: Public
 //  Description: 
-//				There isn't a specific system volume function in FMOD-EX,
-//				so this function is moot now.
+//        There isn't a specific system volume function in FMOD-EX,
+//        so this function is moot now.
 ////////////////////////////////////////////////////////////////////
 void FmodAudioManager::set_volume(float volume) {
-	audio_debug("FmodAudioManager::set_volume()" );
-	audio_debug("This function has no effect in this version." )
-
+  audio_debug("FmodAudioManager::set_volume()" );
+  audio_debug("This function has no effect in this version." );
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: FmodAudioManager::get_volume()
 //       Access: Public
 //  Description: 
-//				There isn't a specific system volume function in FMOD-EX,
-//				so this function is moot now.
+//        There isn't a specific system volume function in FMOD-EX,
+//        so this function is moot now.
 ////////////////////////////////////////////////////////////////////
-float FmodAudioManager::get_volume() const {
-	audio_debug("FmodAudioManager::get_volume() returning ");
-	audio_debug("This function has no effect in this version." )
-	return 0;
+float FmodAudioManager::
+get_volume() const {
+  audio_debug("FmodAudioManager::get_volume() returning ");
+  audio_debug("This function has no effect in this version." );
+  return 0;
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: FmodAudioManager::set_active(bool active)
 //       Access: Public
 //  Description: Turn on/off
-//				 Again, this function is pretty much moot in this version now.
+//         Again, this function is pretty much moot in this version now.
 ////////////////////////////////////////////////////////////////////
-void FmodAudioManager::set_active(bool active) {
-	audio_debug("FmodAudioManager::set_active(flag="<<active<<")");
-
+void FmodAudioManager::
+set_active(bool active) {
+  audio_debug("FmodAudioManager::set_active(flag="<<active<<")");
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -454,9 +457,10 @@ void FmodAudioManager::set_active(bool active) {
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-bool FmodAudioManager::get_active() const {
-	audio_debug("FmodAudioManager::get_active() returning "<<_active);
-	return _active;
+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() {
-
-	audio_debug("FmodAudioManager::stop_all_sounds()" );
-
-	for (SoundSet::iterator i = _all_sounds.begin(); i != _all_sounds.end(); ++i) {
-
-		(*i)->stop();
-
-	}
+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,11 +484,12 @@ 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() {
-	audio_debug("FmodAudioManager::audio_3d_update()");
-	audio_debug("Calling FMOD's update function");
+void FmodAudioManager::
+audio_3d_update() {
+  audio_debug("FmodAudioManager::audio_3d_update()");
+  audio_debug("Calling FMOD's update function");
 
-	_system->update();
+  _system->update();
 
 }
 
@@ -495,40 +497,41 @@ void FmodAudioManager::audio_3d_update() {
 //     Function: FmodAudioManager::audio_3d_set_listener_attributes
 //       Access: Public
 //  Description: Set position of the "ear" that picks up 3d sounds
-//				NOW LISTEN UP!!! THIS IS IMPORTANT!
-//				Both Panda3D and FMOD use a left handed coordinate system.
-//				But there is a major difference!
-//				In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up.
-//				In FMOD the Y-Axis is going up and the Z-Axis is going into the screen.
-//				The solution is simple, we just flip the Y and Z axis, as we move coordinates
-//				from Panda to FMOD and back.
-//				What does did mean to average Panda user?  Nothing, they shouldn't notice anyway.
-//				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.
+//        NOW LISTEN UP!!! THIS IS IMPORTANT!
+//        Both Panda3D and FMOD use a left handed coordinate system.
+//        But there is a major difference!
+//        In Panda3D the Y-Axis is going into the Screen and the Z-Axis is going up.
+//        In FMOD the Y-Axis is going up and the Z-Axis is going into the screen.
+//        The solution is simple, we just flip the Y and Z axis, as we move coordinates
+//        from Panda to FMOD and back.
+//        What does did mean to average Panda user?  Nothing, they shouldn't notice anyway.
+//        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) {
-	audio_debug("FmodAudioManager::audio_3d_set_listener_attributes()");
+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;
-	
-	_position.x = px;
-	_position.y = pz;
-	_position.z = py;	
+  FMOD_RESULT result;
+  
+  _position.x = px;
+  _position.y = pz;
+  _position.z = py; 
 
-	_velocity.x = vx;
-	_velocity.y = vz;
-	_velocity.z = vy;
+  _velocity.x = vx;
+  _velocity.y = vz;
+  _velocity.z = vy;
 
-	_forward.x = fx;
-	_forward.y = fz;
-	_forward.z = fy;
+  _forward.x = fx;
+  _forward.y = fz;
+  _forward.z = fy;
 
-	_up.x = ux;
-	_up.y = uz;
-	_up.z = uy;
-		
-	result = _system->set3DListenerAttributes( 0, &_position, &_velocity, &_forward, &_up);
-	ERRCHECK( result );
+  _up.x = ux;
+  _up.y = uz;
+  _up.z = uy;
+    
+  result = _system->set3DListenerAttributes( 0, &_position, &_velocity, &_forward, &_up);
+  ERRCHECK( result );
 
 }
 
@@ -537,8 +540,9 @@ 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) {
-	audio_error("audio3dGetListenerAttributes: currently unimplemented. Get the attributes of the attached object");
+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,15 +553,16 @@ 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) {
-	audio_debug( "FmodAudioManager::audio_3d_set_distance_factor( factor= " << factor << ")" );
-	
-	FMOD_RESULT result;
+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;
+  _distance_factor = factor;
 
-	result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
-	ERRCHECK( result );
+  result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
+  ERRCHECK( result );
 
 
 }
@@ -568,10 +573,11 @@ 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 {
-	audio_debug("FmodAudioManager::audio_3d_get_distance_factor()");
+float FmodAudioManager::
+audio_3d_get_distance_factor() const {
+  audio_debug("FmodAudioManager::audio_3d_get_distance_factor()");
 
-	return _distance_factor;
+  return _distance_factor;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -580,15 +586,16 @@ 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) {
-	audio_debug("FmodAudioManager::audio_3d_set_doppler_factor(factor="<<factor<<")");
+void FmodAudioManager::
+audio_3d_set_doppler_factor(float factor) {
+  audio_debug("FmodAudioManager::audio_3d_set_doppler_factor(factor="<<factor<<")");
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	_doppler_factor = factor;
+  _doppler_factor = factor;
 
-	result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
-	ERRCHECK( result );
+  result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
+  ERRCHECK( result );
 
 }
 
@@ -597,10 +604,11 @@ void FmodAudioManager::audio_3d_set_doppler_factor(float factor) {
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-float FmodAudioManager::audio_3d_get_doppler_factor() const {
-	audio_debug("FmodAudioManager::audio_3d_get_doppler_factor()");
+float FmodAudioManager::
+audio_3d_get_doppler_factor() const {
+  audio_debug("FmodAudioManager::audio_3d_get_doppler_factor()");
 
-	return _doppler_factor;
+  return _doppler_factor;
 }
 
 ////////////////////////////////////////////////////////////////////
@@ -609,15 +617,16 @@ 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) {
-	audio_debug("FmodAudioManager::audio_3d_set_drop_off_factor("<<factor<<")");
+void FmodAudioManager::
+audio_3d_set_drop_off_factor(float factor) {
+  audio_debug("FmodAudioManager::audio_3d_set_drop_off_factor("<<factor<<")");
 
-	FMOD_RESULT result;
+  FMOD_RESULT result;
 
-	_drop_off_factor = factor;
+  _drop_off_factor = factor;
 
-	result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
-	ERRCHECK( result );
+  result = _system->set3DSettings( _doppler_factor, _distance_factor, _drop_off_factor);
+  ERRCHECK( result );
 
 }
 
@@ -626,10 +635,11 @@ void FmodAudioManager::audio_3d_set_drop_off_factor(float factor) {
 //       Access: Public
 //  Description: 
 ////////////////////////////////////////////////////////////////////
-float FmodAudioManager::audio_3d_get_drop_off_factor() const {
-	audio_debug("FmodAudioManager::audio_3d_get_drop_off_factor()");
+float FmodAudioManager::
+audio_3d_get_drop_off_factor() const {
+  audio_debug("FmodAudioManager::audio_3d_get_drop_off_factor()");
 
-	return _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) {
 
 }
 
@@ -667,10 +680,11 @@ void FmodAudioManager::reduce_sounds_playing_to(unsigned int count) {
 //     Function: FmodAudioManager::uncache_sound
 //       Access: Public
 //  Description: NOT USED FOR FMOD-EX!!!
-//				 Clears a sound out of the sound cache.
+//         Clears a sound out of the sound cache.
 ////////////////////////////////////////////////////////////////////
-void FmodAudioManager::uncache_sound(const string& file_name) {
-	audio_debug("FmodAudioManager::uncache_sound(\""<<file_name<<"\")");
+void FmodAudioManager::
+uncache_sound(const string& file_name) {
+  audio_debug("FmodAudioManager::uncache_sound(\""<<file_name<<"\")");
 
 }
 
@@ -679,21 +693,23 @@ void FmodAudioManager::uncache_sound(const string& file_name) {
 //     Function: FmodAudioManager::clear_cache
 //       Access: Public
 //  Description: NOT USED FOR FMOD-EX!!!
-//				 Clear out the sound cache.
+//         Clear out the sound cache.
 ////////////////////////////////////////////////////////////////////
-void FmodAudioManager::clear_cache() {
-	audio_debug("FmodAudioManager::clear_cache()");
-	
+void FmodAudioManager::
+clear_cache() {
+  audio_debug("FmodAudioManager::clear_cache()");
+  
 }
 
 ////////////////////////////////////////////////////////////////////
 //     Function: FmodAudioManager::set_cache_limit
 //       Access: Public
 //  Description: NOT USED FOR FMOD-EX!!!
-//				 Set the number of sounds that the cache can hold.
+//         Set the number of sounds that the cache can hold.
 ////////////////////////////////////////////////////////////////////
-void FmodAudioManager::set_cache_limit(unsigned int count) {
-	audio_debug("FmodAudioManager::set_cache_limit(count="<<count<<")");
+void FmodAudioManager::
+set_cache_limit(unsigned int count) {
+  audio_debug("FmodAudioManager::set_cache_limit(count="<<count<<")");
 
 }
 
@@ -701,12 +717,13 @@ void FmodAudioManager::set_cache_limit(unsigned int count) {
 //     Function: FmodAudioManager::get_cache_limit
 //       Access: Public
 //  Description: NOT USED FOR FMOD-EX!!!
-// 				 Gets the number of sounds that the cache can hold.
+//         Gets the number of sounds that the cache can hold.
 ////////////////////////////////////////////////////////////////////
-unsigned int FmodAudioManager::get_cache_limit() const {
-	audio_debug("FmodAudioManager::get_cache_limit() returning ");
-	//return _cache_limit;
-	return 0;
+unsigned int FmodAudioManager::
+get_cache_limit() const {
+  audio_debug("FmodAudioManager::get_cache_limit() returning ");
+  //return _cache_limit;
+  return 0;
 }
 
 

+ 1 - 1
panda/src/audiotraits/fmodAudioManager.h

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

File diff suppressed because it is too large
+ 416 - 410
panda/src/audiotraits/fmodAudioSound.cxx


+ 1 - 1
panda/src/audiotraits/fmodAudioSound.h

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

Some files were not shown because too many files changed in this diff