Intel & Saving Audio Data

Member
Posts: 31
Joined: 2004.09
Post: #1
Hi all,

preparing for Universal Binaries...

my sound files are all aiff. I load them all at app startup, for ease and speed reasons.

I play them with the Sound Manager, but I use QuickTime to convert the aiff files. However, this is SLOW. Far too slow.

So, what I've been doing is doing the doing the conversion in development builds, and I save the sound data out to one large file, which is included in the shipping build. Very fast loads, no problems.

However, I assume I will have a problem with Intel machines, specifically with the byte ordering of the sound data on file.

The trick here, it seems to me, is that I don't know the makeup of the data -- since QuickTime hands off a handle to the data, I just treat it as one opaque block of audio goodness, which in turn gets handed off to the Sound Manager.

Thus, the question: how can I safely continue to ship my game with the audio data on file, but load it correctly on both architectures? (I would assume that simply iterating over all the data in word-length chunks and byte swapping as required, would be (a) nasty and (b) not good for non-word-length data.)

thanks for any help.
Quote this message in a reply
Moderator
Posts: 3,570
Joined: 2003.06
Post: #2
Hmm... Well, nobody else has said anything yet, so I guess I'll take a wild stab at it.

I'm not really sure I understand what you're doing. You mean you are converting the aiff in memory into something the Sound Manager understands and then saving the contents of the opaque handle to disk, to be reloaded later without the conversion step? That seems a bit awkward in and of itself. Why not just go with a good compression format like mp3 or ogg and be done with it? I would imagine QT could do mp3 right out of the box without having to worry about endianness, but don't quote me on that. Ogg-Vorbis should have easy endian facilities built-in as well, although I don't know if the library is universal yet. Anyway, those are just some thoughts to bounce around...

[edit] Maybe you're just talking about short sound effects like lasers and gun blasts or something like that. In that case, I wouldn't even use the sound manager, but rather OpenAL with just plain-ol WAVs. Just more random thoughts...
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #3
The Sound Manager is deprecated, anyway. OpenAL is the way of the future.
Quote this message in a reply
Member
Posts: 31
Joined: 2004.09
Post: #4
Thanks for the reply. I realize OpenAL is supported in Tiger, but do I have to get my players to install it on earlier OSs? (Which is not going to happen.)

(Please keep in mind that my goal here is not to reinvent any wheels, but rather to simply get a universal binary working -- you know, the process that we were assured would simply involve the flipping of a flag in Xcode... Wink
Quote this message in a reply
Luminary
Posts: 5,143
Joined: 2002.04
Post: #5
OpenAL works back to 10.2.8. You have to include it inside your application bundle for it to work on 10.3.9 or earlier.
Quote this message in a reply
Post Reply 

Possibly Related Threads...
Thread: Author Replies: Views: Last Post
  saving images for games: what color profile? Najdorf 1 2,131 Jul 25, 2009 06:16 AM
Last Post: AnotherJake
  saving photos on iphone 1.1.4 dimat 1 2,139 Jun 30, 2008 12:23 PM
Last Post: kodex
  Saving Frame Buffer nicromonicon 2 2,939 Apr 9, 2008 08:23 AM
Last Post: stevejohnson
  DevIL - saving images to file!!!! alert 2 2,674 Jun 2, 2005 03:43 AM
Last Post: alert
  Core Audio mutlichannel audio tachyon 2 5,926 Mar 18, 2005 01:04 AM
Last Post: tachyon