animal-crossing-music-extension / ac-music-extension

Google Chrome extension that plays hourly Animal Crossing music and more while browsing!
https://acmusicext.com
zlib License
343 stars 57 forks source link

The town tune throws off the loop times. #68

Closed PikaDude closed 4 years ago

PikaDude commented 4 years ago

Once the town tune plays, it throws off the loop times for the songs, causing jarring loops.

Julian-MJK commented 4 years ago

If I were to guess, I think it may be caused by the fact that the function that plays the town tune, playHourlyMusic() at line 34 of AudioManager.js, plays the town tune first and then starts the music only afterwards.

The function that initiates the loop-times seems to be the function setLoopTimes() at line 98 of AudioManager.js, and that function is executed in audio.onplay() at line 91. Perhaps the reason this bug is happening is because the town tune sets off audio.onplay(), thereby starting the timer, before the actual music does so?

PikaDude commented 4 years ago

That doesn't appear to be the case, the town tune does not set off the onplay event in the audiomanager.

PikaDude commented 4 years ago

Seems to be related to the tab audio handler pausing the extension's music.

PikaDude commented 4 years ago

The issue appears to be somewhat simple. When the town tune plays, in specific conditions when the tab audio handler is set to pause the music, it creates two loop timeouts that run at once. I am currently working on a fix now.