Featured Member Applications

TanZen ($0.99)

Air Hockey ($0.99)

Forex On The Go Lite (FREE)

Cams Ahoy! Europe ($0.99)

Cams Ahoy! North America ($0.99)

Air Mouse ($5.99)

Internet Radio Box ($2.99)

Photoshop Pirate Guide ($10.99)

Oog & Gappo In The Kitchen ($2.99)

Chess Player ($3.99)

Candy Hearts ($0.99)

Want your application to be advertised here?

Go Back   iPhone Dev SDK Forum

» Site Navigation
» Home
» 360iDev Conference
Looking for an iPhone conference?



iPhone Dev SDK will be there and we're hoping to see you there!

360|iDev
San Jose, CA
March 2-4, 2009
Tickets on sale now!
» Advertisements


Visit our friends over at The App Show! Steve and Dave produce a weekly show shining a light on the iPhone 2.0 software and the applications being developed by the amazing development community for the iPhone SDK!



App Fiend is a simple and efficient way to keep track of what iPhone and iPod Touch Apps your friends are using (or have used), and what they think about them.
» Online Users: 110
18 members and 92 guests
adanv1, ahutch, BostonMerlin, cagan327, davidloew, Delirium, detz, dshaffer, erotsppa, fairlady, flipconversion, Gregg, jaguard, rplasman, siasl, sqs, TomB, unaguma
Most users ever online was 207, 10-24-2008 at 09:29 AM.
» Stats
Members: 5,127
Threads: 7,555
Posts: 31,773
Top Poster: RickMaddy (890)
Welcome to our newest member, jrtb
View Single Post
Old 08-20-2008, 12:42 PM   #1 (permalink)
PKMousie
Code Monkey
 
Join Date: Aug 2008
Location: San Jose
Posts: 7
Default Can't play more than one compressed sample on the iPhone itself

I'm writing an app that needs to play a variety of audio samples of different lengths back to back, but only one at a time. The system I came up with works great when using WAV files or whenever running on the simulator no matter what audio type, but on the iPhone itself the logic breaks if I use a compressed audio format like MP3 or AAC. I don't want to ship 5MB of audio when it could be 500K, so this is a serious problem for me!

I think the bugs have to do with the iPhone's hardware acceleration for compressed audio, and certain playback behaviors changing in this context, but I'm not positive.

Basically, I have a list of 18 samples. I load each into it's own queueable object with it's own queue reference and buffers. If nothing is playing, I pick the first object randomly and play it, wait for it's queue's isRunning property to go false, then play the next sample upon completion. Fine, right?

However, when using MP3s, the first sample I play works just fine, but all the other sounds fail to play, stopping immediately (messing up my event logic). Interestingly, when I loop all the way back around to the original sample, it plays again just fine! It doesn't matter which file I play first... the first file always works great, but appears to block the output of all the other sounds that come later, even though it can be correctly played again itself.

The return codes for all of my AudioQueue calls are 0, even when the audio for a sample doesn't play, and I see a reasonable number of buffering messages as if it's reading and enqueueing each and every file correctly. I'm even flushing the object's queue before calling stop, and resetting the object's queue after the 'isRunning' property goes false, to no avail.

Can anybody describe the magic incantation that allows multiple compressed audio files to be played through the AudioQueue engine, one at a time, without them blocking each other's output? Am I missing something simple?

Help!
PKMousie is offline   Reply With Quote
 
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:43 PM.


Powered by vBulletin® Version 3.7.2
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Owned and Operated by 913solutions, LLC, ©2008 - 2009