Skip to content

Commit 7ebaa9c

Browse files
committed
Added FixMath support for MetaOscil
1 parent 93a51c0 commit 7ebaa9c

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

MetaOscil.h

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
#include "Oscil.h"
2222
#include "mozzi_fixmath.h"
23+
#include <FixMath.h>
2324

2425

2526
/**
@@ -172,6 +173,19 @@ template<uint16_t NUM_TABLE_CELLS, uint16_t UPDATE_RATE, byte N_OSCIL>
172173
setFreq((int) frequency, false);
173174
current_osc->setFreq(frequency);
174175
}
176+
177+
178+
/** 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..
179+
@param frequency to play the wave table.
180+
*/
181+
template <int8_t NI, int8_t NF, uint64_t RANGE>
182+
inline
183+
void setFreq(UFix<NI,NF,RANGE> frequency)
184+
{
185+
setFreq(frequency.asInt(), false);
186+
current_osc->setFreq(frequency);
187+
}
188+
175189

176190

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

186201

187202
/** Set the MetaOsc frequency with a Q16n16 fixed-point number format.

0 commit comments

Comments
 (0)