|
@@ -142,6 +142,7 @@ export class PlaybackManager implements IPlaybackParametersListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ public PreCountMeasures: number;
|
|
|
public PreCountBeats: number;
|
|
|
|
|
|
public get Metronome(): ISettableInstrument {
|
|
@@ -372,7 +373,7 @@ export class PlaybackManager implements IPlaybackParametersListener {
|
|
|
public reset(): void {
|
|
|
// lock(this.playbackThreadSyncObject) {
|
|
|
//this.resetRequested = true;
|
|
|
- this.doReset(this.DoPreCount);
|
|
|
+ this.doReset(this.DoPreCount, this.PreCountMeasures);
|
|
|
|
|
|
if (this.musicPartManager === undefined) {
|
|
|
return;
|
|
@@ -935,7 +936,7 @@ export class PlaybackManager implements IPlaybackParametersListener {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- protected doReset(shallPrecount: boolean): void {
|
|
|
+ protected doReset(shallPrecount: boolean, preCountMeasures: number = 1): void {
|
|
|
this.nextIteratorTimestamp = undefined;
|
|
|
this.playNextMetronomeAt = undefined;
|
|
|
this.closestNextTimestamp = undefined;
|
|
@@ -967,10 +968,12 @@ export class PlaybackManager implements IPlaybackParametersListener {
|
|
|
let preCountDuration: Fraction = new Fraction();
|
|
|
if (shallPrecount) {
|
|
|
this.isPreCounting = true;
|
|
|
- const rhythmDuration: Fraction = new Fraction(this.startRhythmBeats, this.startRhythmDenominator);
|
|
|
+ const rhythmDuration: Fraction = new Fraction(this.startRhythmBeats * preCountMeasures, this.startRhythmDenominator);
|
|
|
+ const sourceMeasureDuration: Fraction = this.musicPartManager.MusicSheet.SourceMeasures[this.currentMeasureIndex].Duration;
|
|
|
+ const measureDuration: Fraction = new Fraction(sourceMeasureDuration.Numerator * preCountMeasures, sourceMeasureDuration.Denominator);
|
|
|
const duration: Fraction =
|
|
|
- Fraction.plus( this.musicPartManager.MusicSheet.SourceMeasures[this.currentMeasureIndex].AbsoluteTimestamp,
|
|
|
- this.musicPartManager.MusicSheet.SourceMeasures[this.currentMeasureIndex].Duration).Sub(this.currentIteratorSourceTimeStamp);
|
|
|
+ Fraction.plus(this.musicPartManager.MusicSheet.SourceMeasures[this.currentMeasureIndex].AbsoluteTimestamp,
|
|
|
+ measureDuration).Sub(this.currentIteratorSourceTimeStamp);
|
|
|
|
|
|
preCountDuration = rhythmDuration;
|
|
|
|