-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
86 additions
and
97 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[submodule "3rdparty/rtmidi"] | ||
path = 3rdparty/rtmidi | ||
url = https://github.com/Wohlstand/rtmidi.git | ||
[submodule "3rdparty/portmidi"] | ||
path = 3rdparty/portmidi | ||
url = https://github.com/PortMidi/portmidi.git |
Submodule rtmidi
deleted from
722703
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,5 @@ | |
|
||
int MIDI_Init(void); | ||
void MIDI_Quit(void); | ||
void MIDI_Update(void); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#include <stdio.h> | ||
#include "mcu.h" | ||
#include "submcu.h" | ||
#include "midi.h" | ||
#include <portmidi.h> | ||
|
||
static PmStream *midiInStream; | ||
static bool sysExMode = false; | ||
|
||
void MIDI_Update() | ||
{ | ||
PmEvent event; | ||
while (Pm_Read(midiInStream, &event, 1)) { | ||
uint8_t command = (Pm_MessageStatus(event.message) >> 4); | ||
|
||
SM_PostUART(Pm_MessageStatus(event.message)); | ||
|
||
if (sysExMode && Pm_MessageStatus(event.message) == 0xF7) { | ||
sysExMode = false; | ||
} else if (sysExMode || Pm_MessageStatus(event.message) == 0xF0) { | ||
sysExMode = true; | ||
SM_PostUART(Pm_MessageData1(event.message)); | ||
if (Pm_MessageData1(event.message) == 0xF7) { | ||
sysExMode = false; | ||
return; | ||
} | ||
SM_PostUART(Pm_MessageData2(event.message)); | ||
if (Pm_MessageData2(event.message) == 0xF7) { | ||
sysExMode = false; | ||
return; | ||
} | ||
SM_PostUART((((event.message) >> 24) & 0xFF)); | ||
if ((((event.message) >> 24) & 0xFF) == 0xF7) { | ||
sysExMode = false; | ||
return; | ||
} | ||
} else if (command == 0xC || command == 0xD || Pm_MessageStatus(event.message) == 0xF3) { | ||
SM_PostUART(Pm_MessageData1(event.message)); | ||
} else if (command == 0x8 || command == 0x9 || command == 0xA || command == 0xB || command == 0xE){ | ||
SM_PostUART(Pm_MessageData1(event.message)); | ||
SM_PostUART(Pm_MessageData2(event.message)); | ||
} | ||
} | ||
} | ||
|
||
int MIDI_Init(void) | ||
{ | ||
Pm_Initialize(); | ||
|
||
int in_id = Pm_CreateVirtualInput("Virtual SC55", NULL, NULL); | ||
|
||
Pm_OpenInput(&midiInStream, in_id, NULL, 0, NULL, NULL); | ||
Pm_SetFilter(midiInStream, PM_FILT_ACTIVE | PM_FILT_CLOCK); | ||
|
||
// Empty the buffer, just in case anything got through | ||
PmEvent receiveBuffer[1]; | ||
while (Pm_Poll(midiInStream)) { | ||
Pm_Read(midiInStream, receiveBuffer, 1); | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
void MIDI_Quit() | ||
{ | ||
Pm_Terminate(); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -145,3 +145,7 @@ void MIDI_Quit() | |
midi_handle = 0; | ||
} | ||
} | ||
|
||
void MIDI_Update() | ||
{ | ||
} |