Game Development Community

Clarification on playing Music and Sounds

by Colin Richardson · in iTorque 2D · 06/02/2010 (2:14 pm) · 7 replies

Hello,

I'm posting this just to perhaps clarify what i've discovered this evening.

1. Music (background music etc) should ideally be in .MP3 format.
2. Sounds (button presses, special effects) should be in .WAV format.

That all seems good and simple.

Next i'm building my demo iPhone app on my Windows Laptop and i want to integrate some music, so to do this from what i've read tonight i do:

function musicStart()
{   
   %loop = true;
   $musicStreamFile = "~/data/audio/music/game-theme.mp3";  
   $musicStreamHandle = startiPhoneAudioStream($musicStreamFile,%loop);   
}

That all seems so very simple, however upon running it i get:

game/scripts/mainGame.cs (157): Unable to find function startiPhoneAudioStrea

I've tried playing it as an AudioDataBlock but i get another error about a NULL resource file.

Is this because i'm running it on my Windows laptop as i know that the .MP3 is right where i tell it that it is? I read that i wouldn't be able to play MP3's on my better halfs MacBook so i've not even tried.

If this is the case, what's the best way to play the background music just so that i can tie everything together before porting over to my (not yet arrived) iPhone?

Then lastly i presume for .WAV sounds i should create the AudioDataBlocks, is there a preferred script file to place these in? for example i created a file called 'audioDataBlocks' and through that into the scripts folder and exec'd it.

So hopefully just some clarification and if possible some pointers.

Cheers
Colin

#1
06/02/2010 (2:30 pm)
these functions, as the name implies, are iphone functions.

You need to run them on the iphone simulator or the real device -> windows will be of no use, iphone testing and deployment is mac osx exclusive

There is no support for mp3 on the desktop at all, its only available on the iphone and handled through the iphones libraries (and mp3 license)
#2
06/02/2010 (2:47 pm)
Hello Marc,

Thanks for the reply.

It's as i thought, i'll have to trust it all until i port it all over to the macbook and that's when either i find £1000 to get myself one, or i can persuade the missus she doesn't need hers for a while.

Cheers
Colin
#3
06/02/2010 (5:20 pm)
If you currently have a desktop, the cheapest way is normally to get a MacMini actually (though the cheapest macbook works too and is only slightly more expensive. Neither should be in the £1000 range I think)
#4
06/02/2010 (6:11 pm)
The other option, assuming your current hardware supports it - is to purchase a copy of the Mac OS and install it as a virtual machine on your current computer - it's what I've been doing.
#5
06/02/2010 (6:35 pm)
problem is if you happen to have a problem its your problem. You won't get support from any side as you broke licenses and eula and work on an unsupported platform (its a hackintosh, neither an OSX nor Windows OS)

After seeing how nutty xcode and the simulator can go I don't recommend it to someone all new to the osx universe. Even working with "compile yourself" linux distris is easier as they normally at least support a large amount of hardware while osx is focused at the few configurations offered by apple
#6
06/03/2010 (9:57 am)
Hi Marc,

Thanks again for your reply here.

I've gone and ordered myself a nice shiny Macbook, i have a credit card and i can pay that off and so my missus can keep hers all to herself.

I can't see the point of the windows build of iTGB, but that's another story i suppose.

Cheers
Colin
#7
06/03/2010 (3:38 pm)
I've not seen it right since the start and always was against further support for it there as it caused and causes anomalies and the performance and behavior of the windows standalone is even further away from the iphone than the behavior of the osx standalone.
But all in all iTGB always worked more stable on windows than osx, which to me was a good reason to see it gone yesterday better than tomorrow.
But I guess it makes a good "first 50% of the project" dev and test platform (my main machine is window too and its worlds faster than my mac, none the less I wouldn't use it for more than pvr generation and adding them to the project. I've never done any testing with the standalone player due to the significant inconsistence and the fact that an i7 on a gtx280 behaves as similar to the iphone as a ferrari to a fiat panda)

With iTGB 1.0 - 1.2 though there was at least the excuse that it is "just TGB with an iphone platform layer" but since 1.3 that excuse kind of doesn't exist anymore, at least to me, as LUMA (unlike whoever handled 1.0 through 1.2 + 1.3 beta) finally has gone ahead to cut stuff thats only of use and interest on the desktop at all, was suboptimized or never really worked. LUMA did a great job on iTGB and cutting some of the roots that held it back