summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2016-01-16 17:31:10 +0100
committerAlfred E. Heggestad <aeh@db.org>2016-01-16 17:31:10 +0100
commitb71d28f92b6c31297a4e1c46a4e9ca7db210b36e (patch)
treec9dc4b2b4f5297ed5d5ba686cbaca077ac34a4b2
parentaae1708597fd5c2144f5f6a394d727a505666cb5 (diff)
audiounit: add debug of hardware sample-rate
-rw-r--r--modules/audiounit/player.c18
-rw-r--r--modules/audiounit/recorder.c18
2 files changed, 34 insertions, 2 deletions
diff --git a/modules/audiounit/player.c b/modules/audiounit/player.c
index 99b83c9..5e9f6b2 100644
--- a/modules/audiounit/player.c
+++ b/modules/audiounit/player.c
@@ -96,6 +96,8 @@ int audiounit_player_alloc(struct auplay_st **stp, const struct auplay *ap,
struct auplay_st *st;
UInt32 enable = 1;
OSStatus ret = 0;
+ Float64 hw_srate = 0.0;
+ UInt32 hw_size = sizeof(hw_srate);
int err;
(void)device;
@@ -123,8 +125,10 @@ int audiounit_player_alloc(struct auplay_st **stp, const struct auplay *ap,
ret = AudioUnitSetProperty(st->au, kAudioOutputUnitProperty_EnableIO,
kAudioUnitScope_Output, outputBus,
&enable, sizeof(enable));
- if (ret)
+ if (ret) {
+ warning("audiounit: EnableIO failed (%d)\n", ret);
goto out;
+ }
fmt.mSampleRate = prm->srate;
fmt.mFormatID = kAudioFormatLinearPCM;
@@ -163,6 +167,18 @@ int audiounit_player_alloc(struct auplay_st **stp, const struct auplay *ap,
if (ret)
goto out;
+ ret = AudioUnitGetProperty(st->au,
+ kAudioUnitProperty_SampleRate,
+ kAudioUnitScope_Output,
+ 0,
+ &hw_srate,
+ &hw_size);
+ if (ret)
+ goto out;
+
+ debug("audiounit: player hardware sample rate is now at %f Hz\n",
+ hw_srate);
+
out:
if (ret) {
warning("audiounit: player failed: %d (%c%c%c%c)\n", ret,
diff --git a/modules/audiounit/recorder.c b/modules/audiounit/recorder.c
index 25095e1..663fc3d 100644
--- a/modules/audiounit/recorder.c
+++ b/modules/audiounit/recorder.c
@@ -74,8 +74,10 @@ static OSStatus input_callback(void *inRefCon,
inBusNumber,
inNumberFrames,
&abl);
- if (ret)
+ if (ret) {
+ debug("audiounit: record: AudioUnitRender error (%d)\n", ret);
return ret;
+ }
rh(abl.mBuffers[0].mData, abl.mBuffers[0].mDataByteSize/2, arg);
@@ -111,6 +113,8 @@ int audiounit_recorder_alloc(struct ausrc_st **stp, const struct ausrc *as,
kAudioHardwarePropertyDefaultInputDevice,
kAudioObjectPropertyScopeGlobal,
kAudioObjectPropertyElementMaster };
+ Float64 hw_srate = 0.0;
+ UInt32 hw_size = sizeof(hw_srate);
OSStatus ret = 0;
int err;
@@ -209,6 +213,18 @@ int audiounit_recorder_alloc(struct ausrc_st **stp, const struct ausrc *as,
if (ret)
goto out;
+ ret = AudioUnitGetProperty(st->au,
+ kAudioUnitProperty_SampleRate,
+ kAudioUnitScope_Input,
+ 0,
+ &hw_srate,
+ &hw_size);
+ if (ret)
+ goto out;
+
+ debug("audiounit: record hardware sample rate is now at %f Hz\n",
+ hw_srate);
+
out:
if (ret) {
warning("audiounit: record failed: %d (%c%c%c%c)\n", ret,