Skip to content

Commit

Permalink
Silence clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
orottier committed May 4, 2024
1 parent dfd1943 commit b935c00
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/audio_worklet_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub(crate) struct ProcessorArguments {
unsafe impl Send for ProcessorArguments {}

// channel from main to worker
#[allow(clippy::type_complexity)] // will refactor later
pub(crate) fn send_recv_pair() -> &'static Mutex<(
Option<Sender<ProcessorArguments>>,
Option<Receiver<ProcessorArguments>>,
Expand All @@ -43,11 +44,13 @@ pub(crate) fn send_recv_pair() -> &'static Mutex<(
})
}

// channel from worker to main
pub(crate) struct SendItem2(Vec<AudioParamDescriptor>);

// channel from worker to main
#[allow(clippy::type_complexity)] // will refactor later
pub(crate) fn send_recv_pair2() -> &'static (Sender<SendItem2>, Receiver<SendItem2>) {
static PAIR: OnceLock<(Sender<SendItem2>, Receiver<SendItem2>)> = OnceLock::new();
PAIR.get_or_init(|| crossbeam_channel::unbounded())
PAIR.get_or_init(crossbeam_channel::unbounded)
}

#[js_function(1)]
Expand Down Expand Up @@ -114,21 +117,21 @@ pub(crate) fn run_audio_worklet(ctx: CallContext) -> Result<JsUndefined> {
.get_named_property::<JsObject>("proc123")?;
let process = proc.get_named_property::<JsFunction>("process")?;

let input_samples = float_buffer_to_js(&ctx.env, inputs, 128);
let input_samples = float_buffer_to_js(ctx.env, inputs, 128);
let mut input_channels = ctx.env.create_array(0)?;
input_channels.insert(input_samples)?;
let mut inputs = ctx.env.create_array(0)?;
inputs.insert(input_channels)?;

let output_samples = float_buffer_to_js(&ctx.env, outputs, 128);
let output_samples = float_buffer_to_js(ctx.env, outputs, 128);
let mut output_channels = ctx.env.create_array(0)?;
output_channels.insert(output_samples)?;
let mut outputs = ctx.env.create_array(0)?;
outputs.insert(output_channels)?;

let mut js_params = ctx.env.create_object()?;
params.into_iter().for_each(|(name, ptr, len)| {
let val = float_buffer_to_js(&ctx.env, ptr, len);
let val = float_buffer_to_js(ctx.env, ptr, len);
js_params.set_named_property(&name, val).unwrap()
});

Expand Down

0 comments on commit b935c00

Please sign in to comment.