Skip to content
Snippets Groups Projects
Commit c35cc57d authored by David Huss's avatar David Huss :speech_balloon:
Browse files

Support Buffersizes other than 1024, read more

This adds support for buffersizes <= 1024. It comes with a few gotchas:

- To keep the arrays on the stack there is always a size of 1024
allocated on the stack, but only the parts for the buffer are used
- Sizes bigger than 1024 are not currently supported
parent 19b5151b
No related branches found
No related tags found
No related merge requests found
...@@ -19,7 +19,7 @@ TODO: ...@@ -19,7 +19,7 @@ TODO:
- [ ] f32.mul_add() or f32.to_bits() / f32.from_bits() - [ ] f32.mul_add() or f32.to_bits() / f32.from_bits()
- [ ] only calculate connected ports https://docs.rs/jack/0.7.1/jack/struct.Port.html#method.connected_count - [ ] only calculate connected ports https://docs.rs/jack/0.7.1/jack/struct.Port.html#method.connected_count
- [ ] Flag volume modulations as dirty - [ ] Flag volume modulations as dirty
- [ ] Support other Buffers than 1024 - [x] Support other Buffers than 1024
- [ ] Features: - [ ] Features:
- [ ] Flags to control printing (--quiet etc) - [ ] Flags to control printing (--quiet etc)
- [ ] Option to set initial values - [ ] Option to set initial values
...@@ -126,6 +126,8 @@ fn main() { ...@@ -126,6 +126,8 @@ fn main() {
.unwrap(); .unwrap();
16]; 16];
let buffersize = client.buffer_size() as usize;
// Is called asynchronously. Moves/mixes the actual audio samples from A to be // Is called asynchronously. Moves/mixes the actual audio samples from A to be
let process_callback = move |_: &jack::Client, ps: &jack::ProcessScope| -> jack::Control { let process_callback = move |_: &jack::Client, ps: &jack::ProcessScope| -> jack::Control {
// For every output get a sum of corresponding inputs // For every output get a sum of corresponding inputs
...@@ -141,9 +143,11 @@ fn main() { ...@@ -141,9 +143,11 @@ fn main() {
// Sum each input to output buffer // Sum each input to output buffer
output_buffers.iter_mut() output_buffers.iter_mut()
.take(buffersize)
.enumerate() .enumerate()
.for_each(|(output_index, b)| { .for_each(|(output_index, b)| {
b.iter_mut() b.iter_mut()
.take(buffersize)
.enumerate() .enumerate()
.for_each(|(sample_index, sample)| { .for_each(|(sample_index, sample)| {
// For each input get the corrsponding atomic value for the volume control // For each input get the corrsponding atomic value for the volume control
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment