Commit f7b2a985 authored by Ryan C. Gordon's avatar Ryan C. Gordon

MiNT audio driver cleanups for clamping types and channels to supported

 values. int32 support now available in one instance.

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402052
parent 43bec8da
...@@ -218,12 +218,17 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -218,12 +218,17 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i, masterprediv, sfreq; int i, masterprediv, sfreq;
unsigned long masterclock; unsigned long masterclock;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */ /* Check formats available */
spec->format = AUDIO_S8; spec->format = AUDIO_S8;
...@@ -269,9 +274,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -269,9 +274,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
......
...@@ -208,54 +208,86 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -208,54 +208,86 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
{ {
long snd_format; long snd_format;
int i, resolution, format_signed, format_bigendian; int i, resolution, format_signed, format_bigendian;
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
int valid_datatype = 0;
resolution = spec->format & 0x00ff; resolution = SDL_AUDIO_BITSIZE(spec->format);
format_signed = ((spec->format & 0x8000) != 0); format_signed = SDL_AUDIO_ISSIGNED(spec->format);
format_bigendian = ((spec->format & 0x1000) != 0); format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", resolution));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", format_signed));
DEBUG_PRINT(("big endian=%d, ", format_bigendian));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
while ((!valid_datatype) && (test_format)) {
spec->format = test_format;
switch (test_format) {
case AUDIO_U8:
case AUDIO_S8:
case AUDIO_U16LSB:
case AUDIO_S16LSB:
case AUDIO_U16MSB:
case AUDIO_S16MSB:
case AUDIO_S32LSB:
case AUDIO_S32MSB:
/* no float support... */
resolution = SDL_AUDIO_BITSIZE(spec->format);
format_signed = SDL_AUDIO_ISSIGNED(spec->format);
format_bigendian = SDL_AUDIO_ISBIGENDIAN(spec->format);
/* Check formats available */ /* Check formats available */
snd_format = Sndstatus(SND_QUERYFORMATS); snd_format = Sndstatus(SND_QUERYFORMATS);
switch (resolution) { switch (resolution) {
case 8: case 8:
if ((snd_format & SND_FORMAT8) == 0) { if (snd_format & SND_FORMAT8) {
SDL_SetError("Mint_CheckAudio: 8 bits samples not supported"); valid_datatype = 1;
return -1;
}
snd_format = Sndstatus(SND_QUERY8BIT); snd_format = Sndstatus(SND_QUERY8BIT);
}
break; break;
case 16: case 16:
if ((snd_format & SND_FORMAT16) == 0) { if (snd_format & SND_FORMAT16) {
SDL_SetError("Mint_CheckAudio: 16 bits samples not supported"); valid_datatype = 1;
return -1;
}
snd_format = Sndstatus(SND_QUERY16BIT); snd_format = Sndstatus(SND_QUERY16BIT);
}
break; break;
default: case 32:
SDL_SetError("Mint_CheckAudio: Unsupported sample resolution"); if (snd_format & SND_FORMAT32) {
return -1; valid_datatype = 1;
snd_format = Sndstatus(SND_QUERY32BIT);
}
break; break;
} }
break;
}
}
if (!valid_datatype) {
SDL_SetError("Unsupported audio format");
return (-1);
}
/* Check signed/unsigned format */ /* Check signed/unsigned format */
if (format_signed) { if (format_signed) {
if (snd_format & SND_FORMATSIGNED) { if (snd_format & SND_FORMATSIGNED) {
/* Ok */ /* Ok */
} else if (snd_format & SND_FORMATUNSIGNED) { } else if (snd_format & SND_FORMATUNSIGNED) {
/* Give unsigned format */ /* Give unsigned format */
spec->format = spec->format & (~0x8000); spec->format = spec->format & (~SDL_AUDIO_MASK_SIGNED);
} }
} else { } else {
if (snd_format & SND_FORMATUNSIGNED) { if (snd_format & SND_FORMATUNSIGNED) {
/* Ok */ /* Ok */
} else if (snd_format & SND_FORMATSIGNED) { } else if (snd_format & SND_FORMATSIGNED) {
/* Give signed format */ /* Give signed format */
spec->format |= 0x8000; spec->format |= SDL_AUDIO_MASK_SIGNED;
} }
} }
...@@ -264,14 +296,14 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -264,14 +296,14 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
/* Ok */ /* Ok */
} else if (snd_format & SND_FORMATLITTLEENDIAN) { } else if (snd_format & SND_FORMATLITTLEENDIAN) {
/* Give little endian format */ /* Give little endian format */
spec->format = spec->format & (~0x1000); spec->format = spec->format & (~SDL_AUDIO_MASK_ENDIAN);
} }
} else { } else {
if (snd_format & SND_FORMATLITTLEENDIAN) { if (snd_format & SND_FORMATLITTLEENDIAN) {
/* Ok */ /* Ok */
} else if (snd_format & SND_FORMATBIGENDIAN) { } else if (snd_format & SND_FORMATBIGENDIAN) {
/* Give big endian format */ /* Give big endian format */
spec->format |= 0x1000; spec->format |= SDL_AUDIO_MASK_ENDIAN;
} }
} }
...@@ -296,9 +328,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -296,9 +328,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
...@@ -319,7 +352,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -319,7 +352,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
Setmontracks(0); Setmontracks(0);
/* Select replay format */ /* Select replay format */
switch (spec->format & 0xff) { switch (SDL_AUDIO_BITSIZE(spec->format)) {
case 8: case 8:
if (spec->channels == 2) { if (spec->channels == 2) {
channels_mode = STEREO8; channels_mode = STEREO8;
...@@ -334,6 +367,13 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -334,6 +367,13 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
channels_mode = MONO16; channels_mode = MONO16;
} }
break; break;
case 32:
if (spec->channels == 2) {
channels_mode = STEREO32;
} else {
channels_mode = MONO32;
}
break;
default: default:
channels_mode = STEREO16; channels_mode = STEREO16;
break; break;
......
...@@ -225,18 +225,23 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -225,18 +225,23 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i; int i;
unsigned long masterclock, masterprediv; unsigned long masterclock, masterprediv;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */ /* Check formats available */
MINTAUDIO_freqcount = 0; MINTAUDIO_freqcount = 0;
switch (cookie_mcsn->play) { switch (cookie_mcsn->play) {
case MCSN_ST: case MCSN_ST:
spec->channels = 1; spec->channels = 1;
spec->format = 8; /* FIXME: is it signed or unsigned ? */ spec->format = AUDIO_S8; /* FIXME: is it signed or unsigned ? */
SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1); SDL_MintAudio_AddFrequency(this, 12500, 0, 0, -1);
break; break;
case MCSN_TT: /* Also STE, Mega STE */ case MCSN_TT: /* Also STE, Mega STE */
...@@ -274,9 +279,9 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -274,9 +279,9 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
(1 << i) - 1, -1); (1 << i) - 1, -1);
} }
} }
spec->format |= 0x8000; /* Audio is always signed */ spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
if ((spec->format & 0x00ff) == 16) { if ((SDL_AUDIO_BITSIZE(spec->format)) == 16) {
spec->format |= 0x1000; /* Audio is always big endian */ spec->format |= SDL_AUDIO_MASK_ENDIAN; /* Audio is always big endian */
spec->channels = 2; /* 16 bits always stereo */ spec->channels = 2; /* 16 bits always stereo */
} }
break; break;
...@@ -294,9 +299,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -294,9 +299,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
...@@ -321,7 +327,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -321,7 +327,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
/* Select replay format */ /* Select replay format */
channels_mode = STEREO16; channels_mode = STEREO16;
switch (spec->format & 0xff) { switch (SDL_AUDIO_BITSIZE(spec->format)) {
case 8: case 8:
if (spec->channels == 2) { if (spec->channels == 2) {
channels_mode = STEREO8; channels_mode = STEREO8;
......
...@@ -206,12 +206,21 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -206,12 +206,21 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
{ {
int i; int i;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
if (SDL_AUDIO_BITSIZE(spec->format) > 16) {
spec->format = AUDIO_S16SYS; /* clamp out int32/float32 ... */
}
if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
}
/* Check formats available */ /* Check formats available */
MINTAUDIO_freqcount = 0; MINTAUDIO_freqcount = 0;
for (i = 0; i < 16; i++) { for (i = 0; i < 16; i++) {
...@@ -230,9 +239,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -230,9 +239,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
...@@ -255,7 +265,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -255,7 +265,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
/* Select replay format */ /* Select replay format */
cookie_stfa->sound_control = cookie_stfa->sound_control =
MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor; MINTAUDIO_frequencies[MINTAUDIO_numfreq].predivisor;
if ((spec->format & 0xff) == 8) { if (SDL_AUDIO_BITSIZE(spec->format) == 8) {
cookie_stfa->sound_control |= STFA_FORMAT_8BIT; cookie_stfa->sound_control |= STFA_FORMAT_8BIT;
} else { } else {
cookie_stfa->sound_control |= STFA_FORMAT_16BIT; cookie_stfa->sound_control |= STFA_FORMAT_16BIT;
...@@ -265,12 +275,12 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -265,12 +275,12 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
} else { } else {
cookie_stfa->sound_control |= STFA_FORMAT_MONO; cookie_stfa->sound_control |= STFA_FORMAT_MONO;
} }
if ((spec->format & 0x8000) != 0) { if (SDL_AUDIO_ISSIGNED(spec->format) != 0) {
cookie_stfa->sound_control |= STFA_FORMAT_SIGNED; cookie_stfa->sound_control |= STFA_FORMAT_SIGNED;
} else { } else {
cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED; cookie_stfa->sound_control |= STFA_FORMAT_UNSIGNED;
} }
if ((spec->format & 0x1000) != 0) { if (SDL_AUDIO_ISBIGENDIAN(spec->format) != 0) {
cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN; cookie_stfa->sound_control |= STFA_FORMAT_BIGENDIAN;
} else { } else {
cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN; cookie_stfa->sound_control |= STFA_FORMAT_LITENDIAN;
......
...@@ -359,16 +359,21 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -359,16 +359,21 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
int i; int i;
Uint32 extclock; Uint32 extclock;
DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "asked: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
spec->format |= 0x8000; /* Audio is always signed */ spec->format |= SDL_AUDIO_MASK_SIGNED; /* Audio is always signed */
if ((spec->format & 0x00ff) == 16) {
spec->format |= 0x1000; /* Audio is always big endian */ /* clamp out int32/float32 */
if (SDL_AUDIO_BITSIZE(spec->format) >= 16) {
spec->format = AUDIO_S16MSB; /* Audio is always big endian */
spec->channels = 2; /* 16 bits always stereo */ spec->channels = 2; /* 16 bits always stereo */
} else if (spec->channels > 2) {
spec->channels = 2; /* no more than stereo! */
} }
MINTAUDIO_freqcount = 0; MINTAUDIO_freqcount = 0;
...@@ -400,9 +405,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec) ...@@ -400,9 +405,10 @@ Mint_CheckAudio(_THIS, SDL_AudioSpec * spec)
MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq); MINTAUDIO_numfreq = SDL_MintAudio_SearchFrequency(this, spec->freq);
spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency; spec->freq = MINTAUDIO_frequencies[MINTAUDIO_numfreq].frequency;
DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", spec->format & 0x00ff)); DEBUG_PRINT((DEBUG_NAME "obtained: %d bits, ", SDL_AUDIO_BITSIZE(spec->format)));
DEBUG_PRINT(("signed=%d, ", ((spec->format & 0x8000) != 0))); DEBUG_PRINT(("float=%d, ", SDL_AUDIO_ISFLOAT(spec->format)));
DEBUG_PRINT(("big endian=%d, ", ((spec->format & 0x1000) != 0))); DEBUG_PRINT(("signed=%d, ", SDL_AUDIO_ISSIGNED(spec->format)));
DEBUG_PRINT(("big endian=%d, ", SDL_AUDIO_ISBIGENDIAN(spec->format)));
DEBUG_PRINT(("channels=%d, ", spec->channels)); DEBUG_PRINT(("channels=%d, ", spec->channels));
DEBUG_PRINT(("freq=%d\n", spec->freq)); DEBUG_PRINT(("freq=%d\n", spec->freq));
...@@ -427,7 +433,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec) ...@@ -427,7 +433,7 @@ Mint_InitAudio(_THIS, SDL_AudioSpec * spec)
/* Select replay format */ /* Select replay format */
channels_mode = STEREO16; channels_mode = STEREO16;
switch (spec->format & 0xff) { switch (SDL_AUDIO_BITSIZE(spec->format)) {
case 8: case 8:
if (spec->channels == 2) { if (spec->channels == 2) {
channels_mode = STEREO8; channels_mode = STEREO8;
......
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