diff --git a/src/effect_position.c b/src/effect_position.c index 22768cdc..1f152381 100644 --- a/src/effect_position.c +++ b/src/effect_position.c @@ -168,7 +168,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u } if (args->room_angle == 0) - for (i = 0; i < len; i += sizeof (Uint8) * 6) { + for (i = 0; i < len; i += sizeof (Uint8) * 4) { /* must adjust the sample so that 0 is the center */ *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) * args->left_f) * args->distance_f) + 128); @@ -184,7 +184,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u ptr++; } else if (args->room_angle == 90) - for (i = 0; i < len; i += sizeof (Uint8) * 6) { + for (i = 0; i < len; i += sizeof (Uint8) * 4) { /* must adjust the sample so that 0 is the center */ *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) * args->right_f) * args->distance_f) + 128); @@ -200,7 +200,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u ptr++; } else if (args->room_angle == 180) - for (i = 0; i < len; i += sizeof (Uint8) * 6) { + for (i = 0; i < len; i += sizeof (Uint8) * 4) { /* must adjust the sample so that 0 is the center */ *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) * args->right_rear_f) * args->distance_f) + 128); @@ -216,7 +216,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u ptr++; } else if (args->room_angle == 270) - for (i = 0; i < len; i += sizeof (Uint8) * 6) { + for (i = 0; i < len; i += sizeof (Uint8) * 4) { /* must adjust the sample so that 0 is the center */ *ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128)) * args->left_rear_f) * args->distance_f) + 128); @@ -398,12 +398,12 @@ static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void *p = (d[l[(*p & 0xFF000000) >> 24]] << 24) | (d[r[(*p & 0x00FF0000) >> 16]] << 16) | (d[l[(*p & 0x0000FF00) >> 8]] << 8) | - (d[r[(*p & 0x000000FF) ]] ) ; + (d[r[(*p & 0x000000FF) ]] ) ; #else *p = (d[r[(*p & 0xFF000000) >> 24]] << 24) | (d[l[(*p & 0x00FF0000) >> 16]] << 16) | (d[r[(*p & 0x0000FF00) >> 8]] << 8) | - (d[l[(*p & 0x000000FF) ]] ) ; + (d[l[(*p & 0x000000FF) ]] ) ; #endif ++p; } @@ -596,12 +596,12 @@ static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void *p = (d[l[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) | (d[r[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) | (d[l[((Sint16)(Sint8)((*p & 0x0000FF00) >> 8))+128]] << 8) | - (d[r[((Sint16)(Sint8)((*p & 0x000000FF) ))+128]] ) ; + (d[r[((Sint16)(Sint8)((*p & 0x000000FF) ))+128]] ) ; #else *p = (d[r[((Sint16)(Sint8)((*p & 0xFF000000) >> 24))+128]] << 24) | (d[l[((Sint16)(Sint8)((*p & 0x00FF0000) >> 16))+128]] << 16) | (d[r[((Sint16)(Sint8)((*p & 0x0000FF00) >> 8))+128]] << 8) | - (d[l[((Sint16)(Sint8)((*p & 0x000000FF) ))+128]] ) ; + (d[l[((Sint16)(Sint8)((*p & 0x000000FF) ))+128]] ) ; #endif ++p; } @@ -1600,11 +1600,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) switch (format) { case AUDIO_U8: - switch (channels) { + switch (channels) { case 1: case 2: f = (_Eff_build_volume_table_u8()) ? _Eff_position_table_u8 : - _Eff_position_u8; + _Eff_position_u8; break; case 4: f = _Eff_position_u8_c4; @@ -1615,15 +1615,15 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_S8: - switch (channels) { + switch (channels) { case 1: case 2: f = (_Eff_build_volume_table_s8()) ? _Eff_position_table_s8 : - _Eff_position_s8; + _Eff_position_s8; break; case 4: f = _Eff_position_s8_c4; @@ -1634,11 +1634,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_U16LSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_u16lsb; @@ -1652,11 +1652,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_S16LSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_s16lsb; @@ -1670,11 +1670,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_U16MSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_u16msb; @@ -1688,11 +1688,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_S16MSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_s16msb; @@ -1706,11 +1706,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_S32MSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_s32msb; @@ -1724,11 +1724,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_S32LSB: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_s32lsb; @@ -1742,11 +1742,11 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; case AUDIO_F32SYS: - switch (channels) { + switch (channels) { case 1: case 2: f = _Eff_position_f32sys; @@ -1760,8 +1760,8 @@ static Mix_EffectFunc_t get_position_effect_func(Uint16 format, int channels) default: Mix_SetError("Unsupported audio channels"); break; - } - break; + } + break; default: Mix_SetError("Unsupported audio format"); @@ -1880,16 +1880,16 @@ static void set_amplitudes(int channels, int angle, int room_angle) speaker_amplitude[3] = (Uint8)right; } else if (room_angle == 180) { - if (channels == 2) { + if (channels == 2) { speaker_amplitude[0] = (Uint8)right; speaker_amplitude[1] = (Uint8)left; - } - else { + } + else { speaker_amplitude[0] = (Uint8)right_rear; speaker_amplitude[1] = (Uint8)left_rear; speaker_amplitude[2] = (Uint8)right; speaker_amplitude[3] = (Uint8)left; - } + } } else if (room_angle == 270) { speaker_amplitude[0] = (Uint8)right; @@ -1927,12 +1927,12 @@ int SDLCALLCC Mix_SetPanning(int channel, Uint8 left, Uint8 right) /* left = 255 => angle = -90; left = 0 => angle = +89 */ int angle = 0; if ((left != 255) || (right != 255)) { - angle = (int)left; + angle = (int)left; angle = 127 - angle; - angle = -angle; + angle = -angle; angle = angle * 90 / 128; /* Make it larger for more effect? */ } - return(Mix_SetPosition(channel, angle, 0)); + return Mix_SetPosition(channel, angle, 0); } f = get_position_effect_func(format, channels); @@ -1996,7 +1996,7 @@ int SDLCALLCC Mix_SetDistance(int channel, Uint8 distance) distance = 255 - distance; /* flip it to our scale. */ - /* it's a no-op; unregister the effect, if it's registered. */ + /* it's a no-op; unregister the effect, if it's registered. */ if ((distance == 255) && (args->left_u8 == 255) && (args->right_u8 == 255)) { if (args->in_use) { retval = _Mix_UnregisterEffect_locked(channel, f); @@ -2057,9 +2057,9 @@ int SDLCALLCC Mix_SetPosition(int channel, Sint16 angle, Uint8 distance) if (channels == 2) { - if (angle > 180) - room_angle = 180; /* exchange left and right channels */ - else room_angle = 0; + if (angle > 180) + room_angle = 180; /* exchange left and right channels */ + else room_angle = 0; } if (channels == 4 || channels == 6)