Skip to content

Commit

Permalink
effect_position.c, effect_stereoreverse.c: cleanup after commit 9781cbae
Browse files Browse the repository at this point in the history
  • Loading branch information
sezero committed Nov 18, 2019
1 parent 97ec657 commit 97bf92a
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 14 deletions.
26 changes: 13 additions & 13 deletions effect_position.c
Expand Up @@ -128,7 +128,7 @@ static void SDLCALL _Eff_position_u8(int chan, void *stream, int len, void *udat
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if ((size_t)len % sizeof (Uint16) != 0) {
if (len % (int)sizeof(Uint16) != 0) {
*ptr = (Uint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -166,7 +166,7 @@ static void SDLCALL _Eff_position_u8_c4(int chan, void *stream, int len, void *u
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if ((size_t)len % sizeof (Uint16) != 0) {
if (len % (int)sizeof(Uint16) != 0) {
*ptr = (Uint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -252,7 +252,7 @@ static void SDLCALL _Eff_position_u8_c6(int chan, void *stream, int len, void *u
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if ((size_t)len % sizeof (Uint16) != 0) {
if (len % (int)sizeof(Uint16) != 0) {
*ptr = (Uint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -384,7 +384,7 @@ static void SDLCALL _Eff_position_table_u8(int chan, void *stream, int len, void
* volume 255, and are therefore throwaways. Still, we have to
* be sure not to overrun the audio buffer...
*/
while ((size_t)len % sizeof (Uint32) != 0) {
while (len % (int)sizeof(Uint32) != 0) {
*ptr = d[l[*ptr]];
ptr++;
if (args->channels > 1) {
Expand Down Expand Up @@ -425,7 +425,7 @@ static void SDLCALL _Eff_position_s8(int chan, void *stream, int len, void *udat
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if (len % sizeof (Sint16) != 0) {
if (len % (int)sizeof(Sint16) != 0) {
*ptr = (Sint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -458,7 +458,7 @@ static void SDLCALL _Eff_position_s8_c4(int chan, void *stream, int len, void *u
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if ((size_t)len % sizeof (Sint16) != 0) {
if (len % (int)sizeof(Sint16) != 0) {
*ptr = (Sint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -505,7 +505,7 @@ static void SDLCALL _Eff_position_s8_c6(int chan, void *stream, int len, void *u
* a len divisible by 2 here), then left_f and right_f are always
* 1.0, and are therefore throwaways.
*/
if (len % sizeof (Sint16) != 0) {
if (len % (int)sizeof(Sint16) != 0) {
*ptr = (Sint8) (((float) *ptr) * args->distance_f);
ptr++;
len--;
Expand Down Expand Up @@ -578,8 +578,7 @@ static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void
r = temp;
}


while ((size_t)len % sizeof (Uint32) != 0) {
while (len % (int)sizeof(Uint32) != 0) {
*ptr = d[l[*ptr]];
ptr++;
if (args->channels > 1) {
Expand All @@ -605,8 +604,6 @@ static void SDLCALL _Eff_position_table_s8(int chan, void *stream, int len, void
#endif
++p;
}


}


Expand Down Expand Up @@ -759,10 +756,11 @@ static void SDLCALL _Eff_position_s16lsb(int chan, void *stream, int len, void *
volatile position_args *args = (volatile position_args *) udata;
Sint16 *ptr = (Sint16 *) stream;
int i;

MIX_UNUSED(chan);

#if 0
if (len % (sizeof(Sint16) * 2)) {
if (len % (int)(sizeof(Sint16) * 2)) {
fprintf(stderr,"Not an even number of frames! len=%d\n", len);
return;
}
Expand Down Expand Up @@ -1158,10 +1156,11 @@ static void SDLCALL _Eff_position_s32lsb(int chan, void *stream, int len, void *
volatile position_args *args = (volatile position_args *) udata;
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);

#if 0
if (len % (sizeof(Sint32) * 2)) {
if (len % (int)(sizeof(Sint32) * 2)) {
fprintf(stderr,"Not an even number of frames! len=%d\n", len);
return;
}
Expand Down Expand Up @@ -1354,6 +1353,7 @@ static void SDLCALL _Eff_position_s32msb_c6(int chan, void *stream, int len, voi
volatile position_args *args = (volatile position_args *) udata;
Sint32 *ptr = (Sint32 *) stream;
int i;

MIX_UNUSED(chan);

for (i = 0; i < len; i += sizeof (Sint32) * 6) {
Expand Down
5 changes: 4 additions & 1 deletion effect_stereoreverse.c
Expand Up @@ -61,6 +61,7 @@ static void SDLCALL _Eff_reversestereo32(int chan, void *stream, int len, void *
Uint32 *ptr = (Uint32 *) stream;
Uint32 tmp;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);

Expand All @@ -77,6 +78,7 @@ static void SDLCALL _Eff_reversestereo16(int chan, void *stream, int len, void *
/* 16 bits * 2 channels. */
Uint32 *ptr = (Uint32 *) stream;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);

Expand All @@ -91,11 +93,12 @@ static void SDLCALL _Eff_reversestereo8(int chan, void *stream, int len, void *u
/* 8 bits * 2 channels. */
Uint32 *ptr = (Uint32 *) stream;
int i;

MIX_UNUSED(chan);
MIX_UNUSED(udata);

/* get the last two bytes if len is not divisible by four... */
if ((size_t)len % sizeof (Uint32) != 0) {
if (len % (int)sizeof(Uint32) != 0) {
Uint16 *p = (Uint16 *) (((Uint8 *) stream) + (len - 2));
*p = (Uint16)((((*p) & 0xFF00) >> 8) | (((*ptr) & 0x00FF) << 8));
len -= 2;
Expand Down

0 comments on commit 97bf92a

Please sign in to comment.