0

I'm writing an audio converter using AudioToolbox on macOS and need a method to cross-reference what these integer enums in C are. My code:

let url = URL(fileURLWithPath: "/path/to/file.wav") as CFURL

var audioFile: ExtAudioFileRef? = nil
ExtAudioFileOpenURL(url, &audioFile)

var format = AudioStreamBasicDescription()
var propertySize = UInt32(MemoryLayout.stride(ofValue: format))
ExtAudioFileGetProperty(audioFile!, kExtAudioFileProperty_FileDataFormat, &propertySize, &format)

print(format.mFormatID) // prints 1819304813

I went through the header file and print out the keys one by one:

(lldb) p kAudioFormatLinearPCM
(AudioFormatID) $R2 = 1819304813

So I know it's Linear PCM. Is there a faster way to do it?

Mike Henderson
  • 2,028
  • 1
  • 13
  • 32

0 Answers0