Jibble

Author Topic: Audio linked to animation frame cutting off other sound  (Read 86 times)

I have an animation with a sound linked to one of its frames and when this sound plays, the sound that was playing before it gets cut off.

Code: Adventure Game Studio
  1.     streetatmo1 = aWhisper1.Play(eAudioPriorityNormal, eRepeat);
  2.    
  3.     cCharlie.LockView(27);
  4.     cCharlie.Animate(2, 5, eOnce, eBlock);
  5.     cCharlie.LockView(28);
  6.     cCharlie.Animate(2, 5, eOnce, eBlock);
  7.     cCharlie.LockView(29);
  8.     cCharlie.Animate(2, 5, eOnce, eBlock);  // aWhisper1 gets cut off here, when the frame with audio plays
  9.  
  10.  


Useful things to know, maybe:

- streetatmo1 is a global Audiochannel which I've been using for ambient sounds. I've also tried defining an Audiochannel* instance on the fly instead. Same issue.
- aWhisper1 is defined as a "Sound" in the editor and I have set Maxchannels = 0 for sounds.
- View 29 is the one that has the frame with the audio clip linked to it.
- Apart from this code, there's a music track playing in the background. This track is defined as "Music" in the editor (maxchannels = 1) and doesn't get cut when the linked frame sound plays.
- Also tried upping the priority of aWhisper1 to "high". No dice.

Any idea what might be happening here?  :confused:
« Last Edit: 10 Sep 2019, 17:35 by Laura Hunt »

Re: Audio linked to animation frame cutting off other sound
« Reply #1 on: 11 Sep 2019, 08:24 »
Figured it out. Of course, the problem was in the part of the code that I didn't think of including:

Code: Adventure Game Studio
  1.     streetatmo1 = aWhisper1.Play(eAudioPriorityNormal, eRepeat);
  2.    
  3.     cCharlie.LockView(27);
  4.     cCharlie.Animate(2, 5, eOnce, eBlock);
  5.     cCharlie.LockView(28);
  6.     cCharlie.Animate(2, 5, eOnce, eBlock);
  7.     cCharlie.LockView(29);
  8.     cCharlie.Animate(2, 5, eOnce, eBlock);
  9.     cCharlie.LockView(28);
  10.     cCharlie.Animate(2, 5, eOnce, eNoBlock);
  11.  
  12.     dCharlieFinal.Start();
  13.     streetatmo1.Stop();

I thought the Stop statement would be executed AFTER the script returned from the dialog. Turns out that dialogs are run at the end of the function where they are inserted, as per the manual: "NOTE: The conversation will not start immediately; instead, it will be run when the current script function finishes executing."  (roll)

Anyway, non-issue solved, but maybe my stupidity will be useful to somebody in the future.

Snarky

  • Global Moderator
  • Private Insultant
    • Best Innovation Award Winner 2018, for his numerous additions to the AGS open source ecosystem including the new Awards Ceremony client and modules
    • Snarky worked on one or more games that won an AGS Award!
    •  
    • Snarky worked on one or more games that was nominated for an AGS Award!
Re: Audio linked to animation frame cutting off other sound
« Reply #2 on: 11 Sep 2019, 09:01 »
Thanks for posting the explanation!
It's always annoying when people just post "nvm, figured it out".