Skip to content

Commit

Permalink
gsuiDAW: use gsuiTempo
Browse files Browse the repository at this point in the history
  • Loading branch information
mr21 committed Sep 6, 2024
1 parent 0ffb053 commit 7981e12
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 126 deletions.
33 changes: 0 additions & 33 deletions gsuiDAW/gsuiDAW-area-ctrl.css
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,3 @@ gsui-daw[ focus="down" ] .gsuiDAW-focusBtn span:last-child {
.gsuiDAW-btn[ data-action="reset" ] {
margin-left: -2px;
}
gsui-daw gsui-clock {
border-radius: var( --radius );
}
.gsuiDAW-tempo {
white-space: nowrap;
background-color: var( --gsui-clock-bg );
}
.gsuiDAW-tempo-timeDivision {
display: flex;
align-items: center;
flex-direction: column;
justify-content: space-between;
height: 32%;
padding: 0 6px 0 8px;
font-size: 12px;
line-height: 0;
font-family: var( --gsui-font-number );
pointer-events: none;
}
.gsuiDAW-tempo-bpm {
display: flex;
align-items: baseline;
padding-right: 7px;
font-size: 18px;
font-family: var( --gsui-font-number );
pointer-events: none;
}
.gsuiDAW-tempo-bpm::after {
content: "bpm";
margin-left: 2px;
font-size: 12px;
opacity: .5;
}
23 changes: 0 additions & 23 deletions gsuiDAW/gsuiDAW-popup-tempo.css

This file was deleted.

28 changes: 0 additions & 28 deletions gsuiDAW/gsuiDAW-popup-tempo.html.js

This file was deleted.

8 changes: 1 addition & 7 deletions gsuiDAW/gsuiDAW.html.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,7 @@ GSUsetTemplate( "gsui-daw", () => [
GSUcreateButton( { class: "gsuiDAW-btn gsuiIcon", "data-action": "reset", "data-icon": "sync", title: "Restart the audio engine" } ),
),
GSUcreateElement( "gsui-clock" ),
GSUcreateButton( { class: "gsuiDAW-btn gsuiDAW-tempo", "data-action": "tempo", title: "Edit the time signature and BPM" },
GSUcreateDiv( { class: "gsuiDAW-tempo-timeDivision" },
GSUcreateSpan( { class: "gsuiDAW-tempo-beatsPerMeasure" } ),
GSUcreateSpan( { class: "gsuiDAW-tempo-stepsPerBeat" } ),
),
GSUcreateSpan( { class: "gsuiDAW-tempo-bpm" } ),
),
GSUcreateElement( "gsui-tempo" ),
),
GSUcreateDiv( { class: "gsuiDAW-area gsuiDAW-areaTime" },
GSUcreateElement( "gsui-slider", { "data-action": "currentTime", type: "linear-x", min: 0, step: .01 } ),
Expand Down
36 changes: 3 additions & 33 deletions gsuiDAW/gsuiDAW.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,6 @@ class gsuiDAW extends gsui0ne {
inputOpenURL: "[name='url']",
inputOpenFile: "[name='file']",
} ),
tempo: GSUfindElements( GSUgetTemplate( "gsui-daw-popup-tempo" ), {
root: ".gsuiDAW-popup-tempo",
beatsPerMeasure: "[name='beatsPerMeasure']",
stepsPerBeat: "[name='stepsPerBeat']",
bpm: "[name='bpm']",
bpmTap: ".gsuiDAW-bpmTap",
} ),
about: GSUfindElements( GSUgetTemplate( "gsui-daw-popup-about" ), {
root: ".gsuiDAW-popup-about",
version: ".gsuiDAW-popup-about-versionNum",
Expand Down Expand Up @@ -63,16 +56,14 @@ class gsuiDAW extends gsui0ne {
$tagName: "gsui-daw",
$elements: {
$head: ".gsuiDAW-head",
$bpm: ".gsuiDAW-tempo-bpm",
$bPM: ".gsuiDAW-tempo-beatsPerMeasure",
$sPB: ".gsuiDAW-tempo-stepsPerBeat",
$cmpName: ".gsuiDAW-currCmp-name",
$cmpSave: ".gsuiDAW-currCmp-saveBtn",
$cmpIcon: ".gsuiDAW-currCmp-localIcon",
$cmpDuration: ".gsuiDAW-currCmp-dur",
$play: "[data-action='play']",
$vers: ".gsuiDAW-version",
$clock: "gsui-clock",
$tempo: "gsui-tempo",
$analyserHz: "gsui-analyser-hz",
$volume: ".gsuiDAW-volume gsui-slider",
$currentTime: ".gsuiDAW-areaTime gsui-slider",
Expand Down Expand Up @@ -136,7 +127,6 @@ class gsuiDAW extends gsui0ne {
dt.icon = res === GSUgetAttribute( this, "version" ) ? "check" : "warning";
} );
};
this.#popups.tempo.bpmTap.onclick = () => this.#popups.tempo.bpm.value = gswaBPMTap.$tap();
this.#popups.settings.uiRateManualRange.onmousedown = () => this.#popups.settings.uiRateRadio.manual.checked = true;
this.#popups.settings.uiRateManualRange.oninput = e => {
this.#popups.settings.uiRateManualFPS.textContent =
Expand Down Expand Up @@ -254,13 +244,12 @@ class gsuiDAW extends gsui0ne {
break;
case "bpm":
GSUsetAttribute( this.$elements.$clock, "bpm", val );
this.$elements.$bpm.textContent = val;
GSUsetAttribute( this.$elements.$tempo, "bpm", val );
this.#updateDuration();
break;
case "timedivision":
GSUsetAttribute( this.$elements.$clock, "timedivision", val );
this.$elements.$bPM.textContent = val.split( "/" )[ 0 ];
this.$elements.$sPB.textContent = val.split( "/" )[ 1 ];
GSUsetAttribute( this.$elements.$tempo, "timedivision", val );
break;
case "volume":
this.$elements.$volume.$setValue( val );
Expand Down Expand Up @@ -502,25 +491,6 @@ class gsuiDAW extends gsui0ne {
GSUpopup.$custom( { title: "Export", element: this.#popups.export.root } )
.then( () => this.$dispatch( "abortExport" ) );
break;
case "tempo":
this.#popups.tempo.beatsPerMeasure.value = +GSUgetAttribute( this, "timedivision" ).split( "/" )[ 0 ];
this.#popups.tempo.stepsPerBeat.value = +GSUgetAttribute( this, "timedivision" ).split( "/" )[ 1 ];
this.#popups.tempo.bpm.value = GSUgetAttributeNum( this, "bpm" );
GSUpopup.$custom( { title: "Tempo", element: this.#popups.tempo.root } )
.then( data => {
if ( data ) {
data.timedivision = `${ data.beatsPerMeasure }/${ data.stepsPerBeat }`;
delete data.beatsPerMeasure;
delete data.stepsPerBeat;
if (
data.timedivision !== GSUgetAttribute( this, "timedivision" ) ||
data.bpm !== GSUgetAttributeNum( this, "bpm" )
) {
this.$dispatch( "tempo", data );
}
}
} );
break;
case "settings":
this.#popups.settings.sampleRate.value = GSUgetAttributeNum( this, "samplerate" );
this.#popups.settings.keyNotation.value = GSUgetAttribute( this, "keynotation" );
Expand Down
5 changes: 3 additions & 2 deletions gsuiDAW/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
<link rel="stylesheet" href="/gs-ui-components/gsuiAnalyserHist/gsuiAnalyserHist.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiPanels/gsuiPanels.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiClock/gsuiClock.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiTempo/gsuiTempo.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiSlider/gsuiSlider.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiWindows/gsuiWindows.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiWindows/gsuiWindow.css"/>
Expand All @@ -38,7 +39,6 @@
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-auth.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-open.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-about.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-tempo.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-export.css"/>
<link rel="stylesheet" href="/gs-ui-components/gsuiDAW/gsuiDAW-popup-settings.css"/>

Expand Down Expand Up @@ -77,6 +77,8 @@
<script src="/gs-ui-components/gsuiAnalyserHist/gsuiAnalyserHist.js"></script>
<script src="/gs-ui-components/gsuiClock/gsuiClock.html.js"></script>
<script src="/gs-ui-components/gsuiClock/gsuiClock.js"></script>
<script src="/gs-ui-components/gsuiTempo/gsuiTempo.html.js"></script>
<script src="/gs-ui-components/gsuiTempo/gsuiTempo.js"></script>
<script src="/gs-ui-components/gsuiKeys/gsuiKeys.js"></script>
<script src="/gs-ui-components/gsuiPianoroll/gsuiPianoroll.js"></script>
<script src="/gs-ui-components/gsuiPanels/gsuiPanels.js"></script>
Expand All @@ -92,7 +94,6 @@
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-auth.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-open.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-about.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-tempo.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-export.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW-popup-settings.html.js"></script>
<script src="/gs-ui-components/gsuiDAW/gsuiDAW.js"></script>
Expand Down

0 comments on commit 7981e12

Please sign in to comment.