Trying to use this for implementation in my rhythm game, but the way this is written makes it very difficult to implement a pause feature for my game.
Everything in my game depends on me knowing at all times an accurate number for the song's current playback time. In a resolved issue someone pointed out that I could use:
This works like a charm.... until the song gets paused. As soon as the song is resumed, sounds['src'].startTime jumps up to equal sounds['src'].soundNode.context.currentTime and the whole thing just becomes a mess to keep track of.
Can anyone help me come up with a way that I can pause the song, and when it's resumed, still maintain an accurate song play time?
Trying to use this for implementation in my rhythm game, but the way this is written makes it very difficult to implement a pause feature for my game.
Everything in my game depends on me knowing at all times an accurate number for the song's current playback time. In a resolved issue someone pointed out that I could use:
sounds['src'].soundNode.context.currentTime - sounds['src'].startTime
This works like a charm.... until the song gets paused. As soon as the song is resumed, sounds['src'].startTime jumps up to equal sounds['src'].soundNode.context.currentTime and the whole thing just becomes a mess to keep track of.
Can anyone help me come up with a way that I can pause the song, and when it's resumed, still maintain an accurate song play time?