Offset for Background Music

  • #1, by PanSThursday, 29. July 2021, 13:40 2 years ago
    I am working on a simple function to start background music from a saved point (offeset). One of my backgrounds songs is over 10min and I dont want to restart it everytime changing from menu back to the scene. Works fine so far (save current timestamp/offset) and check if background music changed, BUT setSoundProperty offset doesnt work. It always starts the song file from beginning. Volume works without restarting the song. My test script looks like that:
    function getTestStamp(song) --getTestStamp(game.CurrentScene.BackgroundMusic)
      local tmpTestID = getSoundId(song)
    
      setSoundProperty(tmpTestID, {flags=0,
        volume = 100,
        balance = 0,
        loop = true,
        offset = 20000
      })
    end

    Killing the background music and try "startsound" instead works perfect, but has other troubes (isnt the music chanel/bus anymore ...)

    Newbie

    73 Posts