Actually, my silly logic bug was actually correct. :/
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402048
This commit is contained in:
parent
3a09848855
commit
bb7ad968f9
3 changed files with 15 additions and 6 deletions
|
@ -227,11 +227,13 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
{
|
{
|
||||||
// int width;
|
// int width;
|
||||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||||
|
int valid_datatype = 1;
|
||||||
|
|
||||||
D(bug("AHI opening...\n"));
|
D(bug("AHI opening...\n"));
|
||||||
|
|
||||||
/* Determine the audio parameters from the AudioSpec */
|
/* Determine the audio parameters from the AudioSpec */
|
||||||
while (test_format) {
|
while ((!valid_datatype) && (test_format)) {
|
||||||
|
valid_datatype = 1;
|
||||||
switch (test_format) {
|
switch (test_format) {
|
||||||
case AUDIO_S8:
|
case AUDIO_S8:
|
||||||
D(bug("AUDIO_S8...\n"));
|
D(bug("AUDIO_S8...\n"));
|
||||||
|
@ -264,12 +266,13 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
valid_datatype = 0;
|
||||||
test_format = SDL_NextAudioFormat();
|
test_format = SDL_NextAudioFormat();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_format) { /* shouldn't happen, but just in case... */
|
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||||
SDL_SetError("Unsupported audio format");
|
SDL_SetError("Unsupported audio format");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -155,6 +155,7 @@ extern "C"
|
||||||
|
|
||||||
int BE_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
int BE_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
{
|
{
|
||||||
|
int valid_datatype = 0;
|
||||||
media_raw_audio_format format;
|
media_raw_audio_format format;
|
||||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||||
|
|
||||||
|
@ -163,7 +164,8 @@ extern "C"
|
||||||
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
|
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
|
||||||
format.frame_rate = (float) spec->freq;
|
format.frame_rate = (float) spec->freq;
|
||||||
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
|
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
|
||||||
while (test_format) {
|
while ((!valid_datatype) && (test_format)) {
|
||||||
|
valid_datatype = 1;
|
||||||
spec->format = test_format;
|
spec->format = test_format;
|
||||||
switch (test_format) {
|
switch (test_format) {
|
||||||
case AUDIO_S8:
|
case AUDIO_S8:
|
||||||
|
@ -202,6 +204,7 @@ extern "C"
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
valid_datatype = 0;
|
||||||
test_format = SDL_NextAudioFormat();
|
test_format = SDL_NextAudioFormat();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +212,7 @@ extern "C"
|
||||||
|
|
||||||
format.buffer_size = spec->samples;
|
format.buffer_size = spec->samples;
|
||||||
|
|
||||||
if (!test_format) { /* shouldn't happen, but just in case... */
|
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||||
SDL_SetError("Unsupported audio format");
|
SDL_SetError("Unsupported audio format");
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -75,6 +75,7 @@ int
|
||||||
DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
{
|
{
|
||||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||||
|
int valid_datatype = 0;
|
||||||
MCI_AMP_OPEN_PARMS AmpOpenParms;
|
MCI_AMP_OPEN_PARMS AmpOpenParms;
|
||||||
MCI_GENERIC_PARMS GenericParms;
|
MCI_GENERIC_PARMS GenericParms;
|
||||||
int iDeviceOrd = 0; // Default device to be used
|
int iDeviceOrd = 0; // Default device to be used
|
||||||
|
@ -109,8 +110,9 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
if (spec->channels > 2)
|
if (spec->channels > 2)
|
||||||
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
|
spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
|
||||||
|
|
||||||
while (test_format) {
|
while ((!valid_datatype) && (test_format)) {
|
||||||
spec->format = test_format;
|
spec->format = test_format;
|
||||||
|
valid_datatype = 1;
|
||||||
switch (test_format) {
|
switch (test_format) {
|
||||||
case AUDIO_U8:
|
case AUDIO_U8:
|
||||||
// Unsigned 8 bit audio data
|
// Unsigned 8 bit audio data
|
||||||
|
@ -127,12 +129,13 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
// !!! FIXME: int32?
|
// !!! FIXME: int32?
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
valid_datatype = 0;
|
||||||
test_format = SDL_NextAudioFormat();
|
test_format = SDL_NextAudioFormat();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!test_format) { // shouldn't happen, but just in case...
|
if (!valid_datatype) { // shouldn't happen, but just in case...
|
||||||
// Close DART, and exit with error code!
|
// Close DART, and exit with error code!
|
||||||
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
|
mciSendCommand(iDeviceOrd, MCI_CLOSE, MCI_WAIT, &GenericParms, 0);
|
||||||
SDL_SetError("Unsupported audio format");
|
SDL_SetError("Unsupported audio format");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue