Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public final class Sampler {

private Mod mod;
private int sampleCount;
private long modLengthMicros;

private int sequenceIndex;
private int rowIndex;
private int tickIndex;
Expand Down Expand Up @@ -631,8 +633,7 @@ private void applyMidRowEffects() {
* @return the module's total playback duration in the requested unit
*/
public long getModLength(TimeUnit unit) {
long milliseconds = sampleCount * 1_000L / config.samplingRate * 1_000L;
return unit.convert(milliseconds, TimeUnit.MICROSECONDS);
return unit.convert(modLengthMicros, TimeUnit.MICROSECONDS);
}

/**
Expand Down Expand Up @@ -918,6 +919,7 @@ private void rebuildIndex() {
}

this.sampleCount = sampleCount;
this.modLengthMicros = sampleCount * 1_000L / config.samplingRate * 1_000L;
} finally {
config.loopDetectionEnabled = loopDetectionEnabled;
config.loggingEnabled = loggingEnabled;
Expand Down
Loading