Re: Getting PCM data from MP3/AAC/ALAC File (William Bates)
Re: Getting PCM data from MP3/AAC/ALAC File (William Bates)
- Subject: Re: Getting PCM data from MP3/AAC/ALAC File (William Bates)
- From: "Roni Music" <email@hidden>
- Date: Tue, 23 Dec 2008 18:38:46 +0100
I've followed this thread and I have never had any success in getting
ExtAudioFile to decode an mp3 file on the iPhone
here is the most simple example I could come up with
#include "CAXException.h"
#include "CAStreamBasicDescription.h"
#include "CAAudioChannelLayout.h"
#include "CAExtAudioFile.h"
void TestExtAudioFile(const char *fpath)
{
printf ("TestExtAudioFile() file: %s\n", fpath);
try
{
CFURLRef sndFile = CFURLCreateFromFileSystemRepresentation(NULL, (const
UInt8 *)fpath, strlen(fpath), false);
if (!sndFile)
XThrowIfError (!sndFile, "can't parse file path");
CAExtAudioFile extAudioFile;
extAudioFile.OpenURL(sndFile);
CFRelease (sndFile);
CAStreamBasicDescription fileFmt = extAudioFile.GetFileDataFormat();
printf ("File format: "); fileFmt.Print();
CAStreamBasicDescription clientFmt;
clientFmt.mSampleRate = 44100.0;
clientFmt.SetCanonical(2, false/*bool interleaved*/);
extAudioFile.SetClientFormat(clientFmt); // fails with a 'perm' error
printf ("Client format: "); clientFmt.Print();
}
catch (CAXException e)
{
char buf[256];
fprintf(stderr, "Error: %s (%s)\n", e.mOperation, e.FormatError(buf));
}
}
Any comments?
Rolf
Message: 4
Date: Fri, 19 Dec 2008 18:54:28 -0600
From: William Bates <email@hidden>
Subject: Re: Getting PCM data from MP3/AAC/ALAC File
To: email@hidden
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes
OK, I've done some tests on an actual iPhone:
(1) I tested ExtAudioFile on an iPhone 2.2 and had no problem
converting mp3, mp4, m4a, etc. to kAudioFormatLinearPCM
kAudioFormatFlagIsFloat (packed).
(2) I noted on the iPhone (device only, not simulator) a (spurious?)
permission error when setting kExtAudioFileProperty_ClientDataFormat.
I ignored this and everything looked like it went OK, although I did
not play the results.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Coreaudio-api mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden