summaryrefslogtreecommitdiff
path: root/modules/audiounit
diff options
context:
space:
mode:
authorSebastian Reimers <info@miete-admin.de>2016-01-15 19:12:26 +0100
committerAlfred E. Heggestad <aeh@db.org>2016-01-16 17:28:43 +0100
commitaae1708597fd5c2144f5f6a394d727a505666cb5 (patch)
treec09078a597bdb988b2d7c2dc5cf83a47a7233bae /modules/audiounit
parentee292a426a452dbb77c5c2cbd0ada3104431daec (diff)
Fix audiounit recording on OSX, technotes TN2223 and TN2091
Diffstat (limited to 'modules/audiounit')
-rw-r--r--modules/audiounit/recorder.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/audiounit/recorder.c b/modules/audiounit/recorder.c
index d46f331..25095e1 100644
--- a/modules/audiounit/recorder.c
+++ b/modules/audiounit/recorder.c
@@ -104,6 +104,13 @@ int audiounit_recorder_alloc(struct ausrc_st **stp, const struct ausrc *as,
AURenderCallbackStruct cb;
struct ausrc_st *st;
UInt32 enable = 1;
+ UInt32 ausize;
+ ausize = sizeof(AudioDeviceID);
+ AudioDeviceID inputDevice;
+ AudioObjectPropertyAddress auAddress = {
+ kAudioHardwarePropertyDefaultInputDevice,
+ kAudioObjectPropertyScopeGlobal,
+ kAudioObjectPropertyElementMaster };
OSStatus ret = 0;
int err;
@@ -138,6 +145,31 @@ int audiounit_recorder_alloc(struct ausrc_st **stp, const struct ausrc *as,
if (ret)
goto out;
+ enable = 0;
+ ret = AudioUnitSetProperty(st->au, kAudioOutputUnitProperty_EnableIO,
+ kAudioUnitScope_Output, 0,
+ &enable, sizeof(enable));
+ if (ret)
+ goto out;
+
+ ret = AudioObjectGetPropertyData(kAudioObjectSystemObject,
+ &auAddress,
+ 0,
+ NULL,
+ &ausize,
+ &inputDevice);
+ if (ret)
+ goto out;
+
+ ret = AudioUnitSetProperty(st->au,
+ kAudioOutputUnitProperty_CurrentDevice,
+ kAudioUnitScope_Global,
+ 0,
+ &inputDevice,
+ sizeof(inputDevice));
+ if (ret)
+ goto out;
+
fmt.mSampleRate = prm->srate;
fmt.mFormatID = kAudioFormatLinearPCM;
#if TARGET_OS_IPHONE