Ignore the emulated wiimotes speaker data if the sample rate is set at 0hz.

Fixes issue 7806.
This commit is contained in:
skidau 2014-11-06 22:51:59 +11:00
parent d1950c1920
commit 021cdac24c
1 changed files with 13 additions and 11 deletions

View File

@ -109,6 +109,8 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
unsigned int vol = (unsigned int)(m_options->settings[4]->GetValue() * 100); unsigned int vol = (unsigned int)(m_options->settings[4]->GetValue() * 100);
float amp = 10.0f; // Boost the speaker volume relative to the rest of the game audio float amp = 10.0f; // Boost the speaker volume relative to the rest of the game audio
if (m_reg_speaker.sample_rate)
{
unsigned int sample_rate = sample_rate_dividend / Common::swap16(m_reg_speaker.sample_rate); unsigned int sample_rate = sample_rate_dividend / Common::swap16(m_reg_speaker.sample_rate);
float speaker_volume_ratio = (float)m_reg_speaker.volume / volume_divisor; float speaker_volume_ratio = (float)m_reg_speaker.volume / volume_divisor;
unsigned int left_volume = (unsigned int)((128 + vol) * speaker_volume_ratio * amp); unsigned int left_volume = (unsigned int)((128 + vol) * speaker_volume_ratio * amp);
@ -121,7 +123,7 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume); g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume);
g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate); g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate);
}
#ifdef WIIMOTE_SPEAKER_DUMP #ifdef WIIMOTE_SPEAKER_DUMP
static int num = 0; static int num = 0;