Commit 1f63d96b authored by Ryan C. Gordon's avatar Ryan C. Gordon

Let OS/2 DART backend use SDL converters at a higher level (would fail if

 DART didn't directly support AudioSpec before).

--HG--
extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402046
parent 2bd800db
...@@ -74,6 +74,7 @@ DARTEventFunc(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags) ...@@ -74,6 +74,7 @@ DARTEventFunc(ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags)
int int
DART_OpenAudio(_THIS, SDL_AudioSpec * spec) DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
{ {
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
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
...@@ -105,25 +106,39 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec) ...@@ -105,25 +106,39 @@ DART_OpenAudio(_THIS, SDL_AudioSpec * spec)
iDeviceOrd = AmpOpenParms.usDeviceID; iDeviceOrd = AmpOpenParms.usDeviceID;
// Determine the audio parameters from the AudioSpec // Determine the audio parameters from the AudioSpec
switch (spec->format & 0xFF) { if (spec->channels > 2)
case 8: spec->channels = 2; // !!! FIXME: more than stereo support in OS/2?
/* Unsigned 8 bit audio data */
spec->format = AUDIO_U8; while (test_format) {
spec->format = test_format;
switch (test_format) {
case AUDIO_U8:
// Unsigned 8 bit audio data
iSilence = 0x80; iSilence = 0x80;
iBits = 8; iBits = 8;
break; break;
case 16:
/* Signed 16 bit audio data */ case AUDIO_S16LSB:
spec->format = AUDIO_S16; // Signed 16 bit audio data
iSilence = 0x00; iSilence = 0x00;
iBits = 16; iBits = 16;
break; break;
// !!! FIXME: int32?
default: default:
test_format = SDL_NextAudioFormat();
break;
}
}
if (!test_format) { // 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");
return (-1); return (-1);
} }
iFreq = spec->freq; iFreq = spec->freq;
iChannels = spec->channels; iChannels = spec->channels;
/* Update the fragment size as size in bytes */ /* Update the fragment size as size in bytes */
......
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