Game Development Community

Looping music not returning handle with alxPlay

by Aloshi · in Torque Game Builder · 04/29/2010 (8:19 pm) · 2 replies

Alright, so I'm trying to play some background music. I plan on fading it out later, so I need to get the handle so I can change its volume. This is the code I'm using:

new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping= true;
is3D = false;
type = 1;
};

new AudioProfile(GameMusic)
{
filename = "~/data/audio/music.ogg";
description = "AudioLooping";
preload = true;
};

I'm starting the music with this when the level loads:
$music = alxPlay(GameMusic);

It plays the sound and loops it, as it should. However, if I echo $music, I get -2147483647...which makes no sense and isn't a valid handle at all. I've tried using this same sound as a .wav file as well, but then it completely freezes, so it could just be my sound file. The weird thing is, when I set isLooping to false in the audioDescription, it works fine and I get the actual handle. Help?

#1
04/30/2010 (5:02 am)
See what happens with a different sound file.
#2
04/30/2010 (2:04 pm)
Alright, I just tried a completely different .ogg and .wav file. I still get the same incorrect handle, but the different .wav file doesn't freeze the game.