GUI: wake up on MIDI event
This commit is contained in:
parent
932f81e1e7
commit
c0118a4b82
|
@ -3584,6 +3584,9 @@ bool FurnaceGUI::loop() {
|
||||||
SDL_free(ev.drop.file);
|
SDL_free(ev.drop.file);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case SDL_USEREVENT:
|
||||||
|
// used for MIDI wake up
|
||||||
|
break;
|
||||||
case SDL_QUIT:
|
case SDL_QUIT:
|
||||||
if (modified) {
|
if (modified) {
|
||||||
showWarning("Unsaved changes! Save changes before quitting?",GUI_WARN_QUIT);
|
showWarning("Unsaved changes! Save changes before quitting?",GUI_WARN_QUIT);
|
||||||
|
@ -3647,6 +3650,7 @@ bool FurnaceGUI::loop() {
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
midiLock.lock();
|
midiLock.lock();
|
||||||
|
midiWakeUp=true;
|
||||||
if (midiQueue.empty()) {
|
if (midiQueue.empty()) {
|
||||||
midiLock.unlock();
|
midiLock.unlock();
|
||||||
break;
|
break;
|
||||||
|
@ -6729,11 +6733,20 @@ bool FurnaceGUI::init() {
|
||||||
|
|
||||||
firstFrame=true;
|
firstFrame=true;
|
||||||
|
|
||||||
// TODO: MIDI mapping time!
|
userEvents=SDL_RegisterEvents(1);
|
||||||
|
|
||||||
e->setMidiCallback([this](const TAMidiMessage& msg) -> int {
|
e->setMidiCallback([this](const TAMidiMessage& msg) -> int {
|
||||||
if (introPos<11.0) return -2;
|
if (introPos<11.0) return -2;
|
||||||
midiLock.lock();
|
midiLock.lock();
|
||||||
midiQueue.push(msg);
|
midiQueue.push(msg);
|
||||||
|
if (userEvents!=0xffffffff && midiWakeUp) {
|
||||||
|
midiWakeUp=false;
|
||||||
|
userEvent.user.type=userEvents;
|
||||||
|
userEvent.user.code=0;
|
||||||
|
userEvent.user.data1=NULL;
|
||||||
|
userEvent.user.data2=NULL;
|
||||||
|
SDL_PushEvent(&userEvent);
|
||||||
|
}
|
||||||
midiLock.unlock();
|
midiLock.unlock();
|
||||||
e->setMidiBaseChan(cursor.xCoarse);
|
e->setMidiBaseChan(cursor.xCoarse);
|
||||||
if (msg.type==TA_MIDI_SYSEX) return -2;
|
if (msg.type==TA_MIDI_SYSEX) return -2;
|
||||||
|
@ -7013,6 +7026,7 @@ FurnaceGUI::FurnaceGUI():
|
||||||
displayEditString(false),
|
displayEditString(false),
|
||||||
mobileEdit(false),
|
mobileEdit(false),
|
||||||
killGraphics(false),
|
killGraphics(false),
|
||||||
|
midiWakeUp(true),
|
||||||
audioEngineChanged(false),
|
audioEngineChanged(false),
|
||||||
settingsChanged(false),
|
settingsChanged(false),
|
||||||
debugFFT(false),
|
debugFFT(false),
|
||||||
|
@ -7026,6 +7040,8 @@ FurnaceGUI::FurnaceGUI():
|
||||||
mobileEditPage(0),
|
mobileEditPage(0),
|
||||||
wheelCalmDown(0),
|
wheelCalmDown(0),
|
||||||
shallDetectScale(0),
|
shallDetectScale(0),
|
||||||
|
cpuCores(0),
|
||||||
|
userEvents(0xffffffff),
|
||||||
mobileMenuPos(0.0f),
|
mobileMenuPos(0.0f),
|
||||||
autoButtonSize(0.0f),
|
autoButtonSize(0.0f),
|
||||||
mobileEditAnim(0.0f),
|
mobileEditAnim(0.0f),
|
||||||
|
|
|
@ -1345,6 +1345,7 @@ class FurnaceGUI {
|
||||||
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
bool displayPendingIns, pendingInsSingle, displayPendingRawSample, snesFilterHex, modTableHex, displayEditString;
|
||||||
bool mobileEdit;
|
bool mobileEdit;
|
||||||
bool killGraphics;
|
bool killGraphics;
|
||||||
|
bool midiWakeUp;
|
||||||
bool audioEngineChanged, settingsChanged, debugFFT;
|
bool audioEngineChanged, settingsChanged, debugFFT;
|
||||||
bool willExport[DIV_MAX_CHIPS];
|
bool willExport[DIV_MAX_CHIPS];
|
||||||
int vgmExportVersion;
|
int vgmExportVersion;
|
||||||
|
@ -1358,6 +1359,7 @@ class FurnaceGUI {
|
||||||
int wheelCalmDown;
|
int wheelCalmDown;
|
||||||
int shallDetectScale;
|
int shallDetectScale;
|
||||||
int cpuCores;
|
int cpuCores;
|
||||||
|
unsigned int userEvents;
|
||||||
float mobileMenuPos, autoButtonSize, mobileEditAnim;
|
float mobileMenuPos, autoButtonSize, mobileEditAnim;
|
||||||
ImVec2 mobileEditButtonPos, mobileEditButtonSize;
|
ImVec2 mobileEditButtonPos, mobileEditButtonSize;
|
||||||
const int* curSysSection;
|
const int* curSysSection;
|
||||||
|
@ -1371,6 +1373,7 @@ class FurnaceGUI {
|
||||||
void* fmPreviewOPZ;
|
void* fmPreviewOPZ;
|
||||||
void* fmPreviewOPZInterface;
|
void* fmPreviewOPZInterface;
|
||||||
String* editString;
|
String* editString;
|
||||||
|
SDL_Event userEvent;
|
||||||
|
|
||||||
String pendingRawSample;
|
String pendingRawSample;
|
||||||
int pendingRawSampleDepth, pendingRawSampleChannels;
|
int pendingRawSampleDepth, pendingRawSampleChannels;
|
||||||
|
|
Loading…
Reference in a new issue