diff options
author | Chris Robinson <[email protected]> | 2012-12-03 11:50:02 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2012-12-03 11:50:02 -0800 |
commit | 4621a7b426387e818b59cc654d8f3a47803e4d9a (patch) | |
tree | 32dff400abd8932ac01fc550e661987428c3169c /Alc/backends/coreaudio.c | |
parent | 4808313e7032c1dec160b7ca16ab7f9bdbb549d4 (diff) |
Add support for float32 output to CoreAudio
Diffstat (limited to 'Alc/backends/coreaudio.c')
-rw-r--r-- | Alc/backends/coreaudio.c | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/Alc/backends/coreaudio.c b/Alc/backends/coreaudio.c index 92d862eb..150f37ac 100644 --- a/Alc/backends/coreaudio.c +++ b/Alc/backends/coreaudio.c @@ -276,38 +276,41 @@ static ALCboolean ca_reset_playback(ALCdevice *device) /* use channel count and sample rate from the default output unit's current * parameters, but reset everything else */ streamFormat.mFramesPerPacket = 1; + streamFormat.mFormatFlags = 0; switch(device->FmtType) { case DevFmtUByte: device->FmtType = DevFmtByte; /* fall-through */ case DevFmtByte: + streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; streamFormat.mBitsPerChannel = 8; - streamFormat.mBytesPerPacket = streamFormat.mChannelsPerFrame; - streamFormat.mBytesPerFrame = streamFormat.mChannelsPerFrame; break; case DevFmtUShort: - case DevFmtFloat: device->FmtType = DevFmtShort; /* fall-through */ case DevFmtShort: + streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; streamFormat.mBitsPerChannel = 16; - streamFormat.mBytesPerPacket = 2 * streamFormat.mChannelsPerFrame; - streamFormat.mBytesPerFrame = 2 * streamFormat.mChannelsPerFrame; break; case DevFmtUInt: device->FmtType = DevFmtInt; /* fall-through */ case DevFmtInt: + streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger; + streamFormat.mBitsPerChannel = 32; + break; + case DevFmtFloat: + streamFormat.mFormatFlags = kLinearPCMFormatFlagIsFloat; streamFormat.mBitsPerChannel = 32; - streamFormat.mBytesPerPacket = 4 * streamFormat.mChannelsPerFrame; - streamFormat.mBytesPerFrame = 4 * streamFormat.mChannelsPerFrame; break; } + streamFormat.mBytesPerFrame = streamFormat.mChannelsPerFrame * + streamFormat.mBitsPerChannel / 8; + streamFormat.mBytesPerPacket = streamFormat.mBytesPerFrame; streamFormat.mFormatID = kAudioFormatLinearPCM; - streamFormat.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger | - kAudioFormatFlagsNativeEndian | - kLinearPCMFormatFlagIsPacked; + streamFormat.mFormatFlags |= kAudioFormatFlagsNativeEndian | + kLinearPCMFormatFlagIsPacked; err = AudioUnitSetProperty(data->audioUnit, kAudioUnitProperty_StreamFormat, kAudioUnitScope_Input, 0, &streamFormat, sizeof(AudioStreamBasicDescription)); if(err != noErr) |