Skip to content

Commit

Permalink
Small bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
pmandin committed Aug 30, 2003
1 parent 8341379 commit 75afd1c
Show file tree
Hide file tree
Showing 8 changed files with 76 additions and 94 deletions.
6 changes: 3 additions & 3 deletions src/audio/mint/SDL_mintaudio.c
Expand Up @@ -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 */
Expand Down
6 changes: 3 additions & 3 deletions src/audio/mint/SDL_mintaudio.h
Expand Up @@ -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 */
Expand Down
8 changes: 2 additions & 6 deletions src/audio/mint/SDL_mintaudio_dma8.c
Expand Up @@ -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));

Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down
17 changes: 7 additions & 10 deletions src/audio/mint/SDL_mintaudio_gsxb.c
Expand Up @@ -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));

Expand Down Expand Up @@ -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;
}
Expand All @@ -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));

Expand Down Expand Up @@ -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);
Expand Down
101 changes: 51 additions & 50 deletions src/audio/mint/SDL_mintaudio_it.S
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

8 changes: 2 additions & 6 deletions src/audio/mint/SDL_mintaudio_mcsn.c
Expand Up @@ -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));

Expand Down Expand Up @@ -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));

Expand Down Expand Up @@ -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);
Expand Down
16 changes: 6 additions & 10 deletions src/audio/mint/SDL_mintaudio_stfa.c
Expand Up @@ -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));

Expand All @@ -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));

Expand Down Expand Up @@ -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 */
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions src/audio/mint/SDL_mintaudio_xbios.c
Expand Up @@ -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));

Expand All @@ -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));

Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 75afd1c

Please sign in to comment.