How the new sound system works?

  • #10, by afrlmeFriday, 27. April 2018, 16:34 6 years ago
    Your screenshot doesn't look right or is that an edit you made?

    Imperator

    7278 Posts


  • #11, by stered86Friday, 08. June 2018, 10:14 6 years ago

    Long story short, the new sound system works a little bit like a music production daw or sound editor. You can use it to assign sounds to specific audio channels [...]
    I'm interested in this particular feature. I don't know if I understood it correctly, I'll try to explain myself: I'm designing a game that has got a "Broken Sword" style audio system, which means there usually aren't background musics but just occasional sounds that play when the player triggers an action or solves a riddle. 

    My only concern is: let's assume the player solves a riddle and a sound starts; then the player quickly does something different that triggers another sound; the two sounds would end up mixing themselves, spoiling the atmosphere.

    I remember that in another engine there was this function where you could play a sound in a channel, then if you played another sound in that same channel the engine would automatically fade between the two sounds. Can this new system allow me to achieve something like this? And if so, how can I learn to use it?

    Newbie

    62 Posts

  • #12, by afrlmeFriday, 08. June 2018, 12:04 6 years ago
    From what I remember, most of the audio cues in Broken Sword were very short unless they led to cutscenes in which a longer piece of music usually played instead of a short sound.

    I've just woken up & can't really wrap my head around what you are saying yet, but either way I don't yet know what is possible with the new sound engine. I don't know if Simon has 100% finished working on it & there's currently no documentation explaining what everything in the new sound engine is for or what it does.

    Imperator

    7278 Posts

  • #13, by stered86Friday, 08. June 2018, 12:38 6 years ago
    Yes, most of the time the sounds were very short, but there were times where you could hear two sounds overlapping. In Broken Sword this issue was solved as I tried to explain before: the engine faded between the two sounds automatically.

    I'll just wait for some documentation to be produced, then!

    Another issue I wanted to point out regarding the sound system: one thing I didn't like in Visionaire 4 was the fact that when you changed scene while a sound was playing, the sound was automatically stopped. I haven't had the time to test it yet, I hope in Visionaire 5 this situation can be avoided!

    Newbie

    62 Posts

  • #14, by afrlmeFriday, 08. June 2018, 13:17 6 years ago
    Just tested changing between scenes after I used a play sound indefinitely action part. If you fade to the next scene when using change scene then it will fade out & stop the sound. If you change to the next scene instantly then the sound will carry on playing. If you want fade then you could do it manually with an interface or with Lua script & changing the scene brightness - or game brightness/contrast if you use the shader tool kit or a custom shader, but the scene brightness won't affect interfaces & the shader toolkit option depends on whether or not you have told it to omit interfaces, fonts, etc.

    Imperator

    7278 Posts

  • #15, by stered86Friday, 08. June 2018, 14:00 6 years ago
    This could be a good solution, I never thought about it.
    Thank you very much, you're always a huge help!

    Newbie

    62 Posts

  • #16, by afrlmeFriday, 08. June 2018, 14:10 6 years ago
    No problem at all mate. wink

    Imperator

    7278 Posts

  • #17, by stered86Tuesday, 09. October 2018, 12:55 6 years ago
    Just tested changing between scenes after I used a play sound indefinitely action part. If you fade to the next scene when using change scene then it will fade out & stop the sound. If you change to the next scene instantly then the sound will carry on playing. If you want fade then you could do it manually with an interface or with Lua script & changing the scene brightness - or game brightness/contrast if you use the shader tool kit or a custom shader, but the scene brightness won't affect interfaces & the shader toolkit option depends on whether or not you have told it to omit interfaces, fonts, etc.
    Ok, I'm starting to add the sounds to my game and I'm stucked on one thing. Using this little trick suggested by AFRLme I was able to carry the ambient sound throughout all my backgrounds. Everything works fine, except for one thing that I'll try to explain as best as I can.

    Right now I followed this logic: at the beginning of the first scene I start the ambient sound (making it a loop sound). When I change to another scene I always do it "istantly", so the sound is carried on, exactly as I wanted it. The problem arises when I save the game. In fact, once I load this savegame the sound is not playing anymore.

    I already thought about a simple solution, but I don't know how to achieve it. I could add a command at the beginning of every scene saying "if this particular sound is not playing, then play it". But since I can't use a condition to achieve it, I probably need a little lua code.

    Do you think there is a command or a way to do this?

    Newbie

    62 Posts

  • #18, by afrlmeTuesday, 09. October 2018, 13:19 6 years ago
    You could use a condition or a value. At the begin of each scene check if condition = false, if so play the sound. What you need to do is add an if query into the savegame bit...

    if condition "x" is false
     execute savegame
    else
     change condition "x" to false
     execute savegame
     change condition "x" to true
    end if

    Alternatively, you could use the Lua hook for checking if you just loaded a savegame, which in that case you know that all those sort of conditions should be false, so you could set those to false inside of the function. I don't know if it would be fast enough to change them before the at begin of scene action block gets executed though.

    function onEngineEvent(event, path)
        if event == "LoadingSavegameSuccess" then
            --print(path)
            Conditions["example1"].ConditionValue = false
            Conditions["example2"].ConditionValue = false
        end
    end
    registerEventHandler("engineEvent", "onEngineEvent")

    Imperator

    7278 Posts

  • #19, by stered86Tuesday, 09. October 2018, 14:26 6 years ago
    I went for the first solution aaaand... it seems to work just fine. I'll test it thoroughly during the next few days.
    Very clever, mr AFRLme, very clever!

    Newbie

    62 Posts

  • #20, by LebosteinFriday, 08. November 2019, 19:30 4 years ago
    Is the sound system finished in the newest Visionaire version yet?

    Key Killer

    621 Posts