Created
November 13, 2015 11:24
-
-
Save sybarite/8ba77b9790fd036fde6f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var old_timestamp = Math.floor(Date.now()/1000); | |
var old_timestamp2 = -1; | |
selected_theme[selected_key+"Loop"] = function() { | |
var pause; | |
var seconds = parseInt(getSeconds(selected_voice.time)); | |
var timestamp = selected_theme["timestampvoice" + selected_voice.aftype] + seconds; | |
if (seconds == 0){ | |
if (timestamp > old_timestamp2 && old_timestamp2 != 0) { | |
pause = 0; | |
old_timestamp2 = timestamp; | |
} else { | |
pause = 1; | |
old_timestamp2 = timestamp; | |
} | |
} else if ((timestamp > old_timestamp) && (Math.floor(Date.now()/1000) >= timestamp)) { | |
old_timestamp = timestamp; | |
pause = 0; | |
} else { | |
pause = 1; | |
} | |
if (Math.floor(Date.now()/1000) >= timestamp) { | |
if (pause == 0) { | |
// play the audio | |
} else { | |
// execute selected_theme[selected_key+"Loop"] | |
} | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment