mirror of
https://github.com/dhewm/dhewm3.git
synced 2024-11-27 06:32:27 +00:00
Don't use idAudioHardware to get the speaker count
Use the CVar s_numberOfSpeakers for that, its already stored in there. Add the same (!= 2 && !=6) check as in the audio backends since the mixer is limited to these 2 values.
This commit is contained in:
parent
66141935f5
commit
4e26e1ac6f
2 changed files with 18 additions and 13 deletions
|
@ -476,6 +476,13 @@ idSoundSystemLocal::InitHW
|
|||
===============
|
||||
*/
|
||||
bool idSoundSystemLocal::InitHW() {
|
||||
int numSpeakers = s_numberOfSpeakers.GetInteger();
|
||||
|
||||
if (numSpeakers != 2 && numSpeakers != 6) {
|
||||
common->Warning("invalid value for s_numberOfSpeakers. Use either 2 or 6");
|
||||
numSpeakers = 2;
|
||||
s_numberOfSpeakers.SetInteger(numSpeakers);
|
||||
}
|
||||
|
||||
if ( s_noSound.GetBool() ) {
|
||||
return false;
|
||||
|
@ -498,10 +505,12 @@ bool idSoundSystemLocal::InitHW() {
|
|||
if ( snd_audio_hw->GetNumberOfSpeakers() == 0 ) {
|
||||
return false;
|
||||
}
|
||||
// put the real number in there
|
||||
s_numberOfSpeakers.SetInteger( snd_audio_hw->GetNumberOfSpeakers() );
|
||||
numSpeakers = snd_audio_hw->GetNumberOfSpeakers();
|
||||
}
|
||||
|
||||
// put the real number in there
|
||||
s_numberOfSpeakers.SetInteger(numSpeakers);
|
||||
|
||||
isInitialized = true;
|
||||
shutdown = false;
|
||||
|
||||
|
@ -590,7 +599,7 @@ int idSoundSystemLocal::AsyncMix( int soundTime, float *mixBuffer ) {
|
|||
}
|
||||
|
||||
inTime = Sys_Milliseconds();
|
||||
numSpeakers = snd_audio_hw->GetNumberOfSpeakers();
|
||||
numSpeakers = s_numberOfSpeakers.GetInteger();
|
||||
|
||||
// let the active sound world mix all the channels in unless muted or avi demo recording
|
||||
if ( !muted && currentSoundWorld && !currentSoundWorld->fpa[0] ) {
|
||||
|
@ -654,7 +663,7 @@ int idSoundSystemLocal::AsyncUpdate( int inTime ) {
|
|||
soundStats.runs++;
|
||||
soundStats.activeSounds = 0;
|
||||
|
||||
int numSpeakers = snd_audio_hw->GetNumberOfSpeakers();
|
||||
int numSpeakers = s_numberOfSpeakers.GetInteger();
|
||||
|
||||
nextWriteBlock++;
|
||||
nextWriteBlock %= ROOM_SLICES_IN_BUFFER;
|
||||
|
@ -755,7 +764,7 @@ int idSoundSystemLocal::AsyncUpdateWrite( int inTime ) {
|
|||
}
|
||||
|
||||
int sampleTime = dwCurrentBlock * MIXBUFFER_SAMPLES;
|
||||
int numSpeakers = snd_audio_hw->GetNumberOfSpeakers();
|
||||
int numSpeakers = s_numberOfSpeakers.GetInteger();
|
||||
|
||||
if ( useOpenAL ) {
|
||||
// enable audio hardware caching
|
||||
|
@ -837,7 +846,7 @@ cinData_t idSoundSystemLocal::ImageForTime( const int milliseconds, const bool w
|
|||
float *accum = finalMixBuffer; // unfortunately, these are already clamped
|
||||
int time = Sys_Milliseconds();
|
||||
|
||||
int numSpeakers = snd_audio_hw->GetNumberOfSpeakers();
|
||||
int numSpeakers = s_numberOfSpeakers.GetInteger();
|
||||
|
||||
if ( !waveform ) {
|
||||
for( j = 0; j < numSpeakers; j++ ) {
|
||||
|
|
|
@ -550,7 +550,7 @@ void idSoundWorldLocal::AVIOpen( const char *path, const char *name ) {
|
|||
|
||||
lastAVI44kHz = game44kHz - game44kHz % MIXBUFFER_SAMPLES;
|
||||
|
||||
if ( soundSystemLocal.snd_audio_hw->GetNumberOfSpeakers() == 6 ) {
|
||||
if ( idSoundSystemLocal::s_numberOfSpeakers.GetInteger() == 6 ) {
|
||||
fpa[0] = fileSystem->OpenFileWrite( aviDemoPath + "channel_51_left.raw" );
|
||||
fpa[1] = fileSystem->OpenFileWrite( aviDemoPath + "channel_51_right.raw" );
|
||||
fpa[2] = fileSystem->OpenFileWrite( aviDemoPath + "channel_51_center.raw" );
|
||||
|
@ -581,11 +581,7 @@ void idSoundWorldLocal::AVIUpdate() {
|
|||
return;
|
||||
}
|
||||
|
||||
if ( !soundSystemLocal.snd_audio_hw ) {
|
||||
numSpeakers = 2;
|
||||
} else {
|
||||
numSpeakers = soundSystemLocal.snd_audio_hw->GetNumberOfSpeakers();
|
||||
}
|
||||
numSpeakers = idSoundSystemLocal::s_numberOfSpeakers.GetInteger();
|
||||
|
||||
float mix[MIXBUFFER_SAMPLES*6+16];
|
||||
float *mix_p = (float *)((( intptr_t)mix + 15 ) & ~15); // SIMD align
|
||||
|
@ -639,7 +635,7 @@ void idSoundWorldLocal::AVIClose( void ) {
|
|||
fpa[i] = NULL;
|
||||
}
|
||||
}
|
||||
if ( soundSystemLocal.snd_audio_hw->GetNumberOfSpeakers() == 2 ) {
|
||||
if ( idSoundSystemLocal::s_numberOfSpeakers.GetInteger() == 2 ) {
|
||||
// convert it to a wave file
|
||||
idFile *rL, *lL, *wO;
|
||||
idStr name;
|
||||
|
|
Loading…
Reference in a new issue