Fixed silly logic thing.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402045
This commit is contained in:
parent
558a5b6909
commit
2bd800db0e
2 changed files with 4 additions and 17 deletions
|
@ -227,16 +227,14 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
{
|
||||
// int width;
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||
int valid_datatype = 0;
|
||||
|
||||
D(bug("AHI opening...\n"));
|
||||
|
||||
/* Determine the audio parameters from the AudioSpec */
|
||||
while ((!valid_datatype) && (test_format)) {
|
||||
while (test_format) {
|
||||
switch (test_format) {
|
||||
case AUDIO_S8:
|
||||
D(bug("AUDIO_S8...\n"));
|
||||
valid_datatype = 1;
|
||||
spec->format = AUDIO_S8;
|
||||
this->hidden->bytespersample = 1;
|
||||
if (spec->channels < 2)
|
||||
|
@ -247,7 +245,6 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
|
||||
case AUDIO_S16MSB:
|
||||
D(bug("AUDIO_S16MSB...\n"));
|
||||
valid_datatype = 1;
|
||||
spec->format = AUDIO_S16MSB;
|
||||
this->hidden->bytespersample = 2;
|
||||
if (spec->channels < 2)
|
||||
|
@ -258,7 +255,6 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
|
||||
case AUDIO_S32MSB:
|
||||
D(bug("AUDIO_S32MSB...\n"));
|
||||
valid_datatype = 1;
|
||||
spec->format = AUDIO_S32MSB;
|
||||
this->hidden->bytespersample = 4;
|
||||
if (spec->channels < 2)
|
||||
|
@ -273,7 +269,7 @@ AHI_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
|||
}
|
||||
}
|
||||
|
||||
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||
if (!test_format) { /* shouldn't happen, but just in case... */
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return (-1);
|
||||
}
|
||||
|
|
|
@ -157,55 +157,46 @@ extern "C"
|
|||
{
|
||||
media_raw_audio_format format;
|
||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||
int valid_datatype = 0;
|
||||
|
||||
/* Parse the audio format and fill the Be raw audio format */
|
||||
memset(&format, '\0', sizeof (media_raw_audio_format));
|
||||
format.byte_order = B_MEDIA_LITTLE_ENDIAN;
|
||||
format.frame_rate = (float) spec->freq;
|
||||
format.channel_count = spec->channels; /* !!! FIXME: support > 2? */
|
||||
while ((!valid_datatype) && (test_format)) {
|
||||
while (test_format) {
|
||||
spec->format = test_format;
|
||||
switch (test_format) {
|
||||
case AUDIO_S8:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_CHAR;
|
||||
break;
|
||||
|
||||
case AUDIO_U8:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_UCHAR;
|
||||
break;
|
||||
|
||||
case AUDIO_S16LSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_SHORT;
|
||||
break;
|
||||
|
||||
case AUDIO_S16MSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_SHORT;
|
||||
format.byte_order = B_MEDIA_BIG_ENDIAN;
|
||||
break;
|
||||
|
||||
case AUDIO_S32LSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_INT;
|
||||
break;
|
||||
|
||||
case AUDIO_S32MSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_INT;
|
||||
format.byte_order = B_MEDIA_BIG_ENDIAN;
|
||||
break;
|
||||
|
||||
case AUDIO_F32LSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
break;
|
||||
|
||||
case AUDIO_F32MSB:
|
||||
valid_datatype = 1;
|
||||
format.format = media_raw_audio_format::B_AUDIO_FLOAT;
|
||||
format.byte_order = B_MEDIA_BIG_ENDIAN;
|
||||
break;
|
||||
|
@ -218,7 +209,7 @@ extern "C"
|
|||
|
||||
format.buffer_size = spec->samples;
|
||||
|
||||
if (!valid_datatype) { /* shouldn't happen, but just in case... */
|
||||
if (!test_format) { /* shouldn't happen, but just in case... */
|
||||
SDL_SetError("Unsupported audio format");
|
||||
return (-1);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue