Swadge 2024 2.0.0
APIs to develop games for the Magfest Swadge
|
Functions | |
void | swSynthInitOscillator (synthOscillator_t *osc, oscillatorShape_t shape, uint32_t freq, uint8_t volume) |
Initialize a software synthesizer oscillator. | |
void | swSynthInitOscillatorWave (synthOscillator_t *osc, waveFunc_t waveFunc, void *waveData, uint32_t freq, uint8_t volume) |
Initialize a software synthesizer oscillator. | |
void | swSynthSetShape (synthOscillator_t *osc, oscillatorShape_t shape) |
Set a software synthesizer oscillator's shape. | |
void | swSynthSetWaveFunc (synthOscillator_t *osc, waveFunc_t waveFunc, void *waveFuncData) |
Set the wave function of an oscillator. | |
void | swSynthSetFreq (synthOscillator_t *osc, uint32_t freq) |
Set the frequency of an oscillator. | |
void | swSynthSetFreqPrecise (synthOscillator_t *osc, uq16_16 freq) |
Set the frequency of an oscillator with 16 bits of decimal precision. | |
void | swSynthSetVolume (synthOscillator_t *osc, uint8_t volume) |
Set the volume (amplitude) of an oscillator. | |
uint8_t | swSynthMixOscillators (synthOscillator_t *oscillators[], uint16_t numOscillators) |
Increment a set of oscillators by one step each, mix together the resulting samples, and return the single mixed sample. | |
int32_t | swSynthSumOscillators (synthOscillator_t *oscillators[], uint16_t numOscillators) |
Increment and mix together a set of oscillators like swSynthMixOscillators(), but returns the intermediate sample sum rather than the average, to allow mixing in other sources without losing precision. | |
int8_t | swSynthSampleWave (oscillatorShape_t shape, uint8_t idx) |
void swSynthInitOscillator | ( | synthOscillator_t * | osc, |
oscillatorShape_t | shape, | ||
uint32_t | freq, | ||
uint8_t | volume ) |
Initialize a software synthesizer oscillator.
osc | The oscillator to initialize |
shape | The shape of the wave to generate |
freq | The frequency of the wave to generate, in hertz |
volume | The volume (amplitude) of the wave to generate |
void swSynthInitOscillatorWave | ( | synthOscillator_t * | osc, |
waveFunc_t | waveFunc, | ||
void * | waveData, | ||
uint32_t | freq, | ||
uint8_t | volume ) |
Initialize a software synthesizer oscillator.
osc | The oscillator to initialize |
waveFunc | The wave function to use |
waveData | Custom data to pass into the wave function |
freq | The frequency of the wave to generate, in hertz |
volume | The volume (amplitude) of the wave to generate |
void swSynthSetShape | ( | synthOscillator_t * | osc, |
oscillatorShape_t | shape ) |
Set a software synthesizer oscillator's shape.
osc | The oscillator to set the shape for |
shape | The shape to set (sine, square, sawtooth, triangle, or noise) |
void swSynthSetWaveFunc | ( | synthOscillator_t * | osc, |
waveFunc_t | waveFunc, | ||
void * | waveFuncData ) |
Set the wave function of an oscillator.
osc | The oscillator to set the wave function of |
waveFunc | The wave function to use |
waveFuncData | Data to be passed to the wave function |
void swSynthSetFreq | ( | synthOscillator_t * | osc, |
uint32_t | freq ) |
Set the frequency of an oscillator.
osc | The oscillator to set the frequency for |
freq | The frequency to set |
void swSynthSetFreqPrecise | ( | synthOscillator_t * | osc, |
uq16_16 | freq ) |
Set the frequency of an oscillator with 16 bits of decimal precision.
osc | The oscillator to set the frequency for |
freq | The frequency to set, as a fixed-point value with 16 bits of decimal precision |
void swSynthSetVolume | ( | synthOscillator_t * | osc, |
uint8_t | volume ) |
Set the volume (amplitude) of an oscillator.
osc | The oscillator to set the volume for |
volume | The volume, 255 is loudest, 0 is off |
uint8_t swSynthMixOscillators | ( | synthOscillator_t * | oscillators[], |
uint16_t | numOscillators ) |
Increment a set of oscillators by one step each, mix together the resulting samples, and return the single mixed sample.
oscillators | An array of pointers to oscillators to step and mix together |
numOscillators | The number of oscillators to step and mix |
int32_t swSynthSumOscillators | ( | synthOscillator_t * | oscillators[], |
uint16_t | numOscillators ) |
Increment and mix together a set of oscillators like swSynthMixOscillators(), but returns the intermediate sample sum rather than the average, to allow mixing in other sources without losing precision.
The caller must divide this value by the number of oscillators (plus the number of other sources) then add 128 to the result to convert it to an unsigned 8-bit value.
oscillators | An array of oscillator pointers |
numOscillators | The number of members in oscillators |
int8_t swSynthSampleWave | ( | oscillatorShape_t | shape, |
uint8_t | idx ) |