Sound Bug Using "Set Fade Effect To New Scene"

  • #20, by SDMonoThursday, 24. April 2014, 21:49 6 years ago
    Can it be that local sound1 = "vispath:data/audio/tellisis/sounds/song.ogg" is just a local variable and thats why I cannot call it from another script?

    Forum Fan

    148 Posts


  • #21, by afrlmeThursday, 24. April 2014, 22:06 6 years ago
    ah yeah smile

    sorry... I tend to work with functions inside of same definition script which is why I use local quite often.

    I think a good idea for you to do is for you to create a table & add all sounds into that you want to play via the startSound function at some point in the game...
    tSnd = {}
    tSnd["bgmusic1"] = "vispath:path_to_sound.ogg"
    tSnd["sfx1"] = "vispath:path_to_sound.ogg"
    etc...
    1
    2
    3
    4
    5

    That way you can call them whenever you like, like so...
    startSound( tSnd["sfx1"] )

    getSoundId( tSnd["sfx1"] ) -- sound has to be active to return sound id
    1
    2
    3
    4

    Hopefully you will grasp what I'm trying to explain here.

    Imperator

    6842 Posts

  • #22, by SDMonoThursday, 24. April 2014, 22:58 6 years ago
    Not yet but I will!!! smile Thanks for all your help!!!

    Forum Fan

    148 Posts

  • #23, by SDMonoFriday, 25. April 2014, 21:10 6 years ago
    Ok... got it to work using the table and by saving the offset and letting it start from there in the next scene... but you were right the delay is really noticeable. The ToggleSoundPause idea is not working until now. I think it has to do with the sound not being active... gonna keep on trying!!!

    Forum Fan

    148 Posts

  • #24, by afrlmeFriday, 25. April 2014, 21:33 6 years ago
    you might want to add some flags to your startSound function such as loop=true etc.

    I've not actually tested the sound functions in any of the recent 4.0 betas. Last time I tested them was when we had the 4.8 dev builds before they decided to make the next release 4.0.

    Imperator

    6842 Posts

  • #25, by SDMonoMonday, 28. April 2014, 00:28 6 years ago
    Ok... going a little crazy here. Like I said before the offset idea worked but it is slightly off and so no use. I really want to get the pause idea to work between two scenes but I cannot do it.

    I can ToggleSoundPause inside of a scene using 3 scripts and calling them when I need them.

    The first one start the sound (which I have inside of a table) like so:
    startSound(tSnd["song"], {flags=1, volume=50, loop=true, offset=10000})
    1
    2


    The second script pauses the sound like so:
    set1 = getSoundId(tSnd["song"])
    toggleSoundPause(set1)
    1
    2
    3


    The third unpauses the sound like so:
    set2 = getSoundId(tSnd["song"])
    toggleSoundPause(set1)
    1
    2
    3


    Like I said all of this works inside of a scene. When I try to put the third script at the beginning of a new scene the sound just wont come back on.

    Any ideas to why this is happening?

    Forum Fan

    148 Posts

  • #26, by afrlmeMonday, 28. April 2014, 01:03 6 years ago
    can you send me the .ved & resource files please? I assume you are still using the test ved thing you linked me the other day?

    Imperator

    6842 Posts

  • #27, by SDMonoMonday, 28. April 2014, 01:35 6 years ago
    Ok, here it is... I changed the sound to a song so it is easier to hear the pause and unpause. I also added two buttons to the first scene where you can pause and unpause the sound.

    Forum Fan

    148 Posts

  • #28, by afrlmeMonday, 28. April 2014, 01:58 6 years ago
    ok will have a look the morrow afternoon & get back to you. wink

    Imperator

    6842 Posts

  • #29, by SDMonoMonday, 28. April 2014, 02:06 6 years ago
    I just made another version... just two scripts and one button that toggles the sound on and off. Still not luck when changing the scene though.

    Forum Fan

    148 Posts

  • #30, by afrlmeMonday, 28. April 2014, 18:57 6 years ago
    here I've removed your scripts/actions & edited with my own script & execute a script action parts.

    http://www.sendspace.com/file/nxumaj

    This is just a very basic example. I am thinking about creating a .ved file at some point that showcases the Lua sound functions. No idea when I will get around to it though.

    Imperator

    6842 Posts

Write post