Compile fixes.
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%402064
This commit is contained in:
parent
2f00844dab
commit
0d6e6d5c9c
1 changed files with 17 additions and 19 deletions
|
@ -207,21 +207,20 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
Component comp;
|
Component comp;
|
||||||
ComponentDescription desc;
|
ComponentDescription desc;
|
||||||
struct AudioUnitInputCallback callback;
|
struct AudioUnitInputCallback callback;
|
||||||
AudioStreamBasicDescription desc;
|
AudioStreamBasicDescription strdesc;
|
||||||
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
SDL_AudioFormat test_format = SDL_FirstAudioFormat(spec->format);
|
||||||
int valid_datatype = 0;
|
int valid_datatype = 0;
|
||||||
|
|
||||||
/* Setup a AudioStreamBasicDescription with the requested format */
|
/* Setup a AudioStreamBasicDescription with the requested format */
|
||||||
memset(&desc, '\0', sizeof (AudioStreamBasicDescription));
|
memset(&strdesc, '\0', sizeof (AudioStreamBasicDescription));
|
||||||
desc.mFormatID = kAudioFormatLinearPCM;
|
strdesc.mFormatID = kAudioFormatLinearPCM;
|
||||||
desc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
|
strdesc.mFormatFlags = kLinearPCMFormatFlagIsPacked;
|
||||||
desc.mChannelsPerFrame = spec->channels;
|
strdesc.mChannelsPerFrame = spec->channels;
|
||||||
desc.mSampleRate = spec->freq;
|
strdesc.mSampleRate = spec->freq;
|
||||||
desc.mFramesPerPacket = 1;
|
strdesc.mFramesPerPacket = 1;
|
||||||
|
|
||||||
while ((!valid_datatype) && (test_format)) {
|
while ((!valid_datatype) && (test_format)) {
|
||||||
spec->format = test_format;
|
spec->format = test_format;
|
||||||
desc.mFormatFlags = 0;
|
|
||||||
/* Just a list of valid SDL formats, so people don't pass junk here. */
|
/* Just a list of valid SDL formats, so people don't pass junk here. */
|
||||||
switch (test_format) {
|
switch (test_format) {
|
||||||
case AUDIO_U8:
|
case AUDIO_U8:
|
||||||
|
@ -235,15 +234,14 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
case AUDIO_F32LSB:
|
case AUDIO_F32LSB:
|
||||||
case AUDIO_F32MSB:
|
case AUDIO_F32MSB:
|
||||||
valid_datatype = 1;
|
valid_datatype = 1;
|
||||||
desc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
|
strdesc.mBitsPerChannel = SDL_AUDIO_BITSIZE(spec->format);
|
||||||
|
if (SDL_AUDIO_ISBIGENDIAN(spec->format))
|
||||||
|
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
|
||||||
|
|
||||||
if (SDL_AUDIO_ISFLOAT(spec->format))
|
if (SDL_AUDIO_ISFLOAT(spec->format))
|
||||||
desc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
|
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsFloat;
|
||||||
else if (SDL_AUDIO_ISSIGNED(spec->format))
|
else if (SDL_AUDIO_ISSIGNED(spec->format))
|
||||||
desc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
strdesc.mFormatFlags |= kLinearPCMFormatFlagIsSignedInteger;
|
||||||
|
|
||||||
if (SDL_AUDIO_ISBIGENDIAN(spec->format))
|
|
||||||
desc.mFormatFlags |= kLinearPCMFormatFlagIsBigEndian;
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,13 +251,13 @@ Core_OpenAudio(_THIS, SDL_AudioSpec * spec)
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
desc.mBytesPerFrame =
|
strdesc.mBytesPerFrame =
|
||||||
desc.mBitsPerChannel * desc.mChannelsPerFrame / 8;
|
strdesc.mBitsPerChannel * strdesc.mChannelsPerFrame / 8;
|
||||||
desc.mBytesPerPacket =
|
strdesc.mBytesPerPacket =
|
||||||
desc.mBytesPerFrame * desc.mFramesPerPacket;
|
strdesc.mBytesPerFrame * strdesc.mFramesPerPacket;
|
||||||
|
|
||||||
|
|
||||||
/* Locate the default output audio unit */
|
/* Locate the default output audio unit */
|
||||||
|
memset(&desc, '\0', sizeof (ComponentDescription));
|
||||||
desc.componentType = kAudioUnitComponentType;
|
desc.componentType = kAudioUnitComponentType;
|
||||||
desc.componentSubType = kAudioUnitSubType_Output;
|
desc.componentSubType = kAudioUnitSubType_Output;
|
||||||
desc.componentManufacturer = kAudioUnitID_DefaultOutput;
|
desc.componentManufacturer = kAudioUnitID_DefaultOutput;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue