mirror of
https://github.com/smogon/pokemon-showdown-client.git
synced 2026-08-25 12:29:57 -05:00
Fix background music stuttering
I finally got to reading the SM2 documentation more closely, and saw: > precision can vary between 20 msec to perhaps 0.5 seconds and the > sound's position property will reflect this delta when the > onPosition() callback fires Emphasis on "this.position will reflect this delta". Anyway, this new system should have significantly less noticeable stuttering.
This commit is contained in:
@@ -92,8 +92,8 @@ var BattleSoundLibrary = (function () {
|
||||
// suppress crash
|
||||
return (this.bgmCache[url] = this.soundPlaceholder);
|
||||
}
|
||||
this.bgmCache[url].onposition(loopend, function () {
|
||||
this.setPosition(loopstart);
|
||||
this.bgmCache[url].onposition(loopend, function (evP) {
|
||||
this.setPosition(this.position - (loopend - loopstart));
|
||||
});
|
||||
return this.bgmCache[url];
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user