Add deeper simulation of USB midi
This commit is contained in:
parent
2d034b6369
commit
3d38f50d98
6 changed files with 96 additions and 59 deletions
|
@ -26,7 +26,8 @@ extern Adafruit_SSD1306 display;
|
|||
extern Adafruit_MPR121 touchSensor;
|
||||
SimWire Wire;
|
||||
SimSerial Serial;
|
||||
|
||||
SimSerial Serial3; //Midi
|
||||
SimUsbMidi usbMIDI;
|
||||
|
||||
static const int scale = 3;
|
||||
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
#include <Arduino.h>
|
||||
#include "midi.h"
|
||||
|
||||
void midiSetChannel(byte __attribute__((unused)) channel){}
|
||||
|
||||
byte midiGetChannel(){ return 1; }
|
||||
|
||||
void midiSendProgramChange(int __attribute__((unused)) patch)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiSendControlChange(int __attribute__((unused)) ccParam, int __attribute__((unused)) ccValue)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiSendNoteOn(byte __attribute__((unused)) note, int __attribute__((unused)) velocity)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiSendNoteOff(byte __attribute__((unused)) note)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiSendAfterTouch(byte __attribute__((unused)) value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiSendPitchBend(int __attribute__((unused)) value)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiDiscardInput()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiReset()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void midiPanic()
|
||||
{
|
||||
// turn all notes off
|
||||
}
|
||||
|
||||
void midiInitialize(byte __attribute__((unused)) channel)
|
||||
{
|
||||
|
||||
}
|
|
@ -41,3 +41,15 @@ void SimSerial::println(const char *str)
|
|||
printf( "[Serial::println] %s\n", str );
|
||||
}
|
||||
|
||||
//Used to send serial midi
|
||||
void SimSerial::write(const uint8_t str)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void SimSerial::flush()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
|
59
simulation/src/simusbmidi.cpp
Normal file
59
simulation/src/simusbmidi.cpp
Normal file
|
@ -0,0 +1,59 @@
|
|||
#include <cstdint>
|
||||
#include <cstdio>
|
||||
|
||||
|
||||
#include "Arduino.h"
|
||||
|
||||
/*************************************
|
||||
* Stub simulation of Teensy usbMidi
|
||||
*/
|
||||
|
||||
|
||||
void SimUsbMidi::sendNoteOff(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::noteOff] note %03d vel %03d ch %02d\n", note, velocity, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendNoteOn(uint8_t note, uint8_t velocity, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::noteOn] note %03d vel %03d ch %02d\n", note, velocity, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendPolyPressure(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::polyPressure] note %03d p %03d ch %02d\n", note, pressure, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendAfterTouchPoly(uint8_t note, uint8_t pressure, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::afterTouchPoly] note %03d p %03d ch %02d\n", note, pressure, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendControlChange(uint8_t control, uint8_t value, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::controlChange] cc %03d val %03d ch %02d\n", control, value, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendProgramChange(uint8_t program, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::programChange] prg %03d ch %02d\n", program, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendAfterTouch(uint8_t pressure, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::afterTouch] p %03d ch %02d\n", pressure, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendPitchBend(int value, uint8_t channel, uint8_t cable)
|
||||
{
|
||||
printf( "[usbMIDI::pitchBend] pb %05d ch %02d\n", value, channel);
|
||||
}
|
||||
|
||||
void SimUsbMidi::sendSysEx(uint16_t length, const uint8_t *data, bool hasTerm, uint8_t cable)
|
||||
{
|
||||
}
|
||||
|
||||
bool SimUsbMidi::read(uint8_t channel) {
|
||||
return false;
|
||||
}
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue