Skip to content

Commit

Permalink
Implemented mozzi_midi for FixMath
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcombriat committed Dec 19, 2023
1 parent 735da56 commit 11545dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
11 changes: 0 additions & 11 deletions mozzi_midi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,14 +167,3 @@ int mtof(int midi_note){
return (FLASH_OR_RAM_READ<const uint32_t>(midiToFreq + midi_note) >> 16);
}

inline UFixMath<16,16> mtof(UFixMath<16,16> midival)
{
return Q16n16_mtof(midival.asRaw());
}


template<byte NI, byte NF>
inline UFixMath<16,16> mtof(UFixMath<NI,NF> midival)
{
return Q16n16_mtof(UFixMath<16,16>(midival).asRaw());
}
17 changes: 15 additions & 2 deletions mozzi_midi.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,22 @@ float mtof(float x);
int mtof(uint8_t midi_note);
int mtof(int midi_note);
Q16n16 Q16n16_mtof(Q16n16 midival);
UFixMath<16,16> mtof(UFixMath<16,16> midival);

inline UFixMath<16,16> mtof(UFixMath<16,16> midival)
{
return Q16n16_mtof(midival.asRaw());
}

template<byte NI, byte NF>
inline UFixMath<16,16> mtof(UFixMath<NI,NF> midival)
{
return Q16n16_mtof(UFixMath<16,16>(midival).asRaw());
}

template<byte NI, byte NF>
UFixMath<16,16> mtof(UFixMath<NI,NF> midival);
inline UFixMath<16,16> mtof(SFixMath<NI,NF> midival)
{
return Q16n16_mtof(UFixMath<16,16>(midival).asRaw());
}

#endif /* MOZZI_MIDI_H_ */

0 comments on commit 11545dd

Please sign in to comment.