Re: ExtAudioFileRead
Re: ExtAudioFileRead
- Subject: Re: ExtAudioFileRead
- From: Ethan Funk <email@hidden>
- Date: Wed, 8 Sep 2010 06:45:16 -0700
I believe, in your code example, numPackets on entry to ExtAudioFileRead is the number of packets requested and on return it is set (thus the address being passed) to the number of packets actually read by the function.
If you "reset" numPackets before each call to ExtAudioFileRead, you should be fine.
Ethan...
On Sep 8, 2010, at 4:09 AM, Aran Mulholland wrote:
> Hello all,
>
> I am reading audio data from a wav file to populate a ring buffer and
> I have some issues when I get to the end of the file and want to start
> reading from back at the beginning.
>
> I am reading in 4096 frames at a time with the line
>
> result =
> ExtAudioFileRead(mSoundBuffer->fileReference, &numPackets, bufList); -
> where numPackets is 4096.
>
> Audio plays correctly.
>
> when i near the end of the file I cannot read 4096 frames as I have
> less than that left in the file. So I calculate the number to be read
> and read that number.
>
> result =
> ExtAudioFileRead(mSoundBuffer->fileReference, &numPackets, bufList); -
> where numPackets is say 544.
>
> Then i reset the read pointer using
>
> SInt64 position = 0;
> result = ExtAudioFileSeek(mSoundBuffer->fileReference, position);
>
> After this point, whenever I do an ExtAudioFileRead the numPackets is
> always 544 - the number it was to get me to the end of the file.
>
> Anyone have a similar experience, or know what i might be doing wrong?
>
> Thanks
>
> Aran
> _______________________________________________
> 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