Hi!
I have a weird problem in my game: sometimes playing an audio stops the background music.
I have narrowed down WHEN it happens, but I don't know why or how I can solve the problem.
After an intro screen, the player enters the main room. There I start the music in room_FirstLoad()
aKanji.Play(eAudioPriorityNormal, eRepeat);
Which works as expected. Later in the game, I play a sound when looking at an inventory item
aRubberDuck.Play();
This sometimes stops the background music and it doesn't start again.
The weirdest thing is, when this happens. Because it all depends on the first intro screen.
The full room script:
function room_AfterFadeIn()
{
StartCutscene(eSkipESCOnly);
Wait(6 * GetGameSpeed());
EndCutscene();
aStart.Stop();
player.ChangeRoom(1);
}
function room_Load()
{
gInventory.Visible = false;
aStart.Play(eAudioPriorityNormal, eOnce);
}
When I cancel the screen with ESC, everything is ok. But when I wait for the cutscene to finish, the aRubberDuck.Play() will stop the music later in the game.
What I intend to do is showing the intro screen and play the sound and only navigate to the main screen when the music has finished. When the user presses ESC, the game should stop the sound and switch to the main screen immediately.
My guess is, that aStart.Stop causes some internal error when the audio is not playing anymore, but I'm not sure.
Is my description clear? I know it sounds very confusing.
Is there a workaround for this problem?
Edit: I'm using AGS 3.3.3
I found a workaround for this issue. I now store the AudioChannel in a variable and then only call Stop on the AudioChannel, not on the AudioClip. Still, this is some weird behaviour of AGS.
I also had this same Music problem. Ags 3.2.1 somehow changed the Music properties setting on its own (roll)
I reset settings and now works.
They say strange is life (laugh)
Not sure why this got stickied ???
Anyway, it is solved for me with the workaround. Should I investigate the issue further and submit a bug ticket to the tracker?
Quote from: cat on Fri 23/01/2015 13:39:53
Anyway, it is solved for me with the workaround. Should I investigate the issue further and submit a bug ticket to the tracker?
Yes please, if you can confirm that its an engine behavior and not a scripting bug, put this on tracker. It is difficult to track such problems in forum threads.
I've got the same problem. Sometimes the music just stops, and dono why. Sometimes it loops properly.
Hmm, I vaguely remember this thread. I do not have any immediate ideas though.
I did not notice if cat actually open an issue in the tracker about this.
I will try to look into this using cat's script example; hopefully it will cause same error.
I tried to use cat's example script, but could not reproduce the erroneous behavior.
I need more information on this error; ideally an exact steps to reproduce it (a project or script with instructions how to reach the bug).
Sorry for not replying earlier, I just noticed that there was a follow-up on this topic.
Back then I tried to create a sample project that reproduces the error, but I was not able to do so. It was not reproducible.
I still don't know what exactly caused the problem.