Game Development Community

No .ogg playback in 1.7.5 on Mac - SOLVED

by And Yet It Moves · in Torque Game Builder · 04/07/2011 (3:17 am) · 10 replies

We are currently looking into updating our codebase of And Yet It Moves from 1.7.4 to 1.7.5. Everything works, except that our.ogg files wont play.

So I started replacinig .wav files in some of the demos (Solitaire and Reactor) in a freshly installed 1.7.5 build with .ogg files and noticed that they wont play as well. To me it looks like .ogg plack in TGB 1.7.5 on Mac is broken. Anyone has a fix for this?

Greets
Felix

#1
04/07/2011 (4:00 am)
I've been using *.ogg and they seem to be working fine, my target platform was both for the PC and Mac. Maybe something wrong with your converter ?

Congrates on your success in the Mac AppStore :)
#2
04/07/2011 (7:37 am)
Thanks!

I try to play the same files, that we used in our old 1.7.4 build. What could be wrong with the converter?

#3
04/07/2011 (12:56 pm)
This might have something to do with the change in OpenAL frameworks. Are there any warnings or errors associated with the audio system in the console log?

Also, iTorque 2D 1.4 had problems with audio on a Mac. This was due to the engine trying to use its own OpenAL library instead of the one provided by the OS.
#4
04/07/2011 (1:53 pm)
Had this problem too. Turned out the program used to convert wasn't as picky about format strictness as the Vorbis library included. Try the command line Xiph programs to rule out or confirm converter issues.
#5
04/08/2011 (3:09 am)
Hi All!

@Michael
No, there are no errors or warnings in the Console.log

@Ronny
I donwloaded vorbis_tools and used oggenc to encode the files. These are the command line programs you were talking about, right?

So it's still not working. Here's what I did:

- I freshly installed TGB 1.7.5
- I build TGBGame Debug in xcode 4 and and run it with the included Solitaire demo (added argument -project /Applications/TorqueGameBuilder-1.7.5-Pro/games/Solitaire)
- I click the Deal card and it plays the whoosh sound, which is by default whoosh_mono.wav
- To encode an .ogg file, I run "oggenc whoosh_mono.wav" and get whoosh_mono.ogg which I copy into the Solitaire/game/data/audio folder
- in Solitaire/game/gameScripts/sound.cs I change this line "filename = "~/data/audio/whoosh_mono.wav";" to "filename = "~/data/audio/whoosh_mono.ogg";"
- I run TGBGame Debug again and click on the Deal card: NO SOUND
- i didn't find any errors or warnings corresponding to audio in the console.log file

I also uploaded the consol.log and the .ogg I used, so you can check it out:
http://andyetitmoves.at/geheim/TGBOggBug/Files.zip

Can someone try this out and/or send me an .ogg file with which it should work?
#6
04/08/2011 (11:35 am)
Correct command-line tools, and working fine here in everything. Sound is a bit fiddly in TGB, though ;)

I get this to play, and here's how. Note: I have some special scripts and behaviours which look inside three subfolders under audio to create various files describing the sound. One file is fixed, with audio descriptions, then one file each for fx and music.


Here's one of the three AudioDescription blocks I have in game/managed/audio.cs:
datablock AudioDescription(SoundOnce)
{
    volume    = 1.0;
    type      = 0;
    isLooping = false;
    is3D      = false;
};

Then I added this in my fx.cs:
datablock AudioProfile(whoosh_mono)
{
	filename = "~/data/audio/fx/whoosh_mono.ogg";
	description = "SoundOnce";
	preload = true;
};

And finally, to play the sound I did this:
alxPlay(whoosh_mono);

Are you doing anything different from this?

ob.structive.net/womm.png
#7
04/11/2011 (7:24 am)
Yeah, this is pretty much what is done in the Solitaire Demo as well. The Audio is defined in Solitaire/game/gamescripts/sound.cs

// Audio description
new AudioDescription(AudioNonLooping)
{
   volume = 1.0;
   isLooping = false;
   is3D = false;
   type = 0;
};

// Whoosh sound effect
new AudioProfile(whoosh)
{
   filename = "~/data/audio/batsFlying.ogg";
   description = "AudioNonLooping";
   preload = true;
};

The sound is played in Solitaire/game/gamescripts/solitaire.cs When pressing the Deal card it's actually played from a schedule,

// Deal out the cards onto the table.
function Solitaire::dealSolitaire()
{
...
      schedule(%dealDelay, 0, alxPlay, whoosh);

To be sure I also added "alxPlay(whoosh);" into pressDealButton() directly.

function Solitaire::pressDealButton()
{
	echo("playing whoosh sound");
	
	alxPlay(whoosh);
...

You can find the code in your demo files as well...

I tried the same procedure on another Mac running 10.6.7 and compiling with Xcode 4, but also don't get any sound output. Are you also compiling with Xcode4?

Anyone from GarageGames has any tips/suggestions?

PS: nice badge :)
#8
04/11/2011 (5:13 pm)
Using Xcode 3 here. If you're using LLVM, stop that. If using GCC 4.2, I dunno what to suggest :(

(The badge is from the web somewhere :)
#9
04/13/2011 (7:07 am)
Well, thank you Ronny the problem really was using LLVM! Was that in big red letters somewhere in the TGB documentation and I didn't see it?

What also surprises me is that I used the original Torque2D.xcodeproj that comes with the default installation of TGB. Are the compiler settings somehow not saved in this?

Greets
Felix
#10
04/13/2011 (7:19 am)
No, trial and error was how I figured it out :)

The new methods of selecting SDK/compiler in Xcode 3.2.x don't seem to carry over all compiler settings. Just a glitch, but it's made me obsessively verify every darn setting on opening new projects!