less broken microphone support
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
const SAMPLE_RATE = 48000;
|
||||
const PACKET_MS = 20;
|
||||
const PACKET_MS = 10;
|
||||
const PACKET_FRAMES = PACKET_MS / 1000 * SAMPLE_RATE;
|
||||
//const PACKET_FRAMES = 2400;
|
||||
console.log("Frames per packet:", PACKET_FRAMES);
|
||||
|
||||
class RustWorklet extends AudioWorkletProcessor {
|
||||
@@ -22,9 +23,11 @@ class RustWorklet extends AudioWorkletProcessor {
|
||||
const data = {
|
||||
format: 'f32',
|
||||
sampleRate: SAMPLE_RATE,
|
||||
//numberOfFrames: this.buffer_offset,
|
||||
numberOfFrames: this.buffer_offset,
|
||||
numberOfChannels: 1,
|
||||
timestamp: this.timestamp,
|
||||
//timestamp: null,
|
||||
data: this.buffer.slice(0, this.buffer_offset),
|
||||
};
|
||||
this.port.postMessage(data);
|
||||
@@ -33,8 +36,13 @@ class RustWorklet extends AudioWorkletProcessor {
|
||||
}
|
||||
|
||||
process(inputs) {
|
||||
//console.log(inputs);
|
||||
if (inputs.length != 1) {
|
||||
console.log("We got " + inputs.length + " heads?")
|
||||
}
|
||||
const input = inputs[0];
|
||||
if (input.length == 0) {
|
||||
console.log("We got no ears?")
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user