aboutsummaryrefslogtreecommitdiff
path: root/source/soundux.c
diff options
context:
space:
mode:
authorJoão Silva2017-02-12 01:52:03 +0000
committerJoão Silva2017-02-12 01:52:03 +0000
commit3777d1fcf4232cde426f46b7ee5c374fd949b1b0 (patch)
treee76f38bc1bac83bab19daea51d63ed87236e047e /source/soundux.c
parentb6006bc542f89ad1b7086268f851f0ba880ad6cd (diff)
downloadsnes9x2005-3777d1fcf4232cde426f46b7ee5c374fd949b1b0.tar.gz
snes9x2005-3777d1fcf4232cde426f46b7ee5c374fd949b1b0.tar.bz2
snes9x2005-3777d1fcf4232cde426f46b7ee5c374fd949b1b0.zip
Type fixes. Fixes from snes9x 1.50. Minor changes and optimizations.
Diffstat (limited to 'source/soundux.c')
-rw-r--r--source/soundux.c25
1 files changed, 11 insertions, 14 deletions
diff --git a/source/soundux.c b/source/soundux.c
index 237392e..9a2839e 100644
--- a/source/soundux.c
+++ b/source/soundux.c
@@ -381,8 +381,8 @@ void DecodeBlock(Channel* ch)
int8_t* compressed = (int8_t*) &IAPU.RAM [ch->block_pointer];
filter = *compressed;
- if ((ch->last_block = filter & 1))
- ch->loop = (filter & 2) != 0;
+ if ((ch->last_block = (bool) (filter & 1)))
+ ch->loop = (bool) (filter & 2);
int16_t* raw = ch->block = ch->decoded;
uint32_t i;
@@ -480,7 +480,7 @@ static inline void MixStereo(int32_t sample_count)
int32_t VL, VR;
uint32_t freq0 = ch->frequency;
- bool mod = pitch_mod & (1 << J);
+ uint8_t mod = pitch_mod & (1 << J);
if (ch->needs_decode)
{
@@ -497,8 +497,7 @@ static inline void MixStereo(int32_t sample_count)
ch->interpolate = 0;
if (Settings.InterpolatedSound && freq0 < FIXED_POINT && !mod)
- ch->interpolate = ((ch->next_sample - ch->sample) *
- (int32_t) freq0) / (int32_t) FIXED_POINT;
+ ch->interpolate = ((ch->next_sample - ch->sample) * (int32_t) freq0) / (int32_t) FIXED_POINT;
}
VL = (ch->sample * ch-> left_vol_level) / 128;
VR = (ch->sample * ch->right_vol_level) / 128;
@@ -702,10 +701,8 @@ static inline void MixStereo(int32_t sample_count)
{
if (Settings.InterpolatedSound && freq < FIXED_POINT && !mod)
{
- ch->interpolate = ((ch->next_sample - ch->sample) *
- (int32_t) freq) / (int32_t) FIXED_POINT;
- ch->sample = (int16_t)(ch->sample + (((ch->next_sample - ch->sample) *
- (int32_t)(ch->count)) / (int32_t) FIXED_POINT));
+ ch->interpolate = ((ch->next_sample - ch->sample) * (int32_t) freq) / (int32_t) FIXED_POINT;
+ ch->sample = (int16_t)(ch->sample + (((ch->next_sample - ch->sample) * (int32_t)(ch->count)) / (int32_t) FIXED_POINT));
}
else
ch->interpolate = 0;
@@ -931,7 +928,7 @@ bool S9xInitSound()
{
so.playback_rate = 0;
S9xResetSound(true);
- return (1);
+ return true;
}
bool S9xSetSoundMode(int32_t channel, int32_t mode)
@@ -944,7 +941,7 @@ bool S9xSetSoundMode(int32_t channel, int32_t mode)
if (ch->mode != MODE_NONE)
{
ch->mode = MODE_RELEASE;
- return (true);
+ return true;
}
break;
case MODE_DECREASE_LINEAR:
@@ -957,18 +954,18 @@ bool S9xSetSoundMode(int32_t channel, int32_t mode)
ch->mode = mode;
if (ch->state != SOUND_SILENT)
ch->state = mode;
- return (true);
+ return true;
}
break;
case MODE_ADSR:
if (ch->mode == MODE_NONE || ch->mode == MODE_ADSR)
{
ch->mode = mode;
- return (true);
+ return true;
}
}
- return (false);
+ return false;
}
void S9xPlaySample(int32_t channel)