Sound Bug Using "Set Fade Effect To New Scene"

  • #1, by SDMonoTuesday, 22. April 2014, 18:11 7 years ago
    Hi!!!

    Ok here is the thing. I believe it just happens when I use the "Fade Out" effect under "Set Fade Effect To New Scene, all the other ones seem to work fine.

    My Setup: 3 scenes... at the beginning of each scene I play a sound and loop it infinitely (3 scene the same sound loop). You can go from 1st scene to the 2nd scene and from the 2nd scene to the 3rd scene and from the 3rd scene back to the 1st scene.

    I use the "Fade Out" effect from the 1st to the 2nd scene. (just to see what would happen)

    All works well from the 1st to the 2nd the sound from the 1st scene stops and the sound in the 2nd scene starts (because you cannot play the same sound and let it play changing scenes). Now when I go from the 2nd to the 3rd it seems as if the sound from the 2nd scene does not stop and plays on top of the sound loops from the 3rd scene. Now I got two sound loops playing at the same time when I only should have one.

    Like I said this just happens with the "Fade Out" effect.

    Not sure if its a bug but something is not right and I am 99% sure it has nothing to do with my setup.

    Any ideas?

    Forum Fan

    148 Posts


  • #2, by SDMonoWednesday, 23. April 2014, 18:03 7 years ago
    Ok I made a new scene just to check if it had anything to do with my game. Well it didnt!

    I attach a download link to the test project I made so you guys can check it out... let me know. (you have to walk through the first two doors and the sound error will happen.)

    Forum Fan

    148 Posts

  • #3, by afrlmeWednesday, 23. April 2014, 18:28 7 years ago
    downloading, will check in a wee bit.

    Imperator

    6846 Posts

  • #4, by afrlmeWednesday, 23. April 2014, 20:06 7 years ago
    Only seemed to do it on certain fade effects like the "fade out" one. I counteracted it by creating an at end of scene action & adding a stop active sound action part linked to the alarm sound you added.

    Also it is better practice to only use one instance of at begin of scene & at end of scene actions per scene.

    Imperator

    6846 Posts

  • #5, by SDMonoWednesday, 23. April 2014, 20:19 7 years ago
    Yes all the other effects seem to work.

    I usually try to use just one instance of at the beginning of a scene. But why do you say its better practice? Could it cause a problem at some point?

    Forum Fan

    148 Posts

  • #6, by afrlmeWednesday, 23. April 2014, 20:55 7 years ago
    It's possible. Makes more sense for it to have one lot of actions to go through on scene start rather than having it triggering multiple actions at the same time. Cleaner method. You had 2 at begin of scene actions for the first scene in the .ved you sent me & I didn't see any reason for it.

    Did you try adding the at end of scene action I mentioned & stopping the sound?

    If you are using 4.0 beta, then technically you could actually play sounds using Lua script & control a single sound in a loop until you want it to end or even store the offset (current play time of the sound) into a variable or value & have it resume from the exact playtime in the next scene.

    I'm not going to go over how to sort that out right now though. But you can check the player commands page in the wiki if you like for some examples & documentation on each of the Lua sound functions. http://wiki.visionaire-tracker.net/wiki/Player_Commands

    I would share my hand written pages for the commands which are much easier to understand than the auto generated documentation. I've only written up a couple of the audio functions so far, so not much point.

    Imperator

    6846 Posts

  • #7, by SDMonoWednesday, 23. April 2014, 21:36 7 years ago
    I just learned how to call an action. Makes a lot of things easier. hehehe

    In my game I have a cut scene and at the end it changes to a new scene. I had to use the Fade Out and Fade In action and time it just right with a Pause action so that the sound wouldn't cut out. It's a pain in the ass to do it like that.

    I love the idea of storing the offset of the sound and let the loop continue playing where it left off. I have a few scenes where the same sound loop continues but right now well it stops and than starts again in the next scene... annoying to say the least. I really have to get my head around LUA.

    Forum Fan

    148 Posts

  • #8, by afrlmeWednesday, 23. April 2014, 22:12 7 years ago
    Yeah calling actions & the called by other action actions are very useful things indeed.

    It is Lua not LUA. wink
    It's actually quite easy to learn & pick up after you wrap your head around the basics. It's kind of similar to some of the web design code formats such as jquery.

    You do know that the actual timing could potentially be off by a tiny bit on someone elses computer? The mainloop handler for the engine actually returns by a few ms differently on each loop. According to my tests of it with the getTime() function. I'm not sure how accurate it is to the ms. I think it depends on how powerful the computer is? Again not 100% sure.

    Imperator

    6846 Posts

  • #9, by SDMonoThursday, 24. April 2014, 04:28 7 years ago
    Hmm... for starters I got the sound to play and to loop using a script. Yippie, my first "script"!!!

    Now somehow I have to get the offset of the sound before the game changes to the next scene and let it start at the saved offset in the next scene. AAAAHHHH

    A few ms difference wont be a problem I hope... cannot be any worse than it is now. smile

    Forum Fan

    148 Posts

  • #10, by afrlmeThursday, 24. April 2014, 14:50 7 years ago
    to get the offset you need to use the getSoundProperty function & you also need to get the active sounds id.

    Lucky for you I actually already wrote up my own page for getSoundProperty function @ http://wiki.visionaire-tracker.net/wiki/GetSoundProperty_%28...

    Ideally you need to store the offset, id & path (if you are getting for multiple sounds) into variables or a table. Table would be better. & then you would stop the sound & then play it again on new scene.

    Alternatively there is actually a toggle pause function which you could use instead I think. Pause just before switching scenes & resume on next scene. You need to get sound id for that too I think.

    Imperator

    6846 Posts

  • #11, by SDMonoThursday, 24. April 2014, 15:10 7 years ago
    Thank you so much... you are always a great help!!!

    I will see what I can do. Will report back to you later!!! wink

    Forum Fan

    148 Posts

Write post