A few questions about music
by Orion the Hunter · in Torque Game Builder · 09/12/2012 (12:54 pm) · 2 replies
Hello,
I am trying to make a level in my game were you can jump in water and swim around. What I want to happen is as soon as the player hits the water trigger, it adds more instruments to the track. All I need to do is make it so that there is two songs playing. One is at full volume, the other is playing silently in the background, but not paused. It would be like listening to a blank music file which is technically playing, it's just there is nothing to hear. So, you can hear the normal music, but then as soon as you hit the water it get's more elaborate because it turns the volume on for the other song to make it so that the melody is the same, but it just sounds different. As far as I know, there is no support for two music files playing at the same time in TGB.
If any of you were too lazy to read that big long and finger-aching paragraph, :P I basically want something that plays two songs at the same time.
Thanks!
I am trying to make a level in my game were you can jump in water and swim around. What I want to happen is as soon as the player hits the water trigger, it adds more instruments to the track. All I need to do is make it so that there is two songs playing. One is at full volume, the other is playing silently in the background, but not paused. It would be like listening to a blank music file which is technically playing, it's just there is nothing to hear. So, you can hear the normal music, but then as soon as you hit the water it get's more elaborate because it turns the volume on for the other song to make it so that the melody is the same, but it just sounds different. As far as I know, there is no support for two music files playing at the same time in TGB.
If any of you were too lazy to read that big long and finger-aching paragraph, :P I basically want something that plays two songs at the same time.
Thanks!
#2
new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping = true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(BaseMusic)
{
filename = "~/data/audio/Base.ogg";
description = "AudioLooping";
preload = false;
};
new AudioProfile(OverlayMusic)
{
filename = "~/data/audio/Overlay.ogg";
description = "AudioLooping";
preload = false;
};
function startMusic()
{
$musicHandle1 = alxPlay(BaseMusic);
alxSourcef($musicHandle1, "AL_GAIN",AudioLooping.volume);
$musicHandle2 = alxPlay(OverlayMusic);
alxSourcef($musicHandle2, "AL_GAIN",0);
}
function turnonOverlay()
{
alxSourcef($musicHandle2, "AL_GAIN",AudioLooping.volume);
}
function turnOffOverlay()
{
alxSourcef($musicHandle2, "AL_GAIN",0);
}
You could always try making two AudioDescriptions too, if this doesn't work quite right as is.
09/13/2012 (3:43 pm)
Have you tried playing two songs at the same time? It should be something like:new AudioDescription(AudioLooping)
{
volume = 1.0;
isLooping = true;
is3D = false;
type = $GuiAudioType;
};
new AudioProfile(BaseMusic)
{
filename = "~/data/audio/Base.ogg";
description = "AudioLooping";
preload = false;
};
new AudioProfile(OverlayMusic)
{
filename = "~/data/audio/Overlay.ogg";
description = "AudioLooping";
preload = false;
};
function startMusic()
{
$musicHandle1 = alxPlay(BaseMusic);
alxSourcef($musicHandle1, "AL_GAIN",AudioLooping.volume);
$musicHandle2 = alxPlay(OverlayMusic);
alxSourcef($musicHandle2, "AL_GAIN",0);
}
function turnonOverlay()
{
alxSourcef($musicHandle2, "AL_GAIN",AudioLooping.volume);
}
function turnOffOverlay()
{
alxSourcef($musicHandle2, "AL_GAIN",0);
}
You could always try making two AudioDescriptions too, if this doesn't work quite right as is.
Vlad I
Default Studio Name
And then lower your volume on the music being played?