diff --git a/src/audio/mint/SDL_mintaudio.c b/src/audio/mint/SDL_mintaudio.c index 99a99c614..cc997c098 100644 --- a/src/audio/mint/SDL_mintaudio.c +++ b/src/audio/mint/SDL_mintaudio.c @@ -38,9 +38,9 @@ SDL_AudioDevice *SDL_MintAudio_device; Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */ -long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ -long SDL_MintAudio_numbuf; /* Buffer to play */ -long SDL_MintAudio_mutex; +unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ +unsigned short SDL_MintAudio_numbuf; /* Buffer to play */ +unsigned short SDL_MintAudio_mutex; cookie_stfa_t *SDL_MintAudio_stfa; /* The callback function, called by each driver whenever needed */ diff --git a/src/audio/mint/SDL_mintaudio.h b/src/audio/mint/SDL_mintaudio.h index 5e6a0a7e6..680228f5c 100644 --- a/src/audio/mint/SDL_mintaudio.h +++ b/src/audio/mint/SDL_mintaudio.h @@ -106,9 +106,9 @@ enum { /* Variables */ extern SDL_AudioDevice *SDL_MintAudio_device; extern Uint8 *SDL_MintAudio_audiobuf[2]; /* Pointers to buffers */ -extern long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ -extern long SDL_MintAudio_numbuf; /* Buffer to play */ -extern long SDL_MintAudio_mutex; +extern unsigned long SDL_MintAudio_audiosize; /* Length of audio buffer=spec->size */ +extern unsigned short SDL_MintAudio_numbuf; /* Buffer to play */ +extern unsigned short SDL_MintAudio_mutex; extern cookie_stfa_t *SDL_MintAudio_stfa; /* Functions */ diff --git a/src/audio/mint/SDL_mintaudio_dma8.c b/src/audio/mint/SDL_mintaudio_dma8.c index e285128e4..f6d7b0d5c 100644 --- a/src/audio/mint/SDL_mintaudio_dma8.c +++ b/src/audio/mint/SDL_mintaudio_dma8.c @@ -223,7 +223,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -263,7 +263,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -327,10 +327,6 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); /* Allocate memory for audio buffers in DMA-able RAM */ - spec->size = spec->samples; - spec->size *= spec->channels; - spec->size *= (spec->format & 0xFF)/8; - DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); diff --git a/src/audio/mint/SDL_mintaudio_gsxb.c b/src/audio/mint/SDL_mintaudio_gsxb.c index 0caf28e2e..29a344a10 100644 --- a/src/audio/mint/SDL_mintaudio_gsxb.c +++ b/src/audio/mint/SDL_mintaudio_gsxb.c @@ -214,9 +214,10 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) resolution = spec->format & 0x00ff; format_signed = ((spec->format & 0x8000)!=0); format_bigendian = ((spec->format & 0x1000)!=0); - DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",resolution)); - DEBUG_PRINT(("signed=%d, ", format_signed)); - DEBUG_PRINT(("big endian=%d, ", format_bigendian)); + + DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); + DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -268,9 +269,9 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) spec->format = spec->format & (~0x1000); } } else { - if (snd_format & SND_FORMATBIGENDIAN) { + if (snd_format & SND_FORMATLITTLEENDIAN) { /* Ok */ - } else if (snd_format & SND_FORMATLITTLEENDIAN) { + } else if (snd_format & SND_FORMATBIGENDIAN) { /* Give big endian format */ spec->format |= 0x1000; } @@ -289,7 +290,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -368,10 +369,6 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); /* Allocate memory for audio buffers in DMA-able RAM */ - spec->size = spec->samples; - spec->size *= spec->channels; - spec->size *= (spec->format & 0xFF)/8; - DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); diff --git a/src/audio/mint/SDL_mintaudio_it.S b/src/audio/mint/SDL_mintaudio_it.S index a6a999f83..2ac0353c5 100644 --- a/src/audio/mint/SDL_mintaudio_it.S +++ b/src/audio/mint/SDL_mintaudio_it.S @@ -62,27 +62,27 @@ _SDL_MintAudio_GsxbInterrupt: notw _SDL_MintAudio_mutex /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + moveml d0-d2/a0-a2,sp@- - movel _SDL_MintAudio_numbuf,d0 - movel _SDL_MintAudio_audiobuf,a0 - eorl #1,d0 - beqs SDL_MintAudio_GsxbBuffer0 - movel _SDL_MintAudio_audiobuf+4,a0 -SDL_MintAudio_GsxbBuffer0: - movel d0,_SDL_MintAudio_numbuf - /* Callback */ - movel a0,sp@- jsr _SDL_MintAudio_Callback - movel sp@+,a0 - /* Setbuffer xbios function */ + /* Set new buffer */ + + moveq #0,d0 movel _SDL_MintAudio_audiosize,d1 - lea a0@(0,d1:l),a1 + movew _SDL_MintAudio_numbuf,d0 + lsll #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:l),a1 + + lea a1@(d1:l),a2 + + movel a2,sp@- movel a1,sp@- - movel a0,sp@- clrw sp@- movew #131,sp@- trap #14 @@ -110,27 +110,27 @@ _SDL_MintAudio_XbiosInterrupt: notw _SDL_MintAudio_mutex /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + moveml d0-d2/a0-a2,sp@- - movel _SDL_MintAudio_numbuf,d0 - movel _SDL_MintAudio_audiobuf,a0 - eorl #1,d0 - beqs SDL_MintAudio_XbiosBuffer0 - movel _SDL_MintAudio_audiobuf+4,a0 -SDL_MintAudio_XbiosBuffer0: - movel d0,_SDL_MintAudio_numbuf - /* Callback */ - movel a0,sp@- jsr _SDL_MintAudio_Callback - movel sp@+,a0 - /* Setbuffer xbios function */ + /* Set new buffer */ + + moveq #0,d0 movel _SDL_MintAudio_audiosize,d1 - lea a0@(0,d1:l),a1 + movew _SDL_MintAudio_numbuf,d0 + lsll #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:l),a1 + + lea a1@(d1:l),a2 + + movel a2,sp@- movel a1,sp@- - movel a0,sp@- clrw sp@- movew #131,sp@- trap #14 @@ -158,20 +158,21 @@ _SDL_MintAudio_Dma8Interrupt: notw _SDL_MintAudio_mutex /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + moveml d0-d1/a0-a1,sp@- - movel _SDL_MintAudio_numbuf,d0 - movel _SDL_MintAudio_audiobuf,d1 - eorl #1,d0 - beqs SDL_MintAudio_Dma8Buffer0 - movel _SDL_MintAudio_audiobuf+4,d1 -SDL_MintAudio_Dma8Buffer0: - movel d0,_SDL_MintAudio_numbuf - /* Callback */ - movel d1,sp@- jsr _SDL_MintAudio_Callback - movel sp@+,d1 + + /* Set new buffer */ + + moveq #0,d0 + + movew _SDL_MintAudio_numbuf,d0 + lslw #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:w),d1 /* Modify DMA addresses */ lea 0xffff8900:w,a0 @@ -213,30 +214,30 @@ _SDL_MintAudio_StfaInterrupt: notw _SDL_MintAudio_mutex /* Swap buffers */ + eorw #1,_SDL_MintAudio_numbuf + moveml d0-d1/a0-a1,sp@- - movel _SDL_MintAudio_numbuf,d0 - movel _SDL_MintAudio_audiobuf,d1 - eorl #1,d0 - beqs SDL_MintAudio_StfaBuffer0 - movel _SDL_MintAudio_audiobuf+4,d1 -SDL_MintAudio_StfaBuffer0: - movel d0,_SDL_MintAudio_numbuf - /* Callback */ - movel d1,sp@- jsr _SDL_MintAudio_Callback - movel sp@+,d1 + + /* Set new buffer */ + + moveq #0,d0 + movel _SDL_MintAudio_stfa,a1 + + movew _SDL_MintAudio_numbuf,d0 + lslw #2,d0 + lea _SDL_MintAudio_audiobuf,a0 + movel a0@(d0:w),d1 /* Modify STFA replay buffers */ - movel _SDL_MintAudio_stfa,a0 - movel d1,a0@(STFA_SOUND_START) + movel d1,a1@(STFA_SOUND_START) addl _SDL_MintAudio_audiosize,d1 - movel d1,a0@(STFA_SOUND_END) + movel d1,a1@(STFA_SOUND_END) moveml sp@+,d0-d1/a0-a1 clrw _SDL_MintAudio_mutex SDL_MintAudio_StfaEnd: rte - diff --git a/src/audio/mint/SDL_mintaudio_mcsn.c b/src/audio/mint/SDL_mintaudio_mcsn.c index e27f727bb..57c37db40 100644 --- a/src/audio/mint/SDL_mintaudio_mcsn.c +++ b/src/audio/mint/SDL_mintaudio_mcsn.c @@ -212,7 +212,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -263,7 +263,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -352,10 +352,6 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); /* Allocate memory for audio buffers in DMA-able RAM */ - spec->size = spec->samples; - spec->size *= spec->channels; - spec->size *= (spec->format & 0xFF)/8; - DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); diff --git a/src/audio/mint/SDL_mintaudio_stfa.c b/src/audio/mint/SDL_mintaudio_stfa.c index 33a0ec90d..8a9fb7682 100644 --- a/src/audio/mint/SDL_mintaudio_stfa.c +++ b/src/audio/mint/SDL_mintaudio_stfa.c @@ -206,7 +206,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -223,7 +223,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -254,15 +254,15 @@ static void Mint_InitAudio(_THIS, SDL_AudioSpec *spec) } else { cookie_stfa->sound_control |= STFA_FORMAT_MONO; } - if (spec->format & 0x8000) { + if ((spec->format & 0x8000)!=0) { cookie_stfa->sound_control |= STFA_FORMAT_SIGNED; } else { cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED; } - if (spec->format & 0x1000) { - cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; - } else { + if ((spec->format & 0x1000)!=0) { cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN; + } else { + cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; } /* Set buffer */ @@ -292,10 +292,6 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); /* Allocate memory for audio buffers in DMA-able RAM */ - spec->size = spec->samples; - spec->size *= spec->channels; - spec->size *= (spec->format & 0xFF)/8; - DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM); diff --git a/src/audio/mint/SDL_mintaudio_xbios.c b/src/audio/mint/SDL_mintaudio_xbios.c index 708666edd..748f5936b 100644 --- a/src/audio/mint/SDL_mintaudio_xbios.c +++ b/src/audio/mint/SDL_mintaudio_xbios.c @@ -192,7 +192,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -215,7 +215,7 @@ static int Mint_CheckAudio(_THIS, SDL_AudioSpec *spec) DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ",spec->format & 0x00ff)); DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000)!=0))); - DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x8000)!=0))); + DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000)!=0))); DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("freq=%d\n", spec->freq)); @@ -292,10 +292,6 @@ static int Mint_OpenAudio(_THIS, SDL_AudioSpec *spec) SDL_CalculateAudioSpec(spec); /* Allocate memory for audio buffers in DMA-able RAM */ - spec->size = spec->samples; - spec->size *= spec->channels; - spec->size *= (spec->format & 0xFF)/8; - DEBUG_PRINT((DEBUG_NAME "buffer size=%d\n", spec->size)); SDL_MintAudio_audiobuf[0] = Atari_SysMalloc(spec->size *2, MX_STRAM);