@@ -78,7 +78,9 @@ export class TrackerPlaybackController {
7878 }
7979
8080 setTempo ( value : number ) : void {
81+ this . state . tempoFactor = Math . max ( 0.25 , value ) ;
8182 this . player . setTempo ( value ) ;
83+ this . state . lastFrameTime = performance . now ( ) ;
8284 }
8385
8486 setOscilloscopeTheme ( lineColor : string , backgroundColor : string ) : void {
@@ -453,20 +455,21 @@ export class TrackerPlaybackController {
453455 const now = performance . now ( ) ;
454456 let deltaSeconds = Math . max ( 0 , ( now - this . state . lastFrameTime ) / 1000 ) ;
455457 this . state . lastFrameTime = now ;
458+ const tempoFactor = this . state . tempoFactor ;
456459
457460 if ( deltaSeconds > 0.25 ) {
458461 const currentSec = this . state . legacyModule . _openmpt_module_get_position_seconds ( this . state . uiModulePtr ) ;
459462 this . state . legacyModule . ccall (
460463 "openmpt_module_set_position_seconds" ,
461464 "number" ,
462465 [ "number" , "number" ] ,
463- [ this . state . uiModulePtr , currentSec + deltaSeconds ] ,
466+ [ this . state . uiModulePtr , currentSec + deltaSeconds * tempoFactor ] ,
464467 ) ;
465468 deltaSeconds = 0 ;
466469 this . state . fractionalFrames = 0 ;
467470 }
468471
469- const totalFrames = deltaSeconds * APP_CONSTANTS . sampleRate + this . state . fractionalFrames ;
472+ const totalFrames = deltaSeconds * APP_CONSTANTS . sampleRate * tempoFactor + this . state . fractionalFrames ;
470473 const frames = Math . floor ( totalFrames ) ;
471474 this . state . fractionalFrames = totalFrames - frames ;
472475
@@ -487,13 +490,19 @@ export class TrackerPlaybackController {
487490 let patternIndex = - 1 ;
488491 let row = - 1 ;
489492 let pos = - 1 ;
493+ let currentSeconds = - 1 ;
490494
491495 try {
492496 patternIndex = this . state . legacyModule . _openmpt_module_get_current_pattern ( this . state . uiModulePtr ) ;
493497 row = this . state . legacyModule . _openmpt_module_get_current_row ( this . state . uiModulePtr ) ;
494498 pos = this . state . legacyModule . _openmpt_module_get_current_order ( this . state . uiModulePtr ) ;
499+ currentSeconds = this . state . legacyModule . _openmpt_module_get_position_seconds ( this . state . uiModulePtr ) ;
495500 } catch { }
496501
502+ if ( ! this . state . seeking && currentSeconds >= 0 ) {
503+ this . updateProgressUi ( currentSeconds , this . getPlaybackDuration ( ) ) ;
504+ }
505+
497506 if ( patternIndex >= 0 && patternIndex !== this . patternView . getCurrentPattern ( ) ) {
498507 this . renderPatternByIndex ( patternIndex ) ;
499508 }
0 commit comments