0

How can one determine the sample rate in the render callback?

It appears I could override shouldChangeToFormat(_:forBus:) but it seems that such a "should" function shouldn't be used to query state.

And each bus has it's own render format, but there's obviously only a single sample rate for processing, adding to the confusion.

Taylor
  • 5,871
  • 2
  • 30
  • 64

1 Answers1

0

Any Objective C calls, such as to determine the audio unit sample rate should be done outside the callback (from the main UI thread), perhaps for each unit just before starting the audio graph. This information can be passed into the callback, within its state information or block variables, as needed.

Any setting of audio unit formats or connection between units need to be checked for errors (such as for unsupported formats).

hotpaw2
  • 70,107
  • 14
  • 90
  • 153