From 92324d145d804a963e8858a5daac18085553c6c9 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Oct 2018 21:15:31 +0800 Subject: =?UTF-8?q?*=E6=A0=BC=E5=BC=8F=E5=8C=96=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/libjin/Audio/SDL/SDLSource.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/libjin/Audio/SDL/SDLSource.cpp') diff --git a/src/libjin/Audio/SDL/SDLSource.cpp b/src/libjin/Audio/SDL/SDLSource.cpp index 251ef27..9f4f2fb 100644 --- a/src/libjin/Audio/SDL/SDLSource.cpp +++ b/src/libjin/Audio/SDL/SDLSource.cpp @@ -290,21 +290,21 @@ Manager::get()->pushCommand(cmd); \ for (int i = 0; i < samples; ++i) { char* source = (char*)raw.data + status.pos * (raw.bitdepth / 8) * raw.channels; - short left = 0; - short right = 0; + short l = 0; + short r = 0; if (raw.bitdepth == 16) { - left = ((short*)source)[L] * status.volume; - right = ((short*)source)[L + raw.channels - 1] * status.volume; + l = ((short*)source)[L] * status.volume; + r = ((short*)source)[L + raw.channels - 1] * status.volume; } else if (raw.bitdepth == 8) { - left = source[L] << 8; // << 8 放大到16bits - right = source[L + raw.channels - 1] << 8; + l = source[L] << 8; // << 8 放大到16bits + r = source[L + raw.channels - 1] << 8; } short* sample = buffer + (i << 1); - sample[L] = clamp(sample[L] + left, SHRT_MIN, SHRT_MAX); // 左声道 - sample[R] = clamp(sample[R] + right, SHRT_MIN, SHRT_MAX); // 右声道 + sample[L] = clamp(sample[L] + l, SHRT_MIN, SHRT_MAX); // 左声道 + sample[R] = clamp(sample[R] + r, SHRT_MIN, SHRT_MAX); // 右声道 ++status.pos; if (status.pos > raw.samples && status.loop) status.pos = 0; // rewind -- cgit v1.1-26-g67d0