AGS 3.1 now available!

Started by Pumaman, Tue 04/11/2008 15:18:23

Previous topic - Next topic

Ryan Timothy B

#40
Certainly..
http://www.bryvis.com/roadracer/sound15.ogg

Since the problem still occurs even though it's longer than a second, I'll try pumping up the silence to 3 seconds in length.
EDIT:  Still with no luck.  I wouldn't doubt if it's my programming.. I'm like a monkey at a keyboard.   :D

Pumaman

Well, I tried a PlaySound(15) with that sound and it was fine. What exactly is happening to you, and how have you scripted the PlaySound commands?

Ryan Timothy B

#42
Code: ags
if (IsChannelPlaying(4)==1) StopChannel(4);
PlaySoundEx(15, 4); 


The script is a big mess of functions and what-not, but the only part that plays audio clip 15 is that part.
95% of the time that clip is played (sometimes more, sometimes less), it will play without any problems whatsoever.  If you're really keen on figuring out what my problem is, I could always send you the entire uncompiled game and you can crash into walls over and over until the problem occurs. :)  AND have fun while doing it! :P

Also, is it unusual for repeating music to suddenly stop playing?  When I crash into the walls repeatedly, having all the sound channels used, after a while the music stops.  And ismusicplaying() still registers as if it's playing.

Anyway, I'm really not too worried about the sound glitch for this game, hitting walls is something the player isn't supposed to be doing.  So it could be like an audibly annoying lesson for them NOT to do it again.  :P

EDIT:  I feel like I'm plaguing this thread.. I've been getting this error message when I go from script to script today.  It's been like 5 times now.
Code: ags

Error: StartIndex cannot be less than zero.
Parameter name: startIndex
Version: AGS 3.1.0.60

System.ArgumentOutOfRangeException: StartIndex cannot be less than zero.
Parameter name: startIndex
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at AGS.Editor.ScintillaWrapper.CheckFunctionForLocalVariables(Int32 currentPos, ScriptFunction func, String scriptExtract)
   at AGS.Editor.ScintillaWrapper.GetListOfLocalVariablesForCurrentPosition(Int32 currentPos)
   at AGS.Editor.ScintillaWrapper.FindLocalVariableWithName(Int32 startAtPos, String nameToFind)
   at AGS.Editor.ScintillaWrapper.GetFinalPartOfExpression(Int32 currentPos, ScriptStruct& memberOfStruct, Boolean functionsOnly)
   at AGS.Editor.ScintillaWrapper.ShowCalltip(Int32 openingBracketPos, Int32 parameterIndex, Boolean functionsOnly)
   at AGS.Editor.ScintillaWrapper.scintillaControl1_DwellStart(Object sender, DwellStartEventArgs e)
   at Scintilla.ScintillaControl.DispatchScintillaEvent(SCNotification notification)
   at Scintilla.ScintillaControl.WndProc(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
   at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Pumaman

Quote from: Ryan Timothy on Mon 22/12/2008 00:36:19
Code: ags
if (IsChannelPlaying(4)==1) StopChannel(4);
PlaySoundEx(15, 4); 


The script is a big mess of functions and what-not, but the only part that plays audio clip 15 is that part.
95% of the time that clip is played (sometimes more, sometimes less), it will play without any problems whatsoever.

Is that bit of script in repeatedly_execute or some sort of place where it could be running too many times? When the problem happens, can you place a breakpoint on that PlaySoundEx line and see if the script is repeatedly running there?

QuoteAlso, is it unusual for repeating music to suddenly stop playing?  When I crash into the walls repeatedly, having all the sound channels used, after a while the music stops.  And ismusicplaying() still registers as if it's playing.

That sounds pretty unusual to me. I presume you haven't changed the music volume down to make it silent?

QuoteEDIT:  I feel like I'm plaguing this thread.. I've been getting this error message when I go from script to script today.  It's been like 5 times now.
Error: StartIndex cannot be less than zero.

Next time that happens can you post here what your mouse cursor is hovering over in the script? It looks like an error trying to pop-up the help window when you hover over a variable/function.

Ryan Timothy B

Quote from: Pumaman on Mon 22/12/2008 19:50:24
Is that bit of script in repeatedly_execute or some sort of place where it could be running too many times?
Negative.  It only accesses it whenever the speed is higher than zero and a collision was detected.
I even (just now just to absolutely make sure) put in some fail safe booleans so the collision sound will only happen once if the front end detects collision, until you put it in reverse.

QuoteWhen the problem happens, can you place a breakpoint on that PlaySoundEx line and see if the script is repeatedly running there?
I wasn't sure what you meant by breakpoint.  So I installed a fail safe button.  A.
If you press A it sets a boolean to TRUE and it runs this:
Code: ags

  if (keycode==65) { //press A
    a=true;
    StopChannel(1);
    StopChannel(2); //just for the sake of doing it
    StopChannel(3);
    StopChannel(4);
    StopChannel(5);
    StopChannel(6);
    StopChannel(7);
    StopAmbientSound(1);
    StopAmbientSound(2); //just for the sake of doing it
    StopAmbientSound(3);
    StopAmbientSound(4);
    StopAmbientSound(5);
    StopAmbientSound(6);
    StopAmbientSound(7);
    StopMusic();
    }

At first I tried stopping only the channel that the looping sound was played on.  Then tried stopping ambient sound on that channel just in case.  Then went all out and tried stopping every single channel including music.
And prevented the function containing the only playsoundex/playambientsound's, from running.
Still the sound looped for minutes on end (perhaps infinite).
I'm now pretty confident this is a weird AGS glitch.  Progz seemed to have heard of it before, so maybe he knows more about it.

QuoteThat sounds pretty unusual to me. I presume you haven't changed the music volume down to make it silent?
I again double checked to see if I could have been wrong.  The only time setdigitalmastervolume command is run whenever a new room is loaded or esc is pressed.

QuoteNext time that happens can you post here what your mouse cursor is hovering over in the script? It looks like an error trying to pop-up the help window when you hover over a variable/function.
I can tell you approximately what I did from the 2 times this happened.
I had 5 room scripts I needed to update to match the first script.
I copied the top half of the  function room_RepExec() on the first script.  Had the second script already opened, clicked on it, deleted the top half of the   function room_RepExec()  and pasted.  I think when I clicked to go back to the first script is when I had the error.

When I say I copied and deleted the top half of the function room_RepExec(), this is what I mean:
Code: ags

function room_RepExec()
{
  [...plus the code....]
  [..I also didn't copy or delete the bottom half of the script with the closing bracket..]


I've tried it twice today to see if I could encounter this again, and it won't.

Pumaman

Quote from: Ryan Timothy on Mon 22/12/2008 22:08:55
Negative.  It only accesses it whenever the speed is higher than zero and a collision was detected.
I even (just now just to absolutely make sure) put in some fail safe booleans so the collision sound will only happen once if the front end detects collision, until you put it in reverse.

Would you be able to upload the game so that I can try and reproduce the problem?

QuoteI wasn't sure what you meant by breakpoint.  So I installed a fail safe button.  A.

What I mean is, click on the line of script where PlaySoundEx is, and press F9. The line should turn red, and then when you use F5 to run the game, it should pause whenever the script gets to this line. That way, you can see whether this line of script is somehow getting repeatedly called, or whether you are just playing the sound once and AGS is repeating it without being asked to.

QuoteI can tell you approximately what I did from the 2 times this happened.
I had 5 room scripts I needed to update to match the first script.
I copied the top half of the  function room_RepExec() on the first script.  Had the second script already opened, clicked on it, deleted the top half of the   function room_RepExec()  and pasted.  I think when I clicked to go back to the first script is when I had the error.
I've tried it twice today to see if I could encounter this again, and it won't.

Interesting, thanks. I'll see if I can reproduce it.

Ryan Timothy B

#46
Quote from: Pumaman on Mon 22/12/2008 22:42:47
Would you be able to upload the game so that I can try and reproduce the problem?

Here you go CJ.
I deleted everything from the game so the file size wouldn't be as large.  Added a small room with black boundaries.
I kept anything to do with audio in the game; that includes the music player.  Press 'P' if you want to stop the music.

The best location to reproduce the audio glitch would be between the red car and wall.  Just go back and forth and you should hear it within 20-40 hits (usually).

http://www.bryvis.com/roadracer/rr_audio_test.zip


One thing I had actually never thought of doing until this very second, was completely swapping sound15 (the crashing sound) with a completely different sound.  I'll give that a shot and let you know.
EDIT: Errr.. nevermind.. still happens.

Pumaman

Thanks for uploading the game.

The bug seems to be a problem in AGS when you switch a sound channel from playing a normal sound to an ambient sound, or vice versa, without stopping the channel first. I'll look into a fix, but in the meantime a workaround would be to use Channel 4 only for PlaySoundEx commands and move the Ambient Sound 11 onto a different channel.

Ryan Timothy B

#48
That's odd.  I'm pretty sure I have a stop channel each time before playing any playsoundex or ambients.
Anyway, either way, yes I am playing both an ambient and playsoundex on the same channel.  I'll look at my sounds and see if there is a more organized possibility while separating the two types of sound.

Thanks for looking at it.

EDIT:  This seems to, without a doubt, be the problem.  Which it is now working at full steam with no audio glitches.  Yay.
If you end up not getting around to solving this AGS glitch before releasing 3.1.2, I recommend putting a warning in the Help file to possibly prevent any future glitches.  :P
Thanks again, CJ!

SMF spam blocked by CleanTalk