summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2010-01-16 20:59:58 +0000
committerpeter1138 <peter1138@openttd.org>2010-01-16 20:59:58 +0000
commit3a5e588f1202fd3b0d642281c59e0c70a284da17 (patch)
tree66dddf4ffa58beb4bb6c5537e62b82e961cadc4f
parentc07c7a3818ed77649825ecfde3fe8ca7dc68c2ac (diff)
downloadopenttd-3a5e588f1202fd3b0d642281c59e0c70a284da17.tar.xz
(svn r18833) -Cleanup: Const-ness and style
-rw-r--r--src/mixer.cpp34
1 files changed, 11 insertions, 23 deletions
diff --git a/src/mixer.cpp b/src/mixer.cpp
index 30f788aec..6fcdcb11f 100644
--- a/src/mixer.cpp
+++ b/src/mixer.cpp
@@ -57,21 +57,15 @@ static int RateConversion(T *b, int frac_pos)
static void mix_int16(MixerChannel *sc, int16 *buffer, uint samples)
{
- int16 *b;
- uint32 frac_pos;
- uint32 frac_speed;
- int volume_left;
- int volume_right;
-
if (samples > sc->samples_left) samples = sc->samples_left;
sc->samples_left -= samples;
assert(samples > 0);
- b = (int16*)sc->memory + sc->pos;
- frac_pos = sc->frac_pos;
- frac_speed = sc->frac_speed;
- volume_left = sc->volume_left;
- volume_right = sc->volume_right;
+ const int16 *b = (const int16 *)sc->memory + sc->pos;
+ uint32 frac_pos = sc->frac_pos;
+ uint32 frac_speed = sc->frac_speed;
+ int volume_left = sc->volume_left;
+ int volume_right = sc->volume_right;
if (frac_speed == 0x10000) {
/* Special case when frac_speed is 0x10000 */
@@ -94,26 +88,20 @@ static void mix_int16(MixerChannel *sc, int16 *buffer, uint samples)
}
sc->frac_pos = frac_pos;
- sc->pos = b - (int16*)sc->memory;
+ sc->pos = b - (const int16 *)sc->memory;
}
static void mix_int8_to_int16(MixerChannel *sc, int16 *buffer, uint samples)
{
- int8 *b;
- uint32 frac_pos;
- uint32 frac_speed;
- int volume_left;
- int volume_right;
-
if (samples > sc->samples_left) samples = sc->samples_left;
sc->samples_left -= samples;
assert(samples > 0);
- b = sc->memory + sc->pos;
- frac_pos = sc->frac_pos;
- frac_speed = sc->frac_speed;
- volume_left = sc->volume_left;
- volume_right = sc->volume_right;
+ const int8 *b = sc->memory + sc->pos;
+ uint32 frac_pos = sc->frac_pos;
+ uint32 frac_speed = sc->frac_speed;
+ int volume_left = sc->volume_left;
+ int volume_right = sc->volume_right;
if (frac_speed == 0x10000) {
/* Special case when frac_speed is 0x10000 */