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