OGG on iPhone

Member
Posts: 93
Joined: 2008.11
Post: #1
Hi guys,

My game requires OGG playback.
I have therefore compiled both libogg and libvorbis as static libraries and linked them with my game. This works on both simulator and iPhone.
The question is actually more generic.
Using OGG seems to be very costly. Encoding an average song of 1.5 minutes is done in like 30 seconds on the iPhone. Currently I'm reading the whole encoded song into a buffer and then submit that to OpenAL. It works, but very slow. The playback is of course fine.

What is the better way to get around this?
Is threading+streaming a good idea or would it be too costly and introduce delay in my rendering/logic updates?

TIA,
Alex

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Member
Posts: 249
Joined: 2008.10
Post: #2
godexsoft Wrote:Hi guys,

My game requires OGG playback.
I have therefore compiled both libogg and libvorbis as static libraries and linked them with my game. This works on both simulator and iPhone.
The question is actually more generic.
Using OGG seems to be very costly. Encoding an average song of 1.5 minutes is done in like 30 seconds on the iPhone. Currently I'm reading the whole encoded song into a buffer and then submit that to OpenAL. It works, but very slow. The playback is of course fine.

What is the better way to get around this?
Is threading+streaming a good idea or would it be too costly and introduce delay in my rendering/logic updates?

TIA,
Alex

Maybe FMOD for iPhone could help you. Just a suggestion.
Quote this message in a reply
Member
Posts: 93
Joined: 2008.11
Post: #3
riruilo Wrote:Maybe FMOD for iPhone could help you. Just a suggestion.

Hi,

Thanks for the suggestion...
However, I'm opensource.

Ideas?
Alex

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #4
Glad to see OGG works on iPhone. Unfortunately, unless you can get it running through hardware, I don't see the point of using it. The Apple APIs decode compressed music through specialized hardware, which is highly efficient, so it doesn't make any logical sense to be spending CPU cycles on that IMHO.
Quote this message in a reply
Member
Posts: 93
Joined: 2008.11
Post: #5
AnotherJake Wrote:Glad to see OGG works on iPhone. Unfortunately, unless you can get it running through hardware, I don't see the point of using it. The Apple APIs decode compressed music through specialized hardware, which is highly efficient, so it doesn't make any logical sense to be spending CPU cycles on that IMHO.

You are damn right, but can you tell that to my users who cry out stuff like "99% of my music collection for 'the game' is in .ogg format!! what should I do?"?? Personally I wouldn't need ogg since my collection is mostly mp3 and at least I know how to convert from ogg to mp3 if I really need something Rasp

Any more ideas?
Alex

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #6
I wonder if you could decode little chunks of your OGG files and feed it to Audio Queues during its callback? Or perhaps RemoteIO could be used for that instead. I haven't used RemoteIO for output though, so I don't know how that works, but if it uses a callback to play sequential buffers of audio (like it does for input) then perhaps that might work. You'd still be burning CPU, but it'd be on-the-fly.

Personally I'd consider telling my users to convert their audio if they want to use it on iPhone Rasp
Quote this message in a reply
Member
Posts: 93
Joined: 2008.11
Post: #7
AnotherJake Wrote:I wonder if you could decode little chunks of your OGG files and feed it to Audio Queues during its callback? Or perhaps RemoteIO could be used for that instead. I haven't used RemoteIO for output though, so I don't know how that works, but if it uses a callback to play sequential buffers of audio (like it does for input) then perhaps that might work. You'd still be burning CPU, but it'd be on-the-fly.

Personally I'd consider telling my users to convert their audio if they want to use it on iPhone Rasp

Well, it's already on-the-fly from what I can see. I stream.. thus I decode little chunks (played with lots of different sizes/buffer counts). The slow part is not Playing the sound... but decoding the sound so I guess it just stops here.
I already wrote a wiki page stating that they must convert and that ogg will work once apple adds support for it.. sad but true.

Thanks for your time,
Alex

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Moderator
Posts: 3,577
Joined: 2003.06
Post: #8
I was talking about *decoding* it in chunks. You said in your original post that you're decoding the whole thing at once and then uploading it to OpenAL. What I am suggesting is decoding only small parts of it at a time and uploading those to Apple's audio buffers, be they via RemoteIO or Audio Queues.
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #9
Doing stream decoding of Vorbis files is not too hard, but again, why bother? AAC and the like is supposedly hardware decompressed. If your users are complaining that they can't use their ogg encoded files with your game, I really have to ask... How are they getting the ogg files into your game in the first place?

I like Vorbis and it's API as much as the next guy, but it doesn't really seem very pragmatic on the iPhone when you can play an MP3 or AAC in hardware using Apple's API in 4 lines of code.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Member
Posts: 93
Joined: 2008.11
Post: #10
Ahh... at the end I was 'streaming' which means decoding small chunks and then posting them to OpenAL buffers..
I just forgot that my initial post was talking about a full upload.. sorry Smile

Skorche, the game is a DanceDanceRevolution clone and it uses songs/simfiles from StepMania (stepmania.com) which is a great opensourced PC version simulator of DDR.. so instead of creating own format I just take it from the existing game so my users directly have like over 10k songs to play Smile Sad news is that at least 50% of it is in ogg format. That makes me sad.

Regards,
Alex

TapMania - iPhone StepMania // Human knowledge belongs to the world!
Quote this message in a reply
Sage
Posts: 1,482
Joined: 2002.09
Post: #11
Ah. Well that makes some sense then.

Scott Lembcke - Howling Moon Software
Author of Chipmunk Physics - A fast and simple rigid body physics library in C.
Quote this message in a reply
Post Reply