Changes for new TeensyDuino-1.59,

dev
Holger Wirtz 9 months ago
parent dac0c88362
commit fd87ad2f19
  1. 2
      config.h
  2. 123
      midi_devices.hpp
  3. 2
      third-party/TeensyVariablePlayback/src/waveheaderparser.h

@ -75,7 +75,7 @@
#define MIDI_DEVICE_USB_HOST_SERIAL 1
#ifdef MIDI_DEVICE_USB_HOST_SERIAL
#define NUM_HUBS_MIDI_DEVICE_USB_HOST_SERIAL 4 // 0..4 - needed, if you want to connect a USB-HUB wit hup to 4 devices to the USB-HOST port
#define NUM_HUBS_MIDI_DEVICE_USB_HOST_SERIAL 4 // 0..4 - needed, if you want to connect a USB-HUB with up to 4 devices to the USB-HOST port
#define USB_HOST_SERIAL_BAUD 38400
#define USB_HOST_SERIAL_FORMAT USBHOST_SERIAL_8N1
#endif

@ -24,6 +24,8 @@
#ifndef MIDI_DEVICES_H
#define MIDI_DEVICES_H
#include <MIDI.h>
#include <midi_Message.h>
#include "config.h"
extern config_t configuration;
@ -36,7 +38,7 @@ extern config_t configuration;
struct MicroDexedSettings : public midi::DefaultSettings {
static const bool UseRunningStatus = false;
static const bool HandleNullVelocityNoteOnAsNoteOff = true;
static const bool Use1ByteParsing = true;
static const bool Use1uint8_tParsing = true;
static const unsigned SysExMaxSize = 4104;
static const bool UseSenderActiveSensing = false;
static const bool UseReceiverActiveSensing = false;
@ -72,17 +74,17 @@ MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> serialMI
MIDI_NAMESPACE::MidiInterface<MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings>> usbhost_midi_serial((MIDI_NAMESPACE::SerialMIDI<USBSerial_BigBuffer, CustomBaudRateSettings> &)serialMIDI);
#endif
void handleNoteOn(byte inChannel, byte inNumber, byte inVelocity);
void handleNoteOff(byte inChannel, byte inNumber, byte inVelocity);
void handleControlChange(byte inChannel, byte inData1, byte inData2);
void handleAfterTouch(byte inChannel, byte inPressure);
void handleNoteOn(byte inChannel, uint8_t inNumber, uint8_t inVelocity);
void handleNoteOff(byte inChannel, uint8_t inNumber, uint8_t inVelocity);
void handleControlChange(byte inChannel, uint8_t inData1, uint8_t inData2);
void handleAfterTouch(byte inChannel, uint8_t inPressure);
void handlePitchBend(byte inChannel, int inPitch);
void handleProgramChange(byte inChannel, byte inProgram);
void handleAfterTouchPoly(byte inChannel, byte inNumber, byte inVelocity);
void handleSystemExclusive(byte *data, uint len);
//void handleSystemExclusiveChunk(const byte *data, uint len, bool last);
void handleTimeCodeQuarterFrame(byte data);
void handleSongSelect(byte inSong);
void handleProgramChange(byte inChannel, uint8_t inProgram);
void handleAfterTouchPoly(byte inChannel, uint8_t inNumber, uint8_t inVelocity);
void handleSystemExclusive(uint8_t *data, uint len);
//void handleSystemExclusiveChunk(const uint8_t *data, uint len, bool last);
void handleTimeCodeQuarterFrame(uint8_t data);
void handleSongSelect(uint8_t inSong);
void handleTuneRequest(void);
void handleClock(void);
void handleStart(void);
@ -98,7 +100,8 @@ void MD_sendControlChange(uint8_t channel, uint8_t cc, uint8_t value);
#define MIDI_BY_USB_HOST "MIDI_USB_HOST"
#define MIDI_BY_USB_HOST_SERIAL "MIDI_USB_HOST_SERIAL"
void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi_device, midi::MidiType event) {
void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char *midi_device, midi::MidiType event) {
//void handle_generic(byte inChannel, uint8_t inData1, uint8_t inData2, const char *midi_device, uint_8t event) {
char text[10];
switch (event) {
@ -277,7 +280,7 @@ void handle_generic(byte inChannel, byte inData1, byte inData2, const char *midi
#endif
}
void handleSystemExclusive_generic(byte *data, uint len, const char *midi_device) {
void handleSystemExclusive_generic(uint8_t *data, uint len, const char *midi_device) {
handleSystemExclusive(data, len);
#ifdef DEBUG
Serial.printf_P(PSTR("[%s] SysEx"), midi_device);
@ -327,7 +330,7 @@ void handleSystemExclusive_generic(byte *data, uint len, const char *midi_device
#endif
}
void handleSystemCommon_generic(byte inData1, const char *midi_device, midi::MidiType event) {
void handleSystemCommon_generic(uint8_t inData1, const char *midi_device, midi::MidiType event) {
char text[10];
switch (event) {
@ -521,9 +524,9 @@ void handleRealtime_generic(const char *midi_device, midi::MidiType event) {
#endif
}
///* void handleSystemExclusiveChunk_MIDI_DEVICE_DIN(byte *data, uint len, bool last)
///* void handleSystemExclusiveChunk_MIDI_DEVICE_DIN(uint8_t *data, uint len, bool last)
// void handlRealTimeSystem_generic(byte inRealTime, byte midi_device) {
// void handlRealTimeSystem_generic(uint8_t inRealTime, uint8_t midi_device) {
// handleRealTimeSystem();
// #ifdef DEBUG
// switch(midi_device) {
@ -579,19 +582,19 @@ void handleRealtime_generic(const char *midi_device, midi::MidiType event) {
*****************************************/
#ifdef MIDI_DEVICE_DIN
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOn_MIDI_DEVICE_DIN(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOn);
}
void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOff_MIDI_DEVICE_DIN(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::NoteOff);
}
void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, byte inData1, byte inData2) {
void handleControlChange_MIDI_DEVICE_DIN(byte inChannel, uint8_t inData1, uint8_t inData2) {
handle_generic(inChannel, inData1, inData2, MIDI_BY_DIN, midi::ControlChange);
}
void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, byte inPressure) {
void handleAfterTouch_MIDI_DEVICE_DIN(byte inChannel, uint8_t inPressure) {
handle_generic(inChannel, inPressure, '\0', MIDI_BY_DIN, midi::AfterTouchChannel);
}
@ -599,19 +602,19 @@ void handlePitchBend_MIDI_DEVICE_DIN(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_DIN, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, byte inProgram) {
void handleProgramChange_MIDI_DEVICE_DIN(byte inChannel, uint8_t inProgram) {
handle_generic(inChannel, inProgram, '\0', MIDI_BY_DIN, midi::ProgramChange);
}
void handleAfterTouchPoly_MIDI_DEVICE_DIN(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleAfterTouchPoly_MIDI_DEVICE_DIN(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_DIN, midi::AfterTouchPoly);
}
void handleSystemExclusive_MIDI_DEVICE_DIN(byte *data, uint len) {
void handleSystemExclusive_MIDI_DEVICE_DIN(uint8_t *data, uint len) {
handleSystemExclusive_generic(data, len, MIDI_BY_DIN);
}
/* void handleSystemExclusiveChunk_MIDI_DEVICE_DIN(byte *data, uint len, bool last)
/* void handleSystemExclusiveChunk_MIDI_DEVICE_DIN(uint8_t *data, uint len, bool last)
{
handleSystemExclusiveChunk(data, len, last);
#ifdef DEBUG
@ -637,11 +640,11 @@ void handleSystemExclusive_MIDI_DEVICE_DIN(byte *data, uint len) {
#endif
} */
void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(byte data) {
void handleTimeCodeQuarterFrame_MIDI_DEVICE_DIN(uint8_t data) {
handleSystemCommon_generic(data, MIDI_BY_DIN, midi::TimeCodeQuarterFrame);
}
void handleSongSelect_MIDI_DEVICE_DIN(byte inSong) {
void handleSongSelect_MIDI_DEVICE_DIN(uint8_t inSong) {
handleSystemCommon_generic(inSong, MIDI_BY_DIN, midi::SongSelect);
}
@ -673,7 +676,7 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) {
handleRealtime_generic(MIDI_BY_DIN, midi::SystemReset);
}
/* void handlRealTimeSysteme_MIDI_DEVICE_DIN(byte inRealTime)
/* void handlRealTimeSysteme_MIDI_DEVICE_DIN(uint8_t inRealTime)
{
handleRealTimeSystem_generic(MIDI_DIN);
} */
@ -683,19 +686,19 @@ void handleSystemReset_MIDI_DEVICE_DIN(void) {
MIDI_DEVICE_USB_HOST
*****************************************/
#ifdef MIDI_DEVICE_USB_HOST
void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOn_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOn);
}
void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOff_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::NoteOff);
}
void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inData1, byte inData2) {
void handleControlChange_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inData1, uint8_t inData2) {
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB_HOST, midi::ControlChange);
}
void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, byte inPressure) {
void handleAfterTouch_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inPressure) {
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB_HOST, midi::AfterTouchChannel);
}
@ -703,19 +706,19 @@ void handlePitchBend_MIDI_DEVICE_USB_HOST(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, byte inProgram) {
void handleProgramChange_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inProgram) {
handle_generic(inChannel, inProgram, '\0', MIDI_BY_USB_HOST, midi::ProgramChange);
}
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST, midi::AfterTouchPoly);
}
void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte *data, uint len) {
void handleSystemExclusive_MIDI_DEVICE_USB_HOST(uint8_t *data, uint len) {
handleSystemExclusive_generic(data, len, MIDI_BY_USB_HOST);
}
/* void handleSystemExclusiveChunk_MIDI_DEVICE_USB_HOST(byte *data, uint len, bool last)
/* void handleSystemExclusiveChunk_MIDI_DEVICE_USB_HOST(uint8_t *data, uint len, bool last)
{
handleSystemExclusiveChunk(data, len, last);
#ifdef DEBUG
@ -741,11 +744,11 @@ void handleSystemExclusive_MIDI_DEVICE_USB_HOST(byte *data, uint len) {
#endif
} */
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(midi::DataByte data) {
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST(uint8_t data) {
handleSystemCommon_generic(data, MIDI_BY_USB_HOST, midi::TimeCodeQuarterFrame);
}
void handleSongSelect_MIDI_DEVICE_USB_HOST(byte inSong) {
void handleSongSelect_MIDI_DEVICE_USB_HOST(uint8_t inSong) {
handleSystemCommon_generic(inSong, MIDI_BY_USB_HOST, midi::SongSelect);
}
@ -785,19 +788,19 @@ void handleSystemReset_MIDI_DEVICE_USB_HOST(void) {
#endif // MIDI_DEVICE_USB_HOST
#ifdef MIDI_DEVICE_USB_HOST_SERIAL
void handleNoteOn_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOn_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST_SERIAL, midi::NoteOn);
}
void handleNoteOff_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOff_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST_SERIAL, midi::NoteOff);
}
void handleControlChange_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inData1, byte inData2) {
void handleControlChange_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inData1, uint8_t inData2) {
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB_HOST_SERIAL, midi::ControlChange);
}
void handleAfterTouch_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inPressure) {
void handleAfterTouch_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inPressure) {
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB_HOST_SERIAL, midi::AfterTouchChannel);
}
@ -805,19 +808,19 @@ void handlePitchBend_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB_HOST_SERIAL, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inProgram) {
void handleProgramChange_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inProgram) {
handle_generic(inChannel, inProgram, '\0', MIDI_BY_USB_HOST_SERIAL, midi::ProgramChange);
}
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleAfterTouchPoly_MIDI_DEVICE_USB_HOST_SERIAL(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB_HOST_SERIAL, midi::AfterTouchPoly);
}
void handleSystemExclusive_MIDI_DEVICE_USB_HOST_SERIAL(byte *data, uint len) {
void handleSystemExclusive_MIDI_DEVICE_USB_HOST_SERIAL(uint8_t *data, uint len) {
handleSystemExclusive_generic(data, len, MIDI_BY_USB_HOST_SERIAL);
}
/* void handleSystemExclusiveChunk_MIDI_DEVICE_USB_HOST_SERIAL(byte *data, uint len, bool last)
/* void handleSystemExclusiveChunk_MIDI_DEVICE_USB_HOST_SERIAL(uint8_t *data, uint len, bool last)
{
handleSystemExclusiveChunk(data, len, last);
#ifdef DEBUG
@ -843,11 +846,11 @@ void handleSystemExclusive_MIDI_DEVICE_USB_HOST_SERIAL(byte *data, uint len) {
#endif
} */
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST_SERIAL(midi::DataByte data) {
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB_HOST_SERIAL(uint8_t data) {
handleSystemCommon_generic(data, MIDI_BY_USB_HOST_SERIAL, midi::TimeCodeQuarterFrame);
}
void handleSongSelect_MIDI_DEVICE_USB_HOST_SERIAL(byte inSong) {
void handleSongSelect_MIDI_DEVICE_USB_HOST_SERIAL(uint8_t inSong) {
handleSystemCommon_generic(inSong, MIDI_BY_USB_HOST_SERIAL, midi::SongSelect);
}
@ -889,19 +892,19 @@ void handleSystemReset_MIDI_DEVICE_USB_HOST_SERIAL(void) {
MIDI_DEVICE_USB
*****************************************/
#ifdef MIDI_DEVICE_USB
void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOn_MIDI_DEVICE_USB(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOn);
}
void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleNoteOff_MIDI_DEVICE_USB(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::NoteOff);
}
void handleControlChange_MIDI_DEVICE_USB(byte inChannel, byte inData1, byte inData2) {
void handleControlChange_MIDI_DEVICE_USB(byte inChannel, uint8_t inData1, uint8_t inData2) {
handle_generic(inChannel, inData1, inData2, MIDI_BY_USB, midi::ControlChange);
}
void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, byte inPressure) {
void handleAfterTouch_MIDI_DEVICE_USB(byte inChannel, uint8_t inPressure) {
handle_generic(inChannel, inPressure, '\0', MIDI_BY_USB, midi::AfterTouchChannel);
}
@ -909,19 +912,19 @@ void handlePitchBend_MIDI_DEVICE_USB(byte inChannel, int inPitch) {
handle_generic(inChannel, inPitch, '\0', MIDI_BY_USB, midi::PitchBend);
}
void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, byte inProgram) {
void handleProgramChange_MIDI_DEVICE_USB(byte inChannel, uint8_t inProgram) {
handle_generic(inChannel, inProgram, '\0', MIDI_BY_USB, midi::ProgramChange);
}
void handleAfterTouchPoly_MIDI_DEVICE_USB(byte inChannel, byte inNoteNumber, byte inVelocity) {
void handleAfterTouchPoly_MIDI_DEVICE_USB(byte inChannel, uint8_t inNoteNumber, uint8_t inVelocity) {
handle_generic(inChannel, inNoteNumber, inVelocity, MIDI_BY_USB, midi::AfterTouchPoly);
}
void handleSystemExclusive_MIDI_DEVICE_USB(byte *data, uint len) {
void handleSystemExclusive_MIDI_DEVICE_USB(uint8_t *data, uint len) {
handleSystemExclusive_generic(data, len, MIDI_BY_USB);
}
/* FLASHMEM void handleSystemExclusiveChunk_MIDI_DEVICE_USB(byte *data, uint len, bool last)
/* FLASHMEM void handleSystemExclusiveChunk_MIDI_DEVICE_USB(uint8_t *data, uint len, bool last)
{
handleSystemExclusiveChunk(data, len, last);
#ifdef DEBUG
@ -947,11 +950,11 @@ void handleSystemExclusive_MIDI_DEVICE_USB(byte *data, uint len) {
#endif
} */
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(midi::DataByte data) {
void handleTimeCodeQuarterFrame_MIDI_DEVICE_USB(uint8_t data) {
handleSystemCommon_generic(data, MIDI_BY_USB, midi::TimeCodeQuarterFrame);
}
void handleSongSelect_MIDI_DEVICE_USB(byte inSong) {
void handleSongSelect_MIDI_DEVICE_USB(uint8_t inSong) {
handleSystemCommon_generic(inSong, MIDI_BY_USB, midi::SongSelect);
}
@ -983,7 +986,7 @@ void handleSystemReset_MIDI_DEVICE_USB(void) {
handleRealtime_generic(MIDI_BY_USB, midi::SystemReset);
}
/* FLASHMEM void handleRealTimeSystem_MIDI_DEVICE_USB(byte inRealTime)
/* FLASHMEM void handleRealTimeSystem_MIDI_DEVICE_USB(uint8_t inRealTime)
{
handleRealTimeSystem_generic(inRealTime, USB_MIDI);
} */
@ -1174,8 +1177,8 @@ FLASHMEM void send_sysex_voice(uint8_t midi_channel, uint8_t *data) {
vd[0] = 0x43; // ID=Yamaha
vd[1] = midi_channel; // Sub-status and MIDI channel
vd[2] = 0x00; // Format number (0=1 voice)
vd[3] = 0x01; // Byte count MSB
vd[4] = 0x1B; // Byte count LSB
vd[3] = 0x01; // uint8_t count MSB
vd[4] = 0x1B; // uint8_t count LSB
for (uint8_t n = 0; n < 155; n++) {
checksum -= data[n];
vd[5 + n] = data[n];

@ -9,7 +9,7 @@
#include <SD.h>
#include "spi_interrupt.h"
using namespace std;
//using namespace std;
// from https://gist.github.com/Jon-Schneider/8b7c53d27a7a13346a643dac9c19d34f
struct wav_header {

Loading…
Cancel
Save