set up for better async handling
This commit is contained in:
parent
9417e6edbf
commit
aa57096e4b
2 changed files with 13 additions and 10 deletions
|
|
@ -1,7 +1,8 @@
|
|||
pub trait Wavetable {
|
||||
type OutputType: Default + Copy;
|
||||
/// get next sample
|
||||
fn next(&mut self) -> Self::OutputType;
|
||||
fn next(&mut self);
|
||||
fn get_value(&self) -> Self::OutputType;
|
||||
fn size(&self) -> usize;
|
||||
}
|
||||
|
||||
|
|
@ -16,13 +17,15 @@ pub struct SimpleWavetable<'a, T: Copy> {
|
|||
|
||||
impl<'a, T: Copy + Default> Wavetable for SimpleWavetable<'a, T> {
|
||||
type OutputType = T;
|
||||
fn next(&mut self) -> Self::OutputType {
|
||||
let value = self.table[self.index];
|
||||
fn next(&mut self) {
|
||||
self.index += 1;
|
||||
if self.index > self.table.len() - 1 {
|
||||
self.index = 0;
|
||||
}
|
||||
value
|
||||
}
|
||||
|
||||
fn get_value(&self) -> Self::OutputType {
|
||||
self.table[self.index]
|
||||
}
|
||||
|
||||
fn size(&self) -> usize {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue