Skip to content

Commit 6736d00

Browse files
a couple more fixes
1 parent 22cd019 commit 6736d00

3 files changed

Lines changed: 19 additions & 18 deletions

File tree

slider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ class SampleRateSlider extends RangedSlider{
172172
this.name ="Sample Rate(Hz):";
173173
this.propName="downsamplingFactor";
174174
this.min = p.log(3000)/p.log(2);
175-
this.max = p.log(48000)/p.log(2);
175+
this.max = p.log(WEBAUDIO_MAX_SAMPLERATE)/p.log(2);
176176
this.initial = p.log(48000)/p.log(2);
177177
this.step = 0.1
178178
this.makeSlider(p);

waves.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -485,7 +485,7 @@ function antiImagingFilter(settings, fft, playback) {
485485
let reconstructed = playback ? settings.buffers.reconstructed.playback : settings.buffers.reconstructed.display;
486486

487487
// render reconstructed wave by low pass filtering the zero stuffed array----
488-
const freq = (settings.reconstructionFilterFrequency > 0)
488+
const freq = (settings.reconstructionFilterFrequency >= 0)
489489
? settings.reconstructionFilterFrequency
490490
: (WEBAUDIO_MAX_SAMPLERATE / settings.downsamplingFactor) / 2;
491491

widget.js

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,6 @@ let sliderIdLookups = {
113113
function createWidgets() {
114114
let settings = getDefaultSettings();
115115

116-
const sections = document.getElementsByClassName('section');
117-
for (const section of sections) {
118-
if (section.id === "input-section") {
119-
settings.renderStages.push(renderOriginal);
120-
} else if (section.id === "delta-sigma-section") {
121-
settings.renderStages.push(renderDeltaSigma);
122-
} else if (section.id === "filter-section") {
123-
settings.renderStages.push(applyAntialiasingFilter);
124-
} else if (section.id === "samplerate-section") {
125-
settings.renderStages.push(downsampleWithQuantization)
126-
} else if (section.id === "reconstructed-section") {
127-
settings.renderStages.push(antiImagingFilter);
128-
}
129-
}
130-
131116
const collapseButtons = document.getElementsByClassName("collapse-button");
132117
for (const button of collapseButtons) {
133118
button.textContent = "_";
@@ -168,7 +153,6 @@ function createWidgets() {
168153
if (id in sliderIdLookups) {
169154
const sketch = p => {
170155
p.sliderObject = new sliderIdLookups[id]();
171-
172156
p.setup = function () {
173157
let canvas = p.createCanvas(500, 50);
174158
p.textAlign(p.CENTER);
@@ -182,6 +166,23 @@ function createWidgets() {
182166
}
183167
}
184168

169+
const sections = document.getElementsByClassName('section');
170+
for (const section of sections) {
171+
if (section.id === "input-section") {
172+
settings.renderStages.push(renderOriginal);
173+
} else if (section.id === "delta-sigma-section") {
174+
settings.renderStages.push(renderDeltaSigma);
175+
176+
} else if (section.id === "filter-section") {
177+
settings.renderStages.push(applyAntialiasingFilter);
178+
} else if (section.id === "samplerate-section") {
179+
settings.renderStages.push(downsampleWithQuantization)
180+
} else if (section.id === "reconstructed-section") {
181+
settings.renderStages.push(antiImagingFilter);
182+
}
183+
}
184+
185+
185186
const playButtons = document.getElementsByClassName('play-button');
186187

187188
function buttonPlayFunction(buffer) {

0 commit comments

Comments
 (0)