Showing the changes to Examples (2 of 8 files). Show all
Unified · Split
| @@ -0,0 +1,36 @@ | |||
| 1 | /* | ||
| 2 | ============================================================================== | ||
| 3 | |||
| 4 | basic-oscillators.c | ||
| 5 | Created: 5 Mar 2020 2:56:24pm | ||
| 6 | Author: Matthew Wang | ||
| 7 | |||
| 8 | ============================================================================== | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include "basic-oscillators.c" | ||
| 12 | |||
| 13 | void exampleInit() | ||
| 14 | { | ||
| 15 | LEAF_init(44100, 64, mempool, 1000, &exampleRandom); | ||
| 16 | |||
| 17 | tCycle_init(&cycle); | ||
| 18 | tCycle_setFreq(&cycle, 220); | ||
| 19 | } | ||
| 20 | |||
| 21 | void exampleFrame() | ||
| 22 | { | ||
| 23 | |||
| 24 | } | ||
| 25 | |||
| 26 | float exampleTick(float sampleIn) | ||
| 27 | { | ||
| 28 | float sampleOut = tCycle_tick(&cycle); | ||
| 29 | return sampleOut; | ||
| 30 | } | ||
| 31 | |||
| 32 | float exampleRandom() | ||
| 33 | { | ||
| 34 | return ((float)rand()/(float)(RAND_MAX)); | ||
| 35 | } | ||
| 36 | |||
| @@ -0,0 +1,22 @@ | |||
| 1 | /* | ||
| 2 | ============================================================================== | ||
| 3 | |||
| 4 | basic-oscillators.h | ||
| 5 | Created: 5 Mar 2020 2:56:24pm | ||
| 6 | Author: Matthew Wang | ||
| 7 | |||
| 8 | ============================================================================== | ||
| 9 | */ | ||
| 10 | |||
| 11 | #include "../LEAF/leaf.h" | ||
| 12 | |||
| 13 | char mempool[1000]; | ||
| 14 | tCycle cycle; | ||
| 15 | |||
| 16 | void exampleInit(void); | ||
| 17 | |||
| 18 | void exampleFrame(void); | ||
| 19 | |||
| 20 | float exampleTick(float sampleIn); | ||
| 21 | |||
| 22 | float exampleRandom(void); | ||