Showing the changes to LEAF/Src_cpp/leaf.cpp (1 of 147 files). Show all
Unified · Split
| @@ -0,0 +1,49 @@ | |||
| 1 | /* | ||
| 2 | ============================================================================== | ||
| 3 | |||
| 4 | LEAFCore.c | ||
| 5 | Created: 20 Jan 2017 12:08:14pm | ||
| 6 | Author: Michael R Mulshine | ||
| 7 | |||
| 8 | ============================================================================== | ||
| 9 | */ | ||
| 10 | |||
| 11 | #if _WIN32 || _WIN64 | ||
| 12 | |||
| 13 | #include "..\leaf.h" | ||
| 14 | |||
| 15 | #else | ||
| 16 | |||
| 17 | #include "../leaf.h" | ||
| 18 | |||
| 19 | #endif | ||
| 20 | |||
| 21 | LEAF leaf; | ||
| 22 | |||
| 23 | void LEAF_init(float sr, int blocksize, float(*random)(void)) | ||
| 24 | { | ||
| 25 | leaf_pool_init(MPOOL_POOL_SIZE); | ||
| 26 | |||
| 27 | leaf.sampleRate = sr; | ||
| 28 | |||
| 29 | leaf.blockSize = blocksize; | ||
| 30 | |||
| 31 | leaf.invSampleRate = 1.0f/sr; | ||
| 32 | |||
| 33 | leaf.random = random; | ||
| 34 | } | ||
| 35 | |||
| 36 | |||
| 37 | #define LEAFSampleRateChanged(THIS) leaf.THIS.sampleRateChanged(&leaf.THIS) | ||
| 38 | |||
| 39 | void LEAF_setSampleRate(float sampleRate) | ||
| 40 | { | ||
| 41 | leaf.sampleRate = sampleRate; | ||
| 42 | leaf.invSampleRate = 1.0f/sampleRate; | ||
| 43 | } | ||
| 44 | |||
| 45 | float LEAF_getSampleRate() | ||
| 46 | { | ||
| 47 | return leaf.sampleRate; | ||
| 48 | } | ||
| 49 | |||