Skipping cutscene stops sound (related to view loop frame sounds)

Started by tor.brandt, Sun 27/11/2016 16:50:23

Previous topic - Next topic

tor.brandt

So, in room 1 script I have:
Code: ags
function room_Load()
{
  NightAmbience = aOutside_ambience.Play(eAudioPriorityNormal, eRepeat);
  NightAmbience.Volume = 35;
}


NightAmbience is an AudioChannel* global variable.

First time room 1 is loaded, a cutscene starts (Cutscene1).
Cutscene1 ends with changing to room 2.

First time room 2 is loaded, another cutscene starts (Cutscene 2).
Cutscene2 ends in room 2.

In room 2 script I have:
Code: ags
function room_Load()
{
  NightAmbience.Volume = 10;
}


Now, if I let Cutscene2 run through on its own, NightAmbience keeps playing on a loop as it should, but if I SKIP Cutscene 2, the sound stops and is not resumed at any point.
If I skip Cutscene1, the sound keeps playing as it should - so there must be something going on with Cutscene2 specifically.
Both Cutscene1 and 2 are eSkipESCOnly, if that could weirdly have anything to do with it.

There is nothing in Cutscene 2 that should affect neither sounds nor the global variable NightAmbience.

Does anyone have an idea what could cause this problem?

EDIT: I've narrowed the problem somewhat down to something a bit weird...
The only other sounds in use in my game at the moment are two sounds that I associated with certain frames in my character's walk view.
I found that if I removed all the sounds from these frames, NightAmbience does NOT stop if I skip the cutscene.

I then tried adding the sounds to the walk frames one by one, and it seems that if the walk sounds are added to more than three frames, NightAmbience is stopped when skipping the cutscene.
I have four walk loops (up, down, left right), and if I e.g. add sound to two of the frames in the down loop and one of the frames in the left loop, there is no problem, but if I add sound to one more frame in the left loop, NightAmbience is stopped when skipping the cutscene.

Could this be some kind of audio channel problem? And why would it depend on how many of the walk frames have sound??

2nd EDIT: Actually, now I've narrowed it even more down.
It seems it's only if I add sound to more than one frame in my character's walk view's left loop.
This seems so weird! What could be the problem?

dayowlron

This is just a guess...
What happens if you change the priority of that sound? Possibly it is playing the sounds from the walking and one of them starts to use the last channel available then when another sound comes in it unloads that sound. Try changing the line to:
  NightAmbience = aOutside_ambience.Play(eAudioPriorityHigh, eRepeat);
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

tor.brandt

Quote from: dayowlron on Sun 27/11/2016 21:20:37
This is just a guess...
What happens if you change the priority of that sound? Possibly it is playing the sounds from the walking and one of them starts to use the last channel available then when another sound comes in it unloads that sound. Try changing the line to:
  NightAmbience = aOutside_ambience.Play(eAudioPriorityHigh, eRepeat);

That actually worked, thanks!:-D
I still don't see WHY it did, though... As mentioned, it was only if I had assigned sounds to more than one frame in the left loop that the sound would stop.
AND it would only stop if I skipped the cutscene, but not if I let the cutscene run through.
AND there are no other sounds in the game yet, so even if the two walk sounds should overlap (which I don't think they do, because the sound clips are quite short), there should be at most three sounds playing simultaneously, whereas AGS has 8 channelse, so no matter the sounds' priorities, there should be no problem, right?

Anyway, I set my NightAmbience to very high priority, and the walk sounds to very low, and now it seems to work.

If anyone has an idea WHY this should be necessary, please share :-\

dayowlron

Not totally sure why it works the way you have said and if someone knows better then correct me but you say that there should only be 3 sounds playing at any one time. There may be just 3 different sounds playing but the sounds are dynamically assigned to channels. If these sounds are in a walk loop and the sound has not completed when the walk cycle returns to the same frame it will start another copy of that sound so if the sounds however short they are are still playing when the cycle comes around again it will use another channel. This is just a guess but Perhaps the reason it stops if they skip the cutscene is because skipping the cutscene plays all of the commands really fast until it gets to the EndCutScene line. I do know for sure but one time i had problems with sounds within walking and cutscenes before, but i just decided to remove the sounds from the walking view.
Pro is the opposite of Con                       Kids of today are so much different
This fact can clearly be seen,                  Don't you know?
If progress means to move forward         Just ask them where they are from
Then what does congress mean?             And they tell you where you can go.  --Nipsey Russell

tor.brandt

Hmmm, I never thought of it that way, but it actually makes good sense.
It seems to work as long as I keep the walk sounds at very low priority, but I might end up removing them altogether just to be sure, since I will be having both a music track and an ambience track running throughout the game, and I wouldn't want any of them to stop accidentally.

Thanks for your help!

SMF spam blocked by CleanTalk