2

I have a method that relies on knowing the hardwares sample rate and buffer duration in order to calculate some values. Currently the implementation of this on iOS is as follow:

double sampleRate = [[AVAudioSession sharedInstance] sampleRate];
double bufferDuration = [[AVAudioSession sharedInstance] IOBufferDuration];
float bufferLength = sampleRate*bufferDuration;

However, on OSX, the AVAudioSession class is not recognized and does not appear to be part of the SDK. And documentation about this sort of thing seems to be very scant.

How to I query the same values on the OSX OS?

Alex Bollbach
  • 4,370
  • 9
  • 32
  • 80

1 Answers1

1

For determining buffer length, see this previous answer: OSX: CoreAudio API for setting IO Buffer length? pointing at this Apple tech note about some Core Audio properties with getters and setters: https://developer.apple.com/library/mac/technotes/tn2321/_index.html#//apple_ref/doc/uid/DTS40013499-CH1-THE_I_O_BUFFER_SIZE

For determining sample rate, see this previous answer: CoreAudio get output sample rate regarding the kAudioUnitProperty_SampleRate property.

Community
  • 1
  • 1
hotpaw2
  • 70,107
  • 14
  • 90
  • 153