Game Development Community

Sound Bug

by Stefan Lundmark · in Torque Game Engine · 01/04/2005 (9:29 pm) · 11 replies

In our game, we have music (duh), using ogg files.

If you shoot your weapon, you can hear the fire sound. The background music continues to play as expected.

If you shoot full auto with the weapon, some of the fire sounds will skip. That's because the sound channels are filled up. No problemo, fixed that.

But, the music which plays in the background restarts.
This also happens inside our mainmenu if you click a button (which makes a sound) as fast as you can.

Is this also the buffer being completely full? This behaviour is in stock TGE.

Thanks.

#1
01/04/2005 (9:34 pm)
I've also noticed some wierd sound issues. Like my menu music will keep playing when I get in-game, but will repeat the same section over and over(broken record). I use alxstopall(); and alxstop($menumusic); before my client gets in game. That shouldn't be happening, I think TGE needs new audio code or something.
#2
01/04/2005 (9:53 pm)
Ya, same. I tried changing from alxstop($musichandle); to alxstopAll(); but the problem is the same.

Josh, do you use .ogg files for your sound effects or music? Maybe it doesn't matter. Well it shouldn't since it's already decoded when you hear it play. Oh well.
#3
01/04/2005 (10:04 pm)
To stop music you must do like this !!

change
alxplay($musicTrack) to
to
$inGameMusic = alxPlay($musicTrack);

So to to stop the music you use alxStop($inGameMusic);
#4
01/04/2005 (10:15 pm)
That's what I did Billy, I mentioned it in my second post.

Quote:
I tried changing from alxstop($musichandle); to alxstopAll(); but ........

I have had the exact procedure that you describe for 6 months, it doesn't work. I'll send you the alpha application when I see you on msn next and you can see.
#5
01/05/2005 (1:01 am)
I know how to stop the music, and it usualy stops. I use both alxStop($music); and $alxstopall(); at different times to make sure the musis stops, but it doesn't. :(
#6
01/05/2005 (1:52 am)
Huh? It usually stops and you know how to stop the music, but it doesnt? Please explain that again please :P
#7
01/05/2005 (3:51 am)
It's a bug. ;) It will usualy stop, but when it doesn't, it plays the same part of the track over and over(like a broken record). Untill I finaly type alxstopall(); in the console.
#8
01/05/2005 (5:40 am)
Its no bug :)
If you type like this in console $music = alxplay(aworkingaudiodescription);
then it starts playing.
To stop it type in console alxstop($music);
This works like a charm in SDK 1.3 audio with no changes.
#9
01/05/2005 (9:43 am)
But after you exit from mission in the fps starter mod and click start mission in main menu, it's as if there's two instances of the sound being played. And even if I stop it, and play it again in the way Billy said it still does the same thing, but only after starting the mission a second time. Any thoughts?
#10
01/17/2005 (3:11 pm)
Billy ScE

I'm still running this on a fresh 1.3 installation with only the file swapped out from a regular audiodescription. (which should be a profile, anyway)
It DOES NOT WORK, I told you. I've done everything you've suggested from the beginning already.


Josh: I changed a few things and now my sound doesn't abruptly stop anymore. It continues to go on and you can stop it like normal. I added a new audiodescription for music

$MusicAudioType     = 2;

new AudioDescription(MusicGui)
{
   volume   = 1.0;
   isLooping= false;
   is3D     = false;
   type     = $MusicAudioType;
};

Here is the audioprofile.
new AudioProfile(Mainmenu)
{
   filename = "launcher/audio/mainmenu.ogg";
   description = "MusicGui";
   preload = true;
};

I'm starting it by using this syntax:

$musicHandle = alxPlay(Mainmenu);

This works from what I can tell. BUT crashes on OpenALShutdown();
:(

I'll look into that, but I'm not sure at all why it's crashing.

[Edit]

The crash was caused by me placing a alxStop(); in the OnExit(); function, nevermind that. This should work perfectly fine!

[/Edit]
#11
01/17/2005 (4:12 pm)
It was my audio description that was causing the bug. I fixed it to looks like yours, thanks for posting your code.