Commit f9ec6072 authored by Patrice Mandin's avatar Patrice Mandin

Small bugfixes

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%40705
parent d5e201c8
......@@ -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 */
......
......@@ -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 */
......
......@@ -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);
......
......@@ -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);
......
......@@ -62,27 +62,27 @@ _SDL_MintAudio_GsxbInterrupt:
notw _SDL_MintAudio_mutex
/* Swap buffers */
moveml d0-d2/a0-a2,sp@-
eorw #1,_SDL_MintAudio_numbuf
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
moveml d0-d2/a0-a2,sp@-
/* 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 */
moveml d0-d2/a0-a2,sp@-
eorw #1,_SDL_MintAudio_numbuf
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
moveml d0-d2/a0-a2,sp@-
/* 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 */
moveml d0-d1/a0-a1,sp@-
eorw #1,_SDL_MintAudio_numbuf
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
moveml d0-d1/a0-a1,sp@-
/* 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 */
moveml d0-d1/a0-a1,sp@-
eorw #1,_SDL_MintAudio_numbuf
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
moveml d0-d1/a0-a1,sp@-
/* 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
......@@ -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);
......
......@@ -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);
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment