Game Development Community

ogg support in iT2D?

by Peter Fokos · in iTorque 2D · 11/20/2009 (7:48 pm) · 9 replies

I'm having some issues getting ogg files to play in my game. I'm trying to get under 10mb so I really can't afford to continue using .wav files as I've been doing. I've converted all my wav files over the ogg but they just don't play. To test this, I've created an empty project with just the audio datablocks, the sound files and using a fresh install of iTGB 1.2. I made two audio profiles exactly the same except for one was an ogg and the other a wave and then used alxPlay to run them from the console. The wav one played the sound and the ogg file did nothing, not even an error. I can then load the same project in TGB 1.7.4 and use alxPlay and both sounds will play perfectly fine. Frankly, I have no idea what to make of this.

Is there ogg support in it2d? I see the code for it so I assume there is. I haven't seen any other posts about this issue so I assume it isn't a common one. Can anyone confirm that ogg files work for them?

About the author

Recent Threads


#1
11/20/2009 (7:50 pm)
The above is really me. I was logged in under my boss's account and forgot to log out.
#2
11/20/2009 (8:22 pm)
There is no Vorbis or Theora support in the iPhone engines. The CPU just can't handle it.

Vorbis playback is really demanding on ARM, so just use MP3s for music. Being an iPhone developer gives you the licence to encode MP3s. Theora? I don't think I even want to try (tried Vorbis, and it used a fourth of the CPU).
#3
11/21/2009 (1:49 am)
Well that would explain why ogg files aren't playing. The extra code for Vorbis playback in the engine confused me and I just assumed it was supported. Now that I know ogg files won't work, I'll start working on another solution.
#4
11/21/2009 (2:24 am)
Thats the problem with the single client source base for Win/OSX as well as iPhone

anything thats not in a platform folder potentially does not really have importance on the current platform.
#5
11/21/2009 (3:09 am)
The extra code has been cleaned out in the upcoming release.

Performance - You dont want to spent LARGE chunks of CPU time every cycle on decoding and decompressing audio formats, and moving things around in memory. The data gets loaded into memory and the CPU has to constantly decode the data in realtime, meaning that you are spending valuable time on the CPU wasted.

Use uncompressed audio for best performance - and keep in mind the engine does support mp3 and wav, and there is a video playing resource stickied in the forums.
#6
11/21/2009 (8:26 am)
I think I read somewhere that you can only play one mp3 at a time. Is that true? If I have an mp3 as my background music and then play a small mp3 as a sound effect would there be an issue? Or should I use an mp3 as a background and wav as the sound effect?
#7
11/21/2009 (9:28 am)
Yes, you can only play 1 mp3 (one compressed sound) at a time. You suggested using 1 mp3 for background and 1 wav for effects, which is perfectly fine EXCEPT - The mp3 will slow your game down quite significantly. Do a test of performance with wav / mp3 as the background music and keep in mind that it is going to cost the CPU a lot of mspf (milliseconds per frame) JUST to play a sound - on a mobile device this is very performance tolling.
#8
11/21/2009 (12:43 pm)
well, i guess the problem is that I have about 10MB of background music as wavs, and isn't 10MB the limit for the whole game? So do I have any other option but to use mp3's as the background music?
#9
11/21/2009 (1:21 pm)
Your game can be as large as you want! The 10MB limit is to be able to download over mobile networks rather than wi-fi. Any app above 10MB (good, old 1024kByte megs here) won't be downloadable over anything but wi-fi on the devices themselves.

MP3 background music is worth trying. Just try it and see if it makes enough of a difference, and always leave an option to toggle music on and off in your games. Games which don't let me select fill me with rage ;)
If your games really only needs 30fps, it might be fine after all.