1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
ix!();

use crate::{
    AllowDisplay,
    AssignFM,
    HandleStreamingMismatches,
    Init,
    SetPitch,
};

pub trait Oscillator:
OscillatorProcess 
+ AllowDisplay 
+ Init 
+ SetPitch 
+ HandleStreamingMismatches 
+ AssignFM 
+ OscillatorParamAccess 
+ OscillatorStereoOut
+ Debug { }

#[derive(Debug)]
pub struct OscillatorProcessBlockCfg {
    pub pitch:       f32,
    pub drift:       f32,
    pub stereo:      bool,
    pub fm:          bool,
    pub fm_depth:    f32,
}

impl Default for OscillatorProcessBlockCfg {
    fn default() -> Self {
        Self {
            pitch:   0.0, //what should our default pitch be?
            drift:   0.0,
            stereo:  false,
            fm:      false,
            fm_depth: 0.0,
        }
    }
}

pub trait OscillatorProcess {
    fn process_block(&mut self, _cfg: OscillatorProcessBlockCfg) {}
}

pub trait LoadOscillatorAlgos {
    fn load_oscalgos(&mut self) 
        -> bool ;
}

pub trait OscillatorStereoOut {
    fn out_l(&mut self) -> *mut f32 ;
    fn out_r(&mut self) -> *mut f32 ;
}

pub trait OscillatorParamAccess {
    fn osc_params(&mut self, 
        name: surge_types::OscillatorParam) 
        -> &mut surge_types::OscillatorParamRT;

    fn osc_params_const(&self, 
        name: surge_types::OscillatorParam) 
        -> &surge_types::OscillatorParamRT;
}