Skip to content

Commit

Permalink
Convert tempo when changing beats per bar by stretching notes.
Browse files Browse the repository at this point in the history
  • Loading branch information
johnnesky committed Nov 29, 2020
1 parent d788a21 commit 8e90191
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions editor/EditorConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {DictionaryArray, BeepBoxOption, InstrumentType, toNameMap} from "../synt

export class EditorConfig {
public static readonly version: string = "3.0.11";

public static readonly versionDisplayName: string = "BeepBox " + EditorConfig.version;
public static readonly presetCategories: DictionaryArray<PresetCategory> = toNameMap([
{name: "Custom Instruments", presets: <DictionaryArray<Preset>> toNameMap([
Expand Down
3 changes: 2 additions & 1 deletion editor/changes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1664,6 +1664,7 @@ import {SongDocument} from "./SongDocument";
}
}
}
this.append(new ChangeTempo(doc, doc.song.tempo, doc.song.tempo * newValue / doc.song.beatsPerBar));
} break;
case "overflow": {
this.append(new ChangeMoveAndOverflowNotes(doc, newValue, 0));
Expand Down Expand Up @@ -1959,7 +1960,7 @@ import {SongDocument} from "./SongDocument";
export class ChangeTempo extends Change {
constructor(doc: SongDocument, oldValue: number, newValue: number) {
super();
doc.song.tempo = Math.max(Config.tempoMin, Math.min(Config.tempoMax, newValue));
doc.song.tempo = Math.max(Config.tempoMin, Math.min(Config.tempoMax, Math.round(newValue)));
doc.notifier.changed();
if (oldValue != newValue) this._didSomething();
}
Expand Down

0 comments on commit 8e90191

Please sign in to comment.