Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/sine_synth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl Plugin for SineSynth {

fn process(&mut self, buffer: &mut AudioBuffer<f32>) {
let samples = buffer.samples();
let (_, outputs) = buffer.split();
let (_, mut outputs) = buffer.split();
let output_count = outputs.len();
let per_sample = self.time_per_sample();
let mut output_sample;
Expand Down
2 changes: 1 addition & 1 deletion src/buffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl<'a, T> Outputs<'a, T> {
}

/// Mutably access channel at the given index, unchecked
Copy link
Contributor Author

@PieterPenninckx PieterPenninckx Nov 2, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure why the documentation states "unchecked" (same for the get method).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed. With the types in place, there doesn't seem to be anything unchecked about this. Giving an out-of-bounds index will panic, as it should.

Same thing goes for get in Inputs.

pub fn get_mut(&self, i: usize) -> &'a mut [T] {
pub fn get_mut(&mut self, i: usize) -> &'a mut [T] {
unsafe { slice::from_raw_parts_mut(self.bufs[i], self.samples) }
}

Expand Down