Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added FixMath support for MetaOscil #285

Merged
merged 1 commit into from
Nov 10, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions MetaOscil.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

#include "Oscil.h"
#include "mozzi_fixmath.h"
#include <FixMath.h>


/**
Expand Down Expand Up @@ -172,6 +173,19 @@ template<uint16_t NUM_TABLE_CELLS, uint16_t UPDATE_RATE, byte N_OSCIL>
setFreq((int) frequency, false);
current_osc->setFreq(frequency);
}


/** Set the MetaOsc frequency with a UFix<NI,NF> fixed-point number format. This falls back to using UFix<16,16> internally and is provided as a fallout for other UFix types..
@param frequency to play the wave table.
*/
template <int8_t NI, int8_t NF, uint64_t RANGE>
inline
void setFreq(UFix<NI,NF,RANGE> frequency)
{
setFreq(frequency.asInt(), false);
current_osc->setFreq(frequency);
}



/** Set the MetaOsc frequency with a Q24n8 fixed-point number format.
Expand All @@ -182,6 +196,7 @@ template<uint16_t NUM_TABLE_CELLS, uint16_t UPDATE_RATE, byte N_OSCIL>
setFreq((int) (frequency>>8), false);
current_osc->setFreq_Q24n8(frequency);
}



/** Set the MetaOsc frequency with a Q16n16 fixed-point number format.
Expand Down
Loading