Game Development Community

Problem with AudioLooping2D

by Mike Stoddart · in Torque Game Engine · 09/06/2002 (12:35 pm) · 8 replies

Has anyone successfully used the AudioLooping2D audio profile? I'm trying to use it to create an ambient background sound.

When I use this profile, all other sounds no longer play.

This is my code:

Quote:datablock AudioProfile(AmbientSound)
{
filename = "~/data/missions/test1/sounds/wind.wav";
// description = "AudioDefaultLooping3d";
description = "AudioLooping2D";
preload = false;
};

alxPlay(AmbientSound);

I've also tried these:

Quote:ServerPlay2D(AmbientSound);
%player.client.play2D(AmbientSound);

Any ideas?

I tried this on Release 1.1.2, and I get the same problem.

Thanks

#1
09/06/2002 (1:41 pm)
is this going to play all the time everywhere on the map? i think you need to create a new control for it, like a music control. There is a tutorial somewhere around here so do a little searching.
#2
09/06/2002 (1:42 pm)
A music control? I've never heard of that. It's an ambient sound that each player will always hear while they're playing a mission. For example, it will be the sound of wind, or it might have sounds from a battle way off in the distance. It won't be just at one location on the map.

I followed the coding for this post:

www.garagegames.com/index.php?sec=mg&mod=forums&page=result.thread&qt=4647

Which does a similar thing with Ogg Vorbis music, but as soon as I do alxPlay(AmbientSound) or something similar, ALL sound in the game stops playing.

This must be an engine bug?
#3
09/06/2002 (1:50 pm)
I'm currently using mission music. Pretty sure that was added along with the ogg code. You could use an ambient sound track for what you're describing.

Here's the audioProfiles.cs section of code I currently have. It's in the client/scripts folder.
new AudioDescription(AudioMusic)
{
   volume   = 1.0;
   isLooping = true;
   isStreaming = true;
   is3D     = false;
   type     = $DefaultAudioType;
};

new AudioProfile(Mission_Music) {
      fileName = "~/data/sound/music/Al_Basrah.ogg";
      description = "AudioMusic";
      preload = "0";
};
#4
09/06/2002 (1:53 pm)
Same problem. If I use this audio profile:

Quote:new AudioDescription(AudioMusic)
{
volume = 1.0;
isLooping = true;
// isStreaming = false;
is3D = false;
type = $DefaultAudioType;
};

and this in my mission file:

Quote: new AudioProfile(AmbientSound)
{
filename = "~/data/missions/test1/sounds/wind.wav";
description = "AudioMusic";
};

All sounds stop when I do alxPlay(AmbientSound).

Thanks
#5
09/06/2002 (2:01 pm)
If I do this at the console:

Quote:echo(alxPlay(AmbientSound));

I get:

Quote:-2147483647

Guess it's time to hit the C++ code and the debugger.
#6
09/06/2002 (2:05 pm)
yeah :(
There must be something wrong in the code. I can have music and lot's of sfx playing at the same time without any problems. I'm using the stable 1.1.2 release with the updated ogg code at the moment. Good luck. Gotta fly. I have a meeting in a bit with the rest of the people I'm working with.
#7
09/06/2002 (2:12 pm)
Thanks Sabre. Can anyone from GG comment on this as a potential bug?

Thanks
#8
09/16/2002 (4:56 pm)
Following on from this, I wanted to try to play a sound when the mouse is moved over a bitmap button. I changed the control to:

Quote: new GuiBitmapButtonCtrl() {
profile = "GuiDefaultProfile";
horizSizing = "relative";
vertSizing = "bottom";
position = "504 500";
extent = "120 50";
minExtent = "8 8";
visible = "1";
command = "quit();";
helpTag = "0";
lockMouse = "0";
bitmap = "./quitNormal.png";
HighlightBitmap = "./quitHighlight.png";
wrap = "0";
soundButtonOver = "AudioButtonOver";
};

And the AudioButtonOver profile exists in audioProfiles.cs. However, I don't hear any sound when I move the mouse over the button.

Are there problems with 2D sound, or am I making simple, stupid mistakes? I've double checked, and triple checked my code and I really can't see anything wrong.

Thanks