Multiple sound & music problem
by Pavel Tovarys · in Torque Game Builder · 01/03/2007 (5:42 am) · 14 replies
Hello,
When I play music and play a several of other samples at once, the music is stopped (or it starts to play again, when it is looped). I tested it on 1.1.1 and older versions of TGB. Anybody can help me with this problem?
The source:
$GuiAudioType = 1;
$GuiMusicType = 2;
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(musicProfile)
{
volume = 1.0;
isLooping = true;
isStreaming = true;
is3D = false;
type = $GuiMusicType;
};
new AudioProfile(SND_EXPLOSION)
{
filename = "game/data/audio/explosion.ogg";
description = "AudioNonLooping";
preload = true;
};
new AudioProfile(MUSIC_1)
{
filename = "game/data/music/Playground.ogg";
description = "musicProfile";
preload = false;
};
function play_music(%music)
{
$music = alxPlay(%music);
}
function play_sound(%sound)
{
%channel = alxPlay(%sound);
return %channel;
}
When I play music and play a several of other samples at once, the music is stopped (or it starts to play again, when it is looped). I tested it on 1.1.1 and older versions of TGB. Anybody can help me with this problem?
The source:
$GuiAudioType = 1;
$GuiMusicType = 2;
new AudioDescription(AudioNonLooping)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $GuiAudioType;
};
new AudioDescription(musicProfile)
{
volume = 1.0;
isLooping = true;
isStreaming = true;
is3D = false;
type = $GuiMusicType;
};
new AudioProfile(SND_EXPLOSION)
{
filename = "game/data/audio/explosion.ogg";
description = "AudioNonLooping";
preload = true;
};
new AudioProfile(MUSIC_1)
{
filename = "game/data/music/Playground.ogg";
description = "musicProfile";
preload = false;
};
function play_music(%music)
{
$music = alxPlay(%music);
}
function play_sound(%sound)
{
%channel = alxPlay(%sound);
return %channel;
}
#2
Try to change isStreaming to false and look.
01/21/2007 (10:25 pm)
Probably the problem with HW driver and OpenAL support on PC.Try to change isStreaming to false and look.
#3
01/22/2007 (3:23 am)
Igor: Yes, I tried it and I had the same problem. And I have the same problem on my PC and on my Mac and some of our players reported it as a bug, so it is not only my computer.
#4
01/22/2007 (6:21 am)
Have you used unmodified version of TGB? May be it is a memory corruption or leaks
#5
01/22/2007 (6:39 am)
Igor: I have this problem with all games I created in TGB. Some of them use modified TGB, but some of them don't..
#6
01/22/2007 (10:46 pm)
I have no problem with it, your results is weird. How many channels you are using?
#7
It is happened, when I try to play a lot of sound samples at once - when the played sounds reach some count, it looks like the new sounds are still played, but the old sounds (or music) are stopped.
01/23/2007 (2:12 am)
Igor: I don't change any default sound settings, so I'm not sure how many channels there are.It is happened, when I try to play a lot of sound samples at once - when the played sounds reach some count, it looks like the new sounds are still played, but the old sounds (or music) are stopped.
#8
Check this out and add new:
$GuiAudioType = 1;
$GuiMusicType = 2;
(max 32)
01/23/2007 (3:45 am)
Ok. The field named 'type' in AudioDescription is represent the audio channel, i'm mention it. There is limitation how many sounds can be played in one channel at once. Try to use more channels, ie. not only 1 and 2.Check this out and add new:
$GuiAudioType = 1;
$GuiMusicType = 2;
(max 32)
#9
01/23/2007 (4:10 am)
I understand, but I play only one music stream, so there is only one sound in the second channel, so I have no idea, how it could fix this problem :(
#10
just put this in emtpy project in gameScripts\game.cs and try it (ogg files also is need :) )
01/23/2007 (7:04 am)
I've just try you code, and everything is ok:$sndchannel = 1;
$muschannel = 2;
new AudioDescription(soundDesc)
{
volume = 1.0;
isLooping= false;
is3D = false;
type = $sndchannel;
};
new AudioDescription(musicDesc)
{
volume = 1.0;
isLooping = true;
isStreaming = true;
is3D = false;
type = $muschannel;
};
new AudioProfile(expl)
{
filename = "~/data/audio/explosion.ogg";
description = "soundDesc";
preload = true;
};
new AudioProfile(music)
{
filename = "~/data/audio/Playground.ogg";
description = "musicDesc";
preload = false;
};
moveMap.bind(keyboard, a, toggleSound);
moveMap.bind(keyboard, z, toggleMusic);
function toggleMusic(%make)
{
if (%make)
{
alxPlay(music);
}
}
function toggleSound(%make)
{
if (%make)
{
alxPlay(expl);
}
}just put this in emtpy project in gameScripts\game.cs and try it (ogg files also is need :) )
#11
It looks like it is more often, when the FPS is lower..
01/23/2007 (9:13 am)
Heh, it's interesting now - it works well. So I added it directly to the game and it is ok, when the game is stopped, but the same problem, when the game is running.. so the problem could be in the game, BUT I have the same problem in different games. Phantasia 2 is from 90% different then Phantasia and ArchMage 100%, but the same problem.It looks like it is more often, when the FPS is lower..
#12
Or may be problem with ogg files? Do you play it in winamp for example?
What audio codec (software) for OGG is installed in system?
01/24/2007 (1:03 am)
Hm, if this occur when FPS is low, may be the point is optimize a game?Or may be problem with ogg files? Do you play it in winamp for example?
What audio codec (software) for OGG is installed in system?
#13
Maybe there is a problem with refreshing the sound buffers if the engine is heavy..
01/24/2007 (10:00 am)
I use the standard vorbis tool to convert the ogg.Maybe there is a problem with refreshing the sound buffers if the engine is heavy..
#14
01/24/2007 (10:59 pm)
While 'isStreaming' set true the engine does nothing... DMA is using.
Torque Owner Joshua Dallman
Default Studio Name