8#include "target_constants.h"
18 .
name =
"MIDI (TMC)" ,
30 for(uint8_t i = 0;i<128;i++){
31 float f = std::pow(2, (i - 69) / 12.0) * 440.0;
36 extern TIM_HandleTypeDef TIM_USER;
44 this->
drv = std::make_unique<TMC_1>();
46 drv->setLimits(limits);
57 drv->allowSlowSPI =
false;
58 if(!
drv->initialize()){
80 if(
drv->hasPower() &&!
drv->isSetUp()){
81 drv->initializeWithPower();
94 if(
notes[chan].empty()){
113 float volume = note->
volume / 127.0f;
114 float p = (note->
counter*freq);
115 float sine = sinf(M_PI*p) * volume;
118 drv->setPhiE_ext(val);
127 midinote.
note = note;
130 notes[chan].push_back(midinote);
134 for(
auto it =
notes[chan].begin(); it!=
notes[chan].end(); ++it){
135 if(it->note == note){
136 notes[chan].erase(it);
144 if(c == 120 || c == 121 || c == 123){
149 float pb = std::pow(2.0f, (((
float)val/8192.0f)));
151 for(
auto it =
notes[chan].begin(); it!=
notes[chan].end(); ++it){
void registerCommand(const char *cmd, const ID cmdid, const char *help=nullptr, uint32_t flags=0)
static CommandStatus handleGetSet(const ParsedCommand &cmd, std::vector< CommandReply > &replies, TVal &value)
std::unique_ptr< USBdevice > usbdev
void controlChange(uint8_t chan, uint8_t c, uint8_t val)
std::unique_ptr< TMC4671 > drv
static ClassIdentifier info
const ClassIdentifier getInfo()
TIM_HandleTypeDef * timer_update
void noteOff(uint8_t chan, uint8_t note, uint8_t velocity)
void pitchBend(uint8_t chan, int16_t val)
std::vector< MidiNote > notes[16]
void timerElapsed(TIM_HandleTypeDef *htim)
void noteOn(uint8_t chan, uint8_t note, uint8_t velocity)
CommandStatus command(const ParsedCommand &cmd, std::vector< CommandReply > &replies)
const uint8_t usb_cdc_midi_conf[]
const tusb_desc_device_t usb_devdesc_ffboard_composite
const usb_string_desc_t usb_ffboard_strings_default