Flixel Forums

development => iOS => Topic started by: tokyotron on Tue, May 15, 2012

Title: Sound effects
Post by: tokyotron on Tue, May 15, 2012
Anyone know the reason why the sound effects are played using OA and not for instance AV Foundation?
Title: Re: Sound effects
Post by: initials on Tue, May 15, 2012
I don't know for sure, but I believe OpenAL is better performance wise for sounds. You can play multiple sounds at once.

Are you having problems with OpenAL.

There is a line that sets the freq to 22150 that needs to be taken out for it to work.
Title: Re: Sound effects
Post by: tokyotron on Tue, May 15, 2012
Ok well it's possible to play multiple sounds using several AVAudioPlayer:s too, for instance. But I tried your fix from another thread and it works, so all is kind of well.  8)
Anyway I guess OA does not support mp3 etc and other compressed formats. I might have to think of a workaround if I'm gonna use lots of sounds... wanna keep app size down...
Title: Re: Sound effects
Post by: initials on Wed, May 16, 2012
Using CAF's can make the file size pretty big.
It would be awesome to be able to used compressed Mp3s for sound effects.
Title: Re: Sound effects
Post by: tokyotron on Wed, May 16, 2012
I think I found out how I could do it, if I would really need it:

http://developer.apple.com/library/ios/#samplecode/iPhoneExtAudioFileConvertTest/Introduction/Intro.html

This is Apple's sample app - how to convert sounds. I just tried converting an mp3, then used it inside Flixel and it works. I output a PCM of 44100 hz. There's a function in there called DoConvertFile(), that should pretty much be enough to do this. You would need to convert the sound files when the app launches and put in cache or something like that.

Well, converting mp3s on the fly might be enough in some ways...