You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi! So nice to post here first time.
I want to ask current best practice for the signature of an audio callback function with dasp.
I'm currently working on embedded system with ADDA connected with stm32H7 via SAI.
Now I'm making a synthesizer and it doesn't know how much audio block length is, and how much channels are.
But my BSP crate provide me an audio callback like that.
If I implement synthesizer's callback function as generics, should I implement like that?
impl<T: dasp_sample::FloatSample> Synth<T> {
fn synth_block<U: dasp_frame::Frame>(&mut self, block: &mut [U])
where
<U as Frame>::Sample: dasp_sample::FromSample<T>,
{
let tick = ...;
for frame in block {
for mut chan in frame.channels_mut() {
let v: T = self.oscillator.sin(tick);
*chan = <U as bare_synth::dasp_frame::Frame>::Sample::from_sample(
v.to_sample(),
);
}
}
}
}
Or, should I use dasp_slice trait for the block?
Any comment, suggestion, example, or snippet much appreciated.
Thanks.
The text was updated successfully, but these errors were encountered:
Hi! So nice to post here first time.
I want to ask current best practice for the signature of an audio callback function with
dasp
.I'm currently working on embedded system with
ADDA
connected withstm32H7
viaSAI
.Now I'm making a synthesizer and it doesn't know how much audio block length is, and how much channels are.
But my BSP crate provide me an audio callback like that.
If I implement synthesizer's callback function as generics, should I implement like that?
Or, should I use
dasp_slice
trait for theblock
?Any comment, suggestion, example, or snippet much appreciated.
Thanks.
The text was updated successfully, but these errors were encountered: