summaryrefslogtreecommitdiff
path: root/Source/Core
diff options
context:
space:
mode:
authorskidau <skidau@gmail.com>2014-11-06 22:51:59 +1100
committerskidau <skidau@gmail.com>2014-11-06 22:51:59 +1100
commit021cdac24c4753e303ee6a4357356ec116ff0a7b (patch)
tree5e12857f64c2faeda66538fabea394a691efa88d /Source/Core
parentd1950c1920289bb7f174c4c96154c9e9bc4f11b2 (diff)
Ignore the emulated wiimotes speaker data if the sample rate is set at 0hz.
Fixes issue 7806.
Diffstat (limited to 'Source/Core')
-rw-r--r--Source/Core/Core/HW/WiimoteEmu/Speaker.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
index 725fa25adb..cdabd41bd2 100644
--- a/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
+++ b/Source/Core/Core/HW/WiimoteEmu/Speaker.cpp
@@ -109,19 +109,21 @@ void Wiimote::SpeakerData(wm_speaker_data* sd)
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
- 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;
- unsigned int left_volume = (unsigned int)((128 + vol) * speaker_volume_ratio * amp);
- unsigned int right_volume = (unsigned int)((128 - vol) * speaker_volume_ratio * amp);
-
- if (left_volume > 255)
- left_volume = 255;
- if (right_volume > 255)
- right_volume = 255;
-
- g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume);
- g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate);
-
+ if (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;
+ unsigned int left_volume = (unsigned int)((128 + vol) * speaker_volume_ratio * amp);
+ unsigned int right_volume = (unsigned int)((128 - vol) * speaker_volume_ratio * amp);
+
+ if (left_volume > 255)
+ left_volume = 255;
+ if (right_volume > 255)
+ right_volume = 255;
+
+ g_sound_stream->GetMixer()->SetWiimoteSpeakerVolume(left_volume, right_volume);
+ g_sound_stream->GetMixer()->PushWiimoteSpeakerSamples(samples.get(), sd->length, sample_rate);
+ }
#ifdef WIIMOTE_SPEAKER_DUMP
static int num = 0;