Skip to content

Commit

Permalink
Feat: updating sample and chunk parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
Grabt234 committed Nov 6, 2023
1 parent 67649ae commit 79352d6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@
TimeDomainChart.data.datasets = datasets;
TimeDomainChart.data.labels = Array.from({ length: 512 }, (_, index) => index + 1);
TimeDomainChart.update();
if (timeSampleRate !== JSON.parse(event.data)['TimeChunk']['SampleRate']) {
timeSampleRate = JSON.parse(event.data)['TimeChunk']['SampleRate'];
}
if (timeChunkSize !== JSON.parse(event.data)['TimeChunk']['ChunkSize']) {
timeChunkSize = JSON.parse(event.data)['TimeChunk']['ChunkSize'];
}
});
ctxTime = document.getElementById('TimeDomainChart');
Expand Down Expand Up @@ -144,6 +151,13 @@
FreqDomainChart.data.datasets = freqDatasets;
FreqDomainChart.data.labels = Array.from({ length: 512 }, (_, index) => index + 1);
FreqDomainChart.update();
if (freqSampleRate !== JSON.parse(event.data)['FFTMagnitudeChunk']['SampleRate']) {
freqSampleRate = JSON.parse(event.data)['FFTMagnitudeChunk']['SampleRate'];
}
if (freqChunkSize !== JSON.parse(event.data)['FFTMagnitudeChunk']['ChunkSize']) {
freqChunkSize = JSON.parse(event.data)['FFTMagnitudeChunk']['ChunkSize'];
}
});
ctxFreq = document.getElementById('FreqDomainChart');
Expand Down

0 comments on commit 79352d6

Please sign in to comment.