-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
362 additions
and
374 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/// Return an array `[0, 1, ...]`. | ||
pub(crate) fn increasing_usize<const N: usize>() -> [usize; N] { | ||
let mut ret = [0; N]; | ||
for i in 0..N { | ||
ret[i] = i; | ||
} | ||
ret | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,34 +1,15 @@ | ||
use atomic_refcell::AtomicRefCell; | ||
|
||
use crate::config; | ||
use crate::signals::SlotUpdateContext; | ||
|
||
pub struct SignalExecutionContext<'a, 'shared, TState, TParameters> { | ||
pub(crate) state: &'a mut TState, | ||
pub(crate) parameters: &'a TParameters, | ||
pub(crate) fixed: &'a mut FixedSignalExecutionContext<'shared>, | ||
pub struct SignalExecutionContext<'a, 'shared> { | ||
pub(crate) fixed: &'a FixedSignalExecutionContext<'shared>, | ||
} | ||
|
||
/// Parts of the execution context which do not contain references that need to be recast. | ||
pub(crate) struct FixedSignalExecutionContext<'a> { | ||
pub(crate) time_in_blocks: u64, | ||
pub(crate) audio_destinationh: &'a mut [f64; config::BLOCK_SIZE], | ||
pub(crate) audio_destinationh: AtomicRefCell<&'a mut [f64; config::BLOCK_SIZE]>, | ||
pub(crate) slots: &'a SlotUpdateContext<'a>, | ||
} | ||
|
||
impl<'shared, TState, TParameters> SignalExecutionContext<'_, 'shared, TState, TParameters> { | ||
/// Convert this context into values usually derived from reborrows of this context's fields. Used to grab parts of | ||
/// contexts when moving upstream. | ||
pub(crate) fn wrap<'a, NewS, NewP>( | ||
&'a mut self, | ||
new_state: impl FnOnce(&'a mut TState) -> &'a mut NewS, | ||
new_params: impl FnOnce(&'a TParameters) -> &'a NewP, | ||
) -> SignalExecutionContext<'a, 'shared, NewS, NewP> | ||
where | ||
'shared: 'a, | ||
{ | ||
SignalExecutionContext { | ||
state: new_state(self.state), | ||
parameters: new_params(self.parameters), | ||
fixed: self.fixed, | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.