Skip to content

Commit

Permalink
added reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
will-lol committed Sep 24, 2022
1 parent d0579f5 commit 7c0783c
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
{
"fullscreen": false,
"height": 512,
"resizable": false,
"resizable": true,
"title": "noise",
"width": 512
}
Expand Down
16 changes: 12 additions & 4 deletions ui/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
<div>
<button id="recorderButton">Start recording to file</button>
<button onclick="savePreset()">Save default preset</button>
<button onclick="reset()">Reset</button>
</div>
</div>
<style>
Expand Down Expand Up @@ -190,7 +191,7 @@
//Create a biquad filter
frequencyBands[i] = new BiquadFilterNode(audioCtx, {
type: "peaking",
Q: 50,
Q: 3.5,
frequency:
(frequencyBandValues[i + 1] - frequencyBandValues[i]) / 2 +
frequencyBandValues[i],
Expand All @@ -206,8 +207,8 @@
currentEq.setAttribute("name", "eqGain" + i);
currentEq.setAttribute("id", "eqGain" + i);
currentEq.setAttribute("type", "range");
currentEq.setAttribute("min", "-200");
currentEq.setAttribute("max", "200");
currentEq.setAttribute("min", "-100");
currentEq.setAttribute("max", "100");
currentEq.setAttribute("value", "0");
currentEq.setAttribute("step", "1");
currentWrap.appendChild(currentEq);
Expand Down Expand Up @@ -345,7 +346,9 @@
}

const sliders = document.querySelectorAll(".eqSliderWrap input");
var defaultPreset = new Preset(frequencyBands, sliders);
var defaultPreset = new Preset(null, sliders);
defaultPreset.createFromData({ frequencyBandGains: [0,0,0,0,0,0,0,0,0] })
console.log(defaultPreset);

function savePreset() {
userPreset = new Preset(frequencyBands, sliders);
Expand All @@ -364,6 +367,11 @@
}

loadPreset();

function reset() {
defaultPreset.apply(frequencyBands, audioCtx);
displayMessage("Reset completed", true)
}
</script>
<script>
//This script tag is for the recorder
Expand Down

0 comments on commit 7c0783c

Please sign in to comment.