| @@ -25,7 +25,69 @@ extern "C" { · 24 unmodified lines |
| 25 | @example basic-oscillators.c | 25 | @example basic-oscillators.c |
| 26 | An example. | 26 | An example. |
| 27 | */ | 27 | */ |
| | 28 | |
| | 29 | //============================================================================== |
| | 30 | |
| | 31 | /*! |
| | 32 | @defgroup ttable tTable |
| | 33 | @ingroup oscillators |
| | 34 | @brief A general wavetable oscillator. |
| | 35 | @{ |
| | 36 | */ |
| | 37 | |
| | 38 | /*! |
| | 39 | @fn void tTable_init (tTable* const osc) |
| | 40 | @brief Initialize a tTable to the default LEAF mempool. |
| | 41 | @param osc A pointer to the tTable to be initialized. |
| | 42 | */ |
| | 43 | |
| | 44 | /*! |
| | 45 | @fn void tTable_initToPool (tTable* const osc, tMempool* const mempool) |
| | 46 | @brief Initialize a tTable to a specified mempool. |
| | 47 | @param osc A pointer to the tTable to be initialized. |
| | 48 | @param pool A pointer to the tMempool to which the tTable should be initialized. |
| | 49 | */ |
| | 50 | |
| | 51 | /*! |
| | 52 | @fn void tTable_free (tTable* const osc) |
| | 53 | @brief Free a tTable from the default LEAF mempool. |
| | 54 | @param osc A pointer to the tTable to be freed. |
| | 55 | */ |
| | 56 | |
| | 57 | /*! |
| | 58 | @fn float tTable_tick (tTable* const osc) |
| | 59 | @brief Tick a tTable oscillator. |
| | 60 | @param osc A pointer to the relevant tTable. |
| | 61 | @return The ticked sample as a float from -1 to 1. |
| | 62 | */ |
| | 63 | |
| | 64 | /*! |
| | 65 | @fn void tTable_setFreq (tTable* const osc, float freq) |
| | 66 | @brief Set the frequency of a tTable oscillator. |
| | 67 | @param osc A pointer to the relevant tTable. |
| | 68 | @param freq The frequency to set the oscillator to. |
| | 69 | */ |
| | 70 | |
| | 71 | /*! @} */ |
| | 72 | |
| | 73 | typedef struct _tTable |
| | 74 | { |
| | 75 | tMempool mempool; |
| | 76 | |
| | 77 | float* waveTable; |
| | 78 | int size; |
| | 79 | float inc, freq; |
| | 80 | float phase; |
| | 81 | } _tTable; |
| | 82 | |
| | 83 | typedef _tTable* tTable; |
| 28 | | 84 | |
| | 85 | void tTable_init(tTable* const osc, float* waveTable, int size); |
| | 86 | void tTable_initToPool(tTable* const osc, float* waveTable, int size, tMempool* const mempool); |
| | 87 | void tTable_free(tTable* const osc); |
| | 88 | |
| | 89 | float tTable_tick(tTable* const osc); |
| | 90 | void tTable_setFreq(tTable* const osc, float freq); |
| 29 | | 91 | |
| 30 | //============================================================================== | 92 | //============================================================================== |
| 31 | | 93 | |