mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
add fmod-speaker-mode variable
This commit is contained in:
parent
d3d69aca60
commit
248e4f2672
@ -82,7 +82,14 @@ ConfigVariableInt fmod_number_of_sound_channels
|
||||
|
||||
ConfigVariableBool fmod_use_surround_sound
|
||||
("fmod-use-surround-sound", false,
|
||||
PRC_DESC("Determines if an FMOD Flavor of PANDA use 5.1 Surround Sound or Not.") );
|
||||
PRC_DESC("Determines if an FMOD Flavor of PANDA use 5.1 Surround Sound or not. "
|
||||
"This variable is deprecated and should not be used. Use the enum "
|
||||
"variable fmod-speaker-mode instead."));
|
||||
|
||||
ConfigVariableEnum<FmodSpeakerMode> fmod_speaker_mode
|
||||
("fmod-speaker-mode", FSM_unspecified,
|
||||
PRC_DESC("Sets the speaker configuration that the FMOD sound system will use. "
|
||||
"Options: raw, mono, stereo, quad, surround, 5.1, 7.1 and prologic. "));
|
||||
|
||||
|
||||
// Config variables for Miles:
|
||||
@ -116,8 +123,6 @@ ConfigVariableInt audio_output_bits
|
||||
ConfigVariableInt audio_output_channels
|
||||
("audio-output-channels", 2);
|
||||
|
||||
|
||||
|
||||
ConfigureFn(config_audio) {
|
||||
FilterProperties::init_type();
|
||||
AudioLoadRequest::init_type();
|
||||
@ -127,5 +132,62 @@ ConfigureFn(config_audio) {
|
||||
NullAudioSound::init_type();
|
||||
}
|
||||
|
||||
ostream &
|
||||
operator << (ostream &out, FmodSpeakerMode sm) {
|
||||
switch (sm) {
|
||||
case FSM_raw:
|
||||
return out << "raw";
|
||||
case FSM_mono:
|
||||
return out << "mono";
|
||||
case FSM_stereo:
|
||||
return out << "stereo";
|
||||
case FSM_quad:
|
||||
return out << "quad";
|
||||
case FSM_surround:
|
||||
return out << "surround";
|
||||
case FSM_5point1:
|
||||
return out << "5.1";
|
||||
case FSM_7point1:
|
||||
return out << "7.1";
|
||||
case FSM_prologic:
|
||||
return out << "prologic";
|
||||
case FSM_unspecified:
|
||||
return out;
|
||||
}
|
||||
|
||||
return out << "**invalid FmodSpeakerMode (" << (int)sm << ")**";
|
||||
}
|
||||
|
||||
istream &
|
||||
operator >> (istream &in, FmodSpeakerMode &sm) {
|
||||
string word;
|
||||
in >> word;
|
||||
|
||||
if (word.size() == 0) {
|
||||
sm = FSM_unspecified;
|
||||
} else if (cmp_nocase(word, "raw") == 0) {
|
||||
sm = FSM_raw;
|
||||
} else if (cmp_nocase(word, "mono") == 0) {
|
||||
sm = FSM_mono;
|
||||
} else if (cmp_nocase(word, "stereo") == 0) {
|
||||
sm = FSM_stereo;
|
||||
} else if (cmp_nocase(word, "quad") == 0) {
|
||||
sm = FSM_quad;
|
||||
} else if (cmp_nocase(word, "surround") == 0) {
|
||||
sm = FSM_surround;
|
||||
} else if (cmp_nocase(word, "5point1") == 0 ||
|
||||
cmp_nocase(word, "5.1") == 0) {
|
||||
sm = FSM_5point1;
|
||||
} else if (cmp_nocase(word, "7point1") == 0 ||
|
||||
cmp_nocase(word, "7.1") == 0) {
|
||||
sm = FSM_7point1;
|
||||
} else if (cmp_nocase(word, "prologic") == 0) {
|
||||
sm = FSM_prologic;
|
||||
|
||||
} else {
|
||||
gobj_cat->error() << "Invalid FmodSpeakerMode value: " << word << "\n";
|
||||
sm = FSM_unspecified;
|
||||
}
|
||||
|
||||
return in;
|
||||
}
|
||||
|
@ -39,8 +39,27 @@ extern EXPCL_PANDA_AUDIO ConfigVariableString audio_library_name;
|
||||
|
||||
// Config vars for Fmod:
|
||||
|
||||
// Values match FMOD_SPEAKERMODE enum.
|
||||
enum FmodSpeakerMode {
|
||||
FSM_raw,
|
||||
FSM_mono,
|
||||
FSM_stereo,
|
||||
FSM_quad,
|
||||
FSM_surround,
|
||||
FSM_5point1,
|
||||
FSM_7point1,
|
||||
FSM_prologic,
|
||||
|
||||
// For backward compatibility
|
||||
FSM_unspecified
|
||||
};
|
||||
|
||||
EXPCL_FMOD_AUDIO ostream &operator << (ostream &out, FmodSpeakerMode sm);
|
||||
EXPCL_FMOD_AUDIO istream &operator >> (istream &in, FmodSpeakerMode &sm);
|
||||
|
||||
extern EXPCL_PANDA_AUDIO ConfigVariableInt fmod_number_of_sound_channels;
|
||||
extern EXPCL_PANDA_AUDIO ConfigVariableBool fmod_use_surround_sound;
|
||||
extern EXPCL_PANDA_AUDIO ConfigVariableEnum<FmodSpeakerMode> fmod_speaker_mode;
|
||||
|
||||
// Config vars for OpenAL:
|
||||
|
||||
|
@ -128,10 +128,18 @@ FmodAudioManager() {
|
||||
audio_error("You are using an old version of FMOD. This program requires:" << FMOD_VERSION);
|
||||
}
|
||||
|
||||
//Stick Surround Sound 5.1 thing Here.
|
||||
if (fmod_use_surround_sound) {
|
||||
audio_debug("Setting FMOD to use 5.1 Surround Sound.");
|
||||
result = _system->setSpeakerMode(FMOD_SPEAKERMODE_5POINT1);
|
||||
// Set speaker mode.
|
||||
if (fmod_speaker_mode.get_value() == FSM_unspecified) {
|
||||
if (fmod_use_surround_sound) {
|
||||
// fmod-use-surround-sound is the old variable, now replaced
|
||||
// by fmod-speaker-mode. This is for backward compatibility.
|
||||
result = _system->setSpeakerMode(FMOD_SPEAKERMODE_5POINT1);
|
||||
fmod_audio_errcheck("_system->setSpeakerMode()", result);
|
||||
}
|
||||
} else {
|
||||
FMOD_SPEAKERMODE speakerMode;
|
||||
speakerMode = (FMOD_SPEAKERMODE) fmod_speaker_mode.get_value();
|
||||
result = _system->setSpeakerMode(speakerMode);
|
||||
fmod_audio_errcheck("_system->setSpeakerMode()", result);
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user