iDevGames Forums
combining two audiofiles - Printable Version

+- iDevGames Forums (http://www.idevgames.com/forums)
+-- Forum: Development Zone (/forum-3.html)
+--- Forum: Graphics & Audio Programming (/forum-9.html)
+--- Thread: combining two audiofiles (/thread-8663.html)



combining two audiofiles - Shoto - Feb 21, 2011 01:05 PM

Hello,
I want to play two audio files after each other.
I am using AVAudioPlayer with the delegate option to see if the audio is finished. If it is finished it sends a message to play the second file. But I have a lot of different combinations I want to use and the delegate becomes a big cluttered if statement.

So I am looking for a different way without having to resort to audioQueue that thing scares me.

An option like the UIVIew animatewithduration which has a completion block at the end would have been nice but alas.

If there is no standard framework to make this easy are there opensource frameworks that provide easy sound appending options?
I am finding that OBj C doesn't make it straight forward to append animations or sounds. I keep reading about people having to use NSTimer objects or other weird hoops they are jumping through.

Any tips are appreciated. I like the AVAudioPlayer it is a nice simple way, but the delegate just make sit a mess in my case.


RE: combining two audiofiles - SethWillits - Feb 22, 2011 01:54 PM

Quote:So I am looking for a different way without having to resort to audioQueue that thing scares me.

Think of how awesome you'll feel after you figure it out.



Quote:I am using AVAudioPlayer with the delegate option to see if the audio is finished. If it is finished it sends a message to play the second file. But I have a lot of different combinations I want to use and the delegate becomes a big cluttered if statement.

Wrap that logic in some other more generic form. For instance if the delegate method is doing "if stopped and movie was A then play X else if stopped and movie was B then play Y else if .... etc", then just do "if stopped { currentMovie = (currentMovie + 1) % numOfMovies; play queue[currentMovie]; }"