MetaOscil is a wrapper for several Oscil. More...
#include <MetaOscil.h>
Public Member Functions | |
template<class... T> | |
MetaOscil (Oscil< NUM_TABLE_CELLS, UPDATE_RATE > *first, T *... elements) | |
Constructor Declare a MetaOscil containing any number of Oscil pointers. More... | |
template<typename ... T> | |
void | setOscils (Oscil< NUM_TABLE_CELLS, UPDATE_RATE > *first, T... elements) |
Set all Oscil of a MetaOscil. More... | |
void | setOscils () |
template<typename ... T> | |
void | setCutoffFreqs (int first, T... elements) |
Set all the cutoff frequencies for changing between Oscil. More... | |
void | setCutoffFreqs () |
void | setCutoffFreq (int freq, byte rank) |
Set or change the cutoff frequency of one Oscil. More... | |
int8_t | next () |
Updates the phase according to the current frequency and returns the sample at the new phase position. More... | |
void | setTable (const int8_t *TABLE_NAME, byte rank) |
Change the sound table which will be played by the Oscil of rank. More... | |
void | setPhase (unsigned int phase) |
Set the phase of the currently playing Oscil. More... | |
void | setPhaseFractional (unsigned long phase) |
Set the phase of the currently playing Oscil in fractional format. More... | |
unsigned long | getPhaseFractional () |
Get the phase of the currently playin Oscil in fractional format. More... | |
int8_t | phMod (Q15n16 phmod_proportion) |
Returns the next sample given a phase modulation value. More... | |
void | setFreq (int frequency, bool apply=true) |
Set the MetaOsc frequency with an unsigned int. More... | |
void | setFreq (float frequency) |
Set the MetaOsc frequency with a float. More... | |
void | setFreq_Q24n8 (Q24n8 frequency) |
Set the MetaOsc frequency with a Q24n8 fixed-point number format. More... | |
void | setFreq_Q16n16 (Q16n16 frequency) |
Set the MetaOsc frequency with a Q16n16 fixed-point number format. More... | |
int8_t | atIndex (unsigned int index) |
Returns the sample at the given table index of the current Oscil. More... | |
unsigned long | phaseIncFromFreq (int frequency) |
phaseIncFromFreq() and setPhaseInc() are for saving processor time when sliding between frequencies. More... | |
void | setPhaseInc (unsigned long phaseinc_fractional) |
Set a specific phase increment. More... | |
MetaOscil is a wrapper for several Oscil.
Once constructed it will behave exactly as an Oscil except that it will automatically switch between Oscil depending on the asked frequency. This allows to produce non-aliased sounds by switching between tables with less and less harmonics as the frequency increases.
Definition at line 29 of file MetaOscil.h.
|
inline |
Constructor Declare a MetaOscil containing any number of Oscil pointers.
Every Oscil should have the same TABLE_NUM_CELLS and UPDATE_RATE which are also passed in the MetaOscil constructor.
N_OSCIL | is the number of Oscil contained in the MetaOscil. This cannot be changed after construction. |
Definition at line 36 of file MetaOscil.h.
|
inline |
Returns the sample at the given table index of the current Oscil.
index | between 0 and the table size.The index rolls back around to 0 if it's larger than the table size. |
Definition at line 201 of file MetaOscil.h.
|
inline |
Get the phase of the currently playin Oscil in fractional format.
Definition at line 112 of file MetaOscil.h.
|
inline |
Updates the phase according to the current frequency and returns the sample at the new phase position.
Definition at line 91 of file MetaOscil.h.
|
inline |
phaseIncFromFreq() and setPhaseInc() are for saving processor time when sliding between frequencies.
frequency | for which you want to calculate a phase increment value. |
Definition at line 208 of file MetaOscil.h.
|
inline |
Returns the next sample given a phase modulation value.
phmod_proportion | a phase modulation value given as a proportion of the wave. The phmod_proportion parameter is a Q15n16 fixed-point number where the fractional n16 part represents almost -1 to almost 1, modulating the phase by one whole table length in each direction. |
Definition at line 123 of file MetaOscil.h.
|
inline |
Set or change the cutoff frequency of one Oscil.
rank | is the rank of the Oscil. |
freq | is the cutoff frequency. |
Definition at line 82 of file MetaOscil.h.
|
inline |
Set all the cutoff frequencies for changing between Oscil.
They have to be sorted in increasing values and contain at least N_OSCIL-1 values. Note that the last Oscil will be used by default for frequencies higher than the higher cutoff, hence the last value can be discarded.
first,elements... | a set of int cutoff frequencies. |
Definition at line 69 of file MetaOscil.h.
|
inline |
Set the MetaOsc frequency with an unsigned int.
frequency | to play the wave table. |
Definition at line 129 of file MetaOscil.h.
|
inline |
Set the MetaOsc frequency with a float.
frequency | to play the wave table. |
Definition at line 168 of file MetaOscil.h.
|
inline |
Set the MetaOsc frequency with a Q16n16 fixed-point number format.
frequency | to play the wave table. |
Definition at line 188 of file MetaOscil.h.
|
inline |
Set the MetaOsc frequency with a Q24n8 fixed-point number format.
frequency | to play the wave table. |
Definition at line 178 of file MetaOscil.h.
|
inline |
first... | is a list of pointers towards several Oscil |
Definition at line 55 of file MetaOscil.h.
|
inline |
Set the phase of the currently playing Oscil.
phase | a position in the wavetable. |
Definition at line 101 of file MetaOscil.h.
|
inline |
Set the phase of the currently playing Oscil in fractional format.
phase | a position in the wavetable. |
Definition at line 106 of file MetaOscil.h.
|
inline |
Set a specific phase increment.
phaseinc_fractional | a phase increment value as calculated by phaseIncFromFreq(). |
Definition at line 214 of file MetaOscil.h.
|
inline |
Change the sound table which will be played by the Oscil of rank.
TABLE_NAME | is the name of the array in the table ".h" file you're using. |
rank | is the Oscil. |
Definition at line 96 of file MetaOscil.h.