Re: Almost there with ExtAudioFile
Re: Almost there with ExtAudioFile
- Subject: Re: Almost there with ExtAudioFile
- From: William Stewart <email@hidden>
- Date: Fri, 6 Aug 2010 18:03:15 -0700
The FileDataFormat is set when you create the file, so you don't need to set it explicitly. The purpose of the difference between the file and client data formats is to have ExtAudioFile convert from your client format (which is convenient for you to use) to / from the data format that is contained within the file
Bill
On Aug 3, 2010, at 1:11 PM, Fernando Valente wrote:
> 'm almost there with ExtAudioFile. Recording on my app is almost working. There are 2 things I'm still not able do. First is to set the kExtAudioFileProperty_FileDataFormat. I keep getting the -1 error. The second problem is that I don't know what to enter as values for inNumberFrames and ioData in ExtAudioFileWriteAsync. This is my code:
>
> url = (CFURLRef)[NSURL URLWithString:documents];
>
> CAStreamBasicDescription clientFormat, dstFormat;
> clientFormat.SetCanonical(1, true);
> clientFormat.mSampleRate = 44100.0;
>
> printf("Source file format: ");
> clientFormat.Print();
> OSStatus status;
> destinationFile = NULL;
>
> dstFormat.mFormatID = kAudioFormatAppleIMA4;
> dstFormat.mSampleRate = 44100.0;
> dstFormat.mChannelsPerFrame = 1;
>
> UInt32 size = sizeof(dstFormat);
> status = AudioFormatGetProperty(kAudioFormatProperty_FormatInfo, 0, NULL, &size, &dstFormat);
> NSLog(@"%d", status);
> printf("Destination file format: ");
> dstFormat.Print();
>
> status = ExtAudioFileCreateWithURL(url, kAudioFileCAFType, &dstFormat, NULL, kAudioFileFlags_EraseFile, &destinationFile);
> NSLog(@"%d", status);
>
> size = sizeof(clientFormat);
> status = ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_ClientDataFormat, size, &clientFormat);
> NSLog(@"%d", status);
>
> status = ExtAudioFileSetProperty(destinationFile, kExtAudioFileProperty_FileDataFormat, size, &clientFormat);
> NSLog(@"%d", status);
>
>
> Fernando Valente
> Chiaro Software
> email@hidden
> http://www.chiarosoft.com
> http://www.twitter.com/chiarosoftware
>
> _______________________________________________
> 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
_______________________________________________
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