Skip to content

Commit 4131860

Browse files
committed
Added octave and fifth markers for the pitch shift effect slider.
1 parent 166e4d1 commit 4131860

File tree

5 files changed

+110
-88
lines changed

5 files changed

+110
-88
lines changed

editor/FilterEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class FilterEditor {
2727
);
2828
private readonly _label: HTMLDivElement = HTML.div({style: "position: absolute; bottom: 0; left: 2px; font-size: 8px; line-height: 1; pointer-events: none;"});
2929

30-
public readonly container: HTMLElement = HTML.div({class: "filterEditor", style: "height: 2em; position: relative;"},
30+
public readonly container: HTMLElement = HTML.div({class: "filterEditor", style: "height: 100%; position: relative;"},
3131
this._svg,
3232
this._label,
3333
);

editor/HarmonicsEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export class HarmonicsEditor {
2323
this._lastControlPointContainer,
2424
);
2525

26-
public readonly container: HTMLElement = HTML.div({class: "harmonics", style: "height: 2em;"}, this._svg);
26+
public readonly container: HTMLElement = HTML.div({class: "harmonics", style: "height: 100%;"}, this._svg);
2727

2828
private _mouseX: number = 0;
2929
private _mouseY: number = 0;

editor/SongEditor.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,10 @@ export class SongEditor {
211211
private readonly _pulseWidthSlider: Slider = new Slider(input({style: "margin: 0;", type: "range", min: "0", max: Config.pulseWidthRange - 1, value: "0", step: "1"}), this._doc, (oldValue: number, newValue: number) => new ChangePulseWidth(this._doc, oldValue, newValue));
212212
private readonly _pulseWidthRow: HTMLDivElement = div({class: "selectRow"}, span({class: "tip", onclick: ()=>this._openPrompt("pulseWidth")}, "Pulse Width:"), this._pulseWidthSlider.input);
213213
private readonly _pitchShiftSlider: Slider = new Slider(input({style: "margin: 0;", type: "range", min: "0", max: Config.pitchShiftRange - 1, value: "0", step: "1"}), this._doc, (oldValue: number, newValue: number) => new ChangePitchShift(this._doc, oldValue, newValue));
214-
private readonly _pitchShiftRow: HTMLDivElement = div({class: "selectRow"}, span({class: "tip", onclick: ()=>this._openPrompt("pitchShift")}, "Pitch Shift:"), this._pitchShiftSlider.input);
214+
private readonly _pitchShiftTonicMarkers: HTMLDivElement[] = [div({class: "pitchShiftMarker", style: {color: ColorConfig.tonic}}), div({class: "pitchShiftMarker", style: {color: ColorConfig.tonic, left: "50%"}}), div({class: "pitchShiftMarker", style: {color: ColorConfig.tonic, left: "100%"}})];
215+
private readonly _pitchShiftFifthMarkers: HTMLDivElement[] = [div({class: "pitchShiftMarker", style: {color: ColorConfig.fifthNote, left: (100*7/24)+"%"}}), div({class: "pitchShiftMarker", style: {color: ColorConfig.fifthNote, left: (100*19/24)+"%"}})];
216+
private readonly _pitchShiftMarkerContainer: HTMLDivElement = div({style: "display: flex; position: relative;"}, this._pitchShiftSlider.input, div({class: "pitchShiftMarkerContainer"}, this._pitchShiftTonicMarkers, this._pitchShiftFifthMarkers));
217+
private readonly _pitchShiftRow: HTMLDivElement = div({class: "selectRow"}, span({class: "tip", onclick: ()=>this._openPrompt("pitchShift")}, "Pitch Shift:"), this._pitchShiftMarkerContainer);
215218
private readonly _detuneSlider: Slider = new Slider(input({style: "margin: 0;", type: "range", min: "0", max: Config.detuneMax, value: "0", step: "1"}), this._doc, (oldValue: number, newValue: number) => new ChangeDetune(this._doc, oldValue, newValue));
216219
private readonly _detuneRow: HTMLDivElement = div({class: "selectRow"}, span({class: "tip", onclick: ()=>this._openPrompt("detune")}, "Detune:"), this._detuneSlider.input);
217220
private readonly _distortionSlider: Slider = new Slider(input({style: "margin: 0;", type: "range", min: "0", max: Config.distortionRange - 1, value: "0", step: "1"}), this._doc, (oldValue: number, newValue: number) => new ChangeDistortion(this._doc, oldValue, newValue));
@@ -762,6 +765,9 @@ export class SongEditor {
762765
this._pitchShiftRow.style.display = "";
763766
this._pitchShiftSlider.updateValue(instrument.pitchShift);
764767
this._pitchShiftSlider.input.title = (instrument.pitchShift - Config.pitchShiftCenter) + " semitone(s)";
768+
for (const marker of this._pitchShiftFifthMarkers) {
769+
marker.style.display = this._doc.showFifth ? "" : "none";
770+
}
765771
} else {
766772
this._pitchShiftRow.style.display = "none";
767773
}

editor/SpectrumEditor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export class SpectrumEditor {
2424
this._arrow,
2525
);
2626

27-
public readonly container: HTMLElement = HTML.div({class: "spectrum", style: "height: 2em;"}, this._svg);
27+
public readonly container: HTMLElement = HTML.div({class: "spectrum", style: "height: 100%;"}, this._svg);
2828

2929
private _mouseX: number = 0;
3030
private _mouseY: number = 0;

0 commit comments

Comments
 (0)