From 12f0b4de7512594b2d7cb352779bf6ea9ee2afa7 Mon Sep 17 00:00:00 2001
From: Ozkan Sezer <[EMAIL REDACTED]>
Date: Wed, 13 Jul 2022 20:10:50 +0300
Subject: [PATCH] whitespace fixes in effect_position.c
---
src/effect_position.c | 81 ++++++++++++++++++++++++-------------------
1 file changed, 46 insertions(+), 35 deletions(-)
diff --git a/src/effect_position.c b/src/effect_position.c
index 65fd1e6a..59f89b82 100644
--- a/src/effect_position.c
+++ b/src/effect_position.c
@@ -130,8 +130,8 @@ static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udat
len--;
}
- if (((position_args *)udata)->room_angle == 180)
- for (i = 0; i < len; i += sizeof (Uint8) * 2) {
+ if (((position_args *)udata)->room_angle == 180) {
+ for (i = 0; i < len; i += sizeof (Uint8) * 2) {
/* must adjust the sample so that 0 is the center */
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* right_f) * dist_f) + 128);
@@ -139,8 +139,10 @@ static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udat
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* left_f) * dist_f) + 128);
ptr++;
+ }
}
- else for (i = 0; i < len; i += sizeof (Uint8) * 2) {
+ else {
+ for (i = 0; i < len; i += sizeof (Uint8) * 2) {
/* must adjust the sample so that 0 is the center */
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* left_f) * dist_f) + 128);
@@ -148,6 +150,7 @@ static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udat
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* right_f) * dist_f) + 128);
ptr++;
+ }
}
}
@@ -170,8 +173,8 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
len--;
}
- if (args->room_angle == 0)
- for (i = 0; i < len; i += sizeof (Uint8) * 4) {
+ if (args->room_angle == 0) {
+ 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);
@@ -185,9 +188,10 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->right_rear_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 90)
- for (i = 0; i < len; i += sizeof (Uint8) * 4) {
+ else if (args->room_angle == 90) {
+ 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);
@@ -201,9 +205,10 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->left_rear_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 180)
- for (i = 0; i < len; i += sizeof (Uint8) * 4) {
+ else if (args->room_angle == 180) {
+ 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);
@@ -217,9 +222,10 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->left_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 270)
- for (i = 0; i < len; i += sizeof (Uint8) * 4) {
+ else if (args->room_angle == 270) {
+ 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);
@@ -233,6 +239,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->right_f) * args->distance_f) + 128);
ptr++;
+ }
}
}
@@ -256,8 +263,8 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
len--;
}
- if (args->room_angle == 0)
- for (i = 0; i < len; i += sizeof (Uint8) * 6) {
+ if (args->room_angle == 0) {
+ for (i = 0; i < len; i += sizeof (Uint8) * 6) {
/* must adjust the sample so that 0 is the center */
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->left_f) * args->distance_f) + 128);
@@ -277,9 +284,10 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->lfe_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 90)
- for (i = 0; i < len; i += sizeof (Uint8) * 6) {
+ else if (args->room_angle == 90) {
+ for (i = 0; i < len; i += sizeof (Uint8) * 6) {
/* must adjust the sample so that 0 is the center */
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->right_f) * args->distance_f) + 128);
@@ -301,9 +309,10 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->lfe_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 180)
- for (i = 0; i < len; i += sizeof (Uint8) * 6) {
+ else if (args->room_angle == 180) {
+ for (i = 0; i < len; i += sizeof (Uint8) * 6) {
/* 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);
@@ -325,9 +334,10 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->lfe_f) * args->distance_f) + 128);
ptr++;
+ }
}
- else if (args->room_angle == 270)
- for (i = 0; i < len; i += sizeof (Uint8) * 6) {
+ else if (args->room_angle == 270) {
+ for (i = 0; i < len; i += sizeof (Uint8) * 6) {
/* 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);
@@ -349,6 +359,7 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
*ptr = (Uint8) ((Sint8) ((((float) (Sint8) (*ptr - 128))
* args->lfe_f) * args->distance_f) + 128);
ptr++;
+ }
}
}
@@ -433,19 +444,21 @@ static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udat
len--;
}
- if (((position_args *)udata)->room_angle == 180)
- for (i = 0; i < len; i += sizeof (Sint8) * 2) {
+ if (((position_args *)udata)->room_angle == 180) {
+ for (i = 0; i < len; i += sizeof (Sint8) * 2) {
*ptr = (Sint8)((((float) *ptr) * right_f) * dist_f);
ptr++;
*ptr = (Sint8)((((float) *ptr) * left_f) * dist_f);
ptr++;
+ }
}
- else
- for (i = 0; i < len; i += sizeof (Sint8) * 2) {
+ else {
+ for (i = 0; i < len; i += sizeof (Sint8) * 2) {
*ptr = (Sint8)((((float) *ptr) * left_f) * dist_f);
ptr++;
*ptr = (Sint8)((((float) *ptr) * right_f) * dist_f);
ptr++;
+ }
}
}
static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *udata)
@@ -469,25 +482,25 @@ static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *u
for (i = 0; i < len; i += sizeof (Sint8) * 4) {
switch (args->room_angle) {
- case 0:
+ case 0:
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
break;
- case 90:
+ case 90:
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
break;
- case 180:
+ case 180:
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
break;
- case 270:
+ case 270:
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
@@ -518,7 +531,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
for (i = 0; i < len; i += sizeof (Sint8) * 6) {
switch (args->room_angle) {
- case 0:
+ case 0:
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
@@ -526,7 +539,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
*ptr = (Sint8)((((float) *ptr) * args->center_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
break;
- case 90:
+ case 90:
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
@@ -535,7 +548,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
+ (Sint8)((((float) *ptr) * args->right_f) * args->distance_f / 2); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
break;
- case 180:
+ case 180:
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_f) * args->distance_f); ptr++;
@@ -544,7 +557,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
+ (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f / 2); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->lfe_f) * args->distance_f); ptr++;
break;
- case 270:
+ case 270:
*ptr = (Sint8)((((float) *ptr) * args->left_rear_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->left_f) * args->distance_f); ptr++;
*ptr = (Sint8)((((float) *ptr) * args->right_rear_f) * args->distance_f); ptr++;
@@ -2086,15 +2099,13 @@ int Mix_SetPosition(int channel, Sint16 angle, Uint8 distance)
}
}
- if (channels == 2)
- {
+ if (channels == 2) {
if (angle > 180)
room_angle = 180; /* exchange left and right channels */
else room_angle = 0;
}
- if (channels == 4 || channels == 6)
- {
+ if (channels == 4 || channels == 6) {
if (angle > 315) room_angle = 0;
else if (angle > 225) room_angle = 270;
else if (angle > 135) room_angle = 180;