Re: Play from Audio CD
Re: Play from Audio CD
- Subject: Re: Play from Audio CD
- From: John Johnson <email@hidden>
- Date: Fri, 11 Jun 2010 20:25:15 -0500
> You already have the audio data in your process space, as well as the converted audio data, so why would you want to read it back from a file? I understand that you might have some handy code which plays an audio file, and you might want to keep that for simplicity. However, CoreAudio also allows playback of audio directly from memory. Since you're already going to the trouble of ripping the audio data into memory and converting it into memory, why not just play back from memory, too?
>
> As others have pointed out, your attempt to play an audio file which has not been completely written to disc is just asking for trouble. You'll note that iTunes will not allow the user to play a ripped track until it has been completely ripped and the file has been closed for writing. If you want to allow playback before the file has been written, then I suggest playback from memory.
The reason is that the ripped audio data can easily span several hundred megabytes (or more) for longer songs. The ripper chugs along ripping the data and passes it to the delegate, but the audio player doesn't play the data as fast as it rips it, so I could easily end up with >200 MB sitting in an audio buffer waiting to be played. I'm not sure if this is a big issue or not with the amount of memory available on Macs nowadays, but I can picture a user trying to play an audio track that is 30 minutes (or 3 GB in size when ripped) and experiencing a huge failure because they run out of memory.
I could do it the other way around and ask the ripper for data as I need it, but I'm also trying to achieve fast seek times, and I'm not sure it would be possible to buffer ahead if I'm only asking for data when I need it.
And I have looked at the way iTunes does it, but there are also other programs that DO allow you to play the file before it's fully ripped, and they do it by writing a cache file. I've monitored this using fseventer and other tools. Which leads me to believe that this is possible.
It would be ideal to play back from memory, and if you have suggestions on how to get around the memory issue, I'm definitely open to hearing them. Honestly, I think it's much faster and tidier to do it all from memory, and with most audio tracks only typically being ~50MB in size when ripped, it's definitely viable. But I just remember the fact that users do what you least expect when they have your program in their hands.
John _______________________________________________
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