5

I've been using ExtAudioFile Services and I want to use an AudioFile Service which requires an AudioFileID parameter. This parameter corresponds to ExtAudioFileRef used in ExtAudioFile Services. How do I convert from ExtAudioFileRef type to AudioFileID type?

Namratha
  • 16,630
  • 27
  • 90
  • 125

2 Answers2

8

I know this one is old and answered, but I just noticed it and thought I'll leave a correct answer here for future reference

AudioFileID audioFile;
UInt32 dataSize = sizeof(AudioFileID);
ExtAudioFileGetProperty(extAudioFile, kExtAudioFileProperty_AudioFile, &dataSize, &audioFile);
Mayjak
  • 1,487
  • 14
  • 17
-3

Just typecast it, it works fine! AudioFileID audiofile = (AudioFileID)AudioExt where AudioExt is of type ExtAudioFileRef

Namratha
  • 16,630
  • 27
  • 90
  • 125
  • This may work now, but it is neither documented nor supported by Apple as far as I know. Sticking with the API supported solution is a better long term approach. – Nick Haddad Mar 08 '12 at 03:17