parent
8aa0813bb9
commit
b519713222
|
|
@ -237,56 +237,60 @@ bool DivConfig::loadFromBase64(const char* buf) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivConfig::getBool(String key, bool fallback) const {
|
bool DivConfig::getBool(String key, bool fallback) const {
|
||||||
try {
|
auto val=conf.find(key);
|
||||||
String val=conf.at(key);
|
if (val!=conf.cend()) {
|
||||||
if (val=="true") {
|
if (val->second=="true") {
|
||||||
return true;
|
return true;
|
||||||
} else if (val=="false") {
|
} else if (val->second=="false") {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DivConfig::getInt(String key, int fallback) const {
|
int DivConfig::getInt(String key, int fallback) const {
|
||||||
|
auto val=conf.find(key);
|
||||||
|
if (val!=conf.cend()) {
|
||||||
try {
|
try {
|
||||||
String val=conf.at(key);
|
int ret=std::stoi(val->second);
|
||||||
int ret=std::stoi(val);
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
} catch (std::invalid_argument& e) {
|
} catch (std::invalid_argument& e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
float DivConfig::getFloat(String key, float fallback) const {
|
float DivConfig::getFloat(String key, float fallback) const {
|
||||||
|
auto val=conf.find(key);
|
||||||
|
if (val!=conf.cend()) {
|
||||||
try {
|
try {
|
||||||
String val=conf.at(key);
|
float ret=std::stof(val->second);
|
||||||
float ret=std::stof(val);
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
} catch (std::invalid_argument& e) {
|
} catch (std::invalid_argument& e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
double DivConfig::getDouble(String key, double fallback) const {
|
double DivConfig::getDouble(String key, double fallback) const {
|
||||||
|
auto val=conf.find(key);
|
||||||
|
if (val!=conf.cend()) {
|
||||||
try {
|
try {
|
||||||
String val=conf.at(key);
|
double ret=std::stod(val->second);
|
||||||
double ret=std::stod(val);
|
|
||||||
return ret;
|
return ret;
|
||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
} catch (std::invalid_argument& e) {
|
} catch (std::invalid_argument& e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
String DivConfig::getString(String key, String fallback) const {
|
String DivConfig::getString(String key, String fallback) const {
|
||||||
try {
|
auto val=conf.find(key);
|
||||||
String val=conf.at(key);
|
if (val!=conf.cend()) {
|
||||||
return val;
|
return val->second;
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
@ -294,10 +298,10 @@ String DivConfig::getString(String key, String fallback) const {
|
||||||
std::vector<int> DivConfig::getIntList(String key, std::initializer_list<int> fallback) const {
|
std::vector<int> DivConfig::getIntList(String key, std::initializer_list<int> fallback) const {
|
||||||
String next;
|
String next;
|
||||||
std::vector<int> ret;
|
std::vector<int> ret;
|
||||||
|
auto val=conf.find(key);
|
||||||
|
if (val!=conf.cend()) {
|
||||||
try {
|
try {
|
||||||
String val=conf.at(key);
|
for (char i: val->second) {
|
||||||
|
|
||||||
for (char i: val) {
|
|
||||||
if (i==',') {
|
if (i==',') {
|
||||||
int num=std::stoi(next);
|
int num=std::stoi(next);
|
||||||
ret.push_back(num);
|
ret.push_back(num);
|
||||||
|
|
@ -315,16 +319,13 @@ std::vector<int> DivConfig::getIntList(String key, std::initializer_list<int> fa
|
||||||
} catch (std::out_of_range& e) {
|
} catch (std::out_of_range& e) {
|
||||||
} catch (std::invalid_argument& e) {
|
} catch (std::invalid_argument& e) {
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return fallback;
|
return fallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DivConfig::has(String key) const {
|
bool DivConfig::has(String key) const {
|
||||||
try {
|
auto val=conf.find(key);
|
||||||
String test=conf.at(key);
|
return (val!=conf.cend());
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DivConfig::set(String key, bool value) {
|
void DivConfig::set(String key, bool value) {
|
||||||
|
|
|
||||||
169
src/gui/gui.cpp
169
src/gui/gui.cpp
|
|
@ -610,10 +610,11 @@ void FurnaceGUI::autoDetectSystem() {
|
||||||
std::map<DivSystem,int> sysCountMap;
|
std::map<DivSystem,int> sysCountMap;
|
||||||
std::map<DivSystem,DivConfig> sysConfMap;
|
std::map<DivSystem,DivConfig> sysConfMap;
|
||||||
for (int i=0; i<e->song.systemLen; i++) {
|
for (int i=0; i<e->song.systemLen; i++) {
|
||||||
try {
|
auto it=sysCountMap.find(e->song.system[i]);
|
||||||
sysCountMap.at(e->song.system[i])++;
|
if (it==sysCountMap.cend()) {
|
||||||
} catch (std::exception& ex) {
|
|
||||||
sysCountMap[e->song.system[i]]=1;
|
sysCountMap[e->song.system[i]]=1;
|
||||||
|
} else {
|
||||||
|
it->second++;
|
||||||
}
|
}
|
||||||
sysConfMap[e->song.system[i]]=e->song.systemFlags[i];
|
sysConfMap[e->song.system[i]]=e->song.systemFlags[i];
|
||||||
}
|
}
|
||||||
|
|
@ -631,10 +632,11 @@ void FurnaceGUI::autoDetectSystem() {
|
||||||
defCountMap.clear();
|
defCountMap.clear();
|
||||||
defConfMap.clear();
|
defConfMap.clear();
|
||||||
for (FurnaceGUISysDefChip& k: j.orig) {
|
for (FurnaceGUISysDefChip& k: j.orig) {
|
||||||
try {
|
auto it=defCountMap.find(k.sys);
|
||||||
defCountMap.at(k.sys)++;
|
if (it==defCountMap.cend()) {
|
||||||
} catch (std::exception& ex) {
|
|
||||||
defCountMap[k.sys]=1;
|
defCountMap[k.sys]=1;
|
||||||
|
} else {
|
||||||
|
it->second++;
|
||||||
}
|
}
|
||||||
DivConfig dc;
|
DivConfig dc;
|
||||||
dc.loadFromMemory(k.flags);
|
dc.loadFromMemory(k.flags);
|
||||||
|
|
@ -647,13 +649,27 @@ void FurnaceGUI::autoDetectSystem() {
|
||||||
logV("- %s: %d",e->getSystemName(k.first),k.second);
|
logV("- %s: %d",e->getSystemName(k.first),k.second);
|
||||||
}*/
|
}*/
|
||||||
for (std::pair<DivSystem,int> k: defCountMap) {
|
for (std::pair<DivSystem,int> k: defCountMap) {
|
||||||
try {
|
auto countI=sysCountMap.find(k.first);
|
||||||
if (sysCountMap.at(k.first)!=k.second) {
|
if (countI==sysCountMap.cend()) {
|
||||||
|
isMatch=false;
|
||||||
|
break;
|
||||||
|
} else if (countI->second!=k.second) {
|
||||||
isMatch=false;
|
isMatch=false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
DivConfig& sysDC=sysConfMap.at(k.first);
|
|
||||||
for (std::pair<String,String> l: defConfMap.at(k.first).configMap()) {
|
auto confI=sysConfMap.find(k.first);
|
||||||
|
if (confI==sysConfMap.cend()) {
|
||||||
|
isMatch=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
DivConfig& sysDC=confI->second;
|
||||||
|
auto defConfI=defConfMap.find(k.first);
|
||||||
|
if (defConfI==defConfMap.cend()) {
|
||||||
|
isMatch=false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
for (std::pair<String,String> l: defConfI->second.configMap()) {
|
||||||
if (!sysDC.has(l.first)) {
|
if (!sysDC.has(l.first)) {
|
||||||
isMatch=false;
|
isMatch=false;
|
||||||
break;
|
break;
|
||||||
|
|
@ -664,10 +680,6 @@ void FurnaceGUI::autoDetectSystem() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!isMatch) break;
|
if (!isMatch) break;
|
||||||
} catch (std::exception& ex) {
|
|
||||||
isMatch=false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isMatch) {
|
if (isMatch) {
|
||||||
logV("match found!");
|
logV("match found!");
|
||||||
|
|
@ -1097,8 +1109,9 @@ void FurnaceGUI::previewNote(int refChan, int note, bool autoNote) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
|
void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
|
||||||
try {
|
auto it=noteKeys.find(scancode);
|
||||||
int key=noteKeys.at(scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
if (num<-60) num=-60; // C-(-5)
|
if (num<-60) num=-60; // C-(-5)
|
||||||
if (num>119) num=119; // B-9
|
if (num>119) num=119; // B-9
|
||||||
|
|
@ -1110,7 +1123,6 @@ void FurnaceGUI::stopPreviewNote(SDL_Scancode scancode, bool autoNote) {
|
||||||
e->synchronized([this,num]() {
|
e->synchronized([this,num]() {
|
||||||
e->autoNoteOff(-1,num);
|
e->autoNoteOff(-1,num);
|
||||||
});
|
});
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1310,8 +1322,9 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
try {
|
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||||
int num=valueKeys.at(ev.key.keysym.sym);
|
if (it!=valueKeys.cend()) {
|
||||||
|
int num=it->second;
|
||||||
switch (latchTarget) {
|
switch (latchTarget) {
|
||||||
case 1: // instrument
|
case 1: // instrument
|
||||||
changeLatch(latchIns);
|
changeLatch(latchIns);
|
||||||
|
|
@ -1326,7 +1339,6 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
changeLatch(latchEffectVal);
|
changeLatch(latchEffectVal);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
@ -1339,8 +1351,9 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
alterSampleMap(true,-1);
|
alterSampleMap(true,-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
auto it=noteKeys.find(ev.key.keysym.scancode);
|
||||||
int key=noteKeys.at(ev.key.keysym.scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
|
|
||||||
if (num<-60) num=-60; // C-(-5)
|
if (num<-60) num=-60; // C-(-5)
|
||||||
|
|
@ -1348,7 +1361,6 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
|
|
||||||
alterSampleMap(true,num);
|
alterSampleMap(true,num);
|
||||||
return;
|
return;
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// TODO: map?
|
// TODO: map?
|
||||||
|
|
@ -1356,34 +1368,35 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
alterSampleMap(false,-1);
|
alterSampleMap(false,-1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
try {
|
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||||
int num=valueKeys.at(ev.key.keysym.sym);
|
if (it!=valueKeys.cend()) {
|
||||||
|
int num=it->second;
|
||||||
if (num<10) {
|
if (num<10) {
|
||||||
alterSampleMap(false,num);
|
alterSampleMap(false,num);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// PER-WINDOW KEYS
|
// PER-WINDOW KEYS
|
||||||
switch (curWindow) {
|
switch (curWindow) {
|
||||||
case GUI_WINDOW_PATTERN:
|
case GUI_WINDOW_PATTERN: {
|
||||||
try {
|
auto actionI=actionMapPat.find(mapped);
|
||||||
int action=actionMapPat.at(mapped);
|
if (actionI!=actionMapPat.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
// pattern input otherwise
|
// pattern input otherwise
|
||||||
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
||||||
if (!ev.key.repeat) {
|
if (!ev.key.repeat) {
|
||||||
if (cursor.xFine==0) { // note
|
if (cursor.xFine==0) { // note
|
||||||
try {
|
auto it=noteKeys.find(ev.key.keysym.scancode);
|
||||||
int key=noteKeys.at(ev.key.keysym.scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
|
|
||||||
if (num<-60) num=-60; // C-(-5)
|
if (num<-60) num=-60; // C-(-5)
|
||||||
|
|
@ -1392,31 +1405,32 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
if (edit) {
|
if (edit) {
|
||||||
noteInput(num,key);
|
noteInput(num,key);
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
} else if (edit) { // value
|
} else if (edit) { // value
|
||||||
try {
|
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||||
int num=valueKeys.at(ev.key.keysym.sym);
|
if (it!=valueKeys.cend()) {
|
||||||
|
int num=it->second;
|
||||||
valueInput(num);
|
valueInput(num);
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_ORDERS:
|
}
|
||||||
try {
|
case GUI_WINDOW_ORDERS: {
|
||||||
int action=actionMapOrders.at(mapped);
|
auto actionI=actionMapOrders.find(mapped);
|
||||||
|
if (actionI!=actionMapOrders.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
// order input otherwise
|
// order input otherwise
|
||||||
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
if (mapped&(FURKMOD_ALT|FURKMOD_CTRL|FURKMOD_META|FURKMOD_SHIFT)) break;
|
||||||
if (orderEditMode!=0) {
|
if (orderEditMode!=0) {
|
||||||
try {
|
auto it=valueKeys.find(ev.key.keysym.sym);
|
||||||
int num=valueKeys.at(ev.key.keysym.sym);
|
if (it!=valueKeys.cend()) {
|
||||||
|
int num=it->second;
|
||||||
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
|
if (orderCursor>=0 && orderCursor<e->getTotalChannelCount()) {
|
||||||
prepareUndo(GUI_UNDO_CHANGE_ORDER);
|
prepareUndo(GUI_UNDO_CHANGE_ORDER);
|
||||||
e->lockSave([this,num]() {
|
e->lockSave([this,num]() {
|
||||||
|
|
@ -1440,62 +1454,66 @@ void FurnaceGUI::keyDown(SDL_Event& ev) {
|
||||||
e->walkSong(loopOrder,loopRow,loopEnd);
|
e->walkSong(loopOrder,loopRow,loopEnd);
|
||||||
makeUndo(GUI_UNDO_CHANGE_ORDER);
|
makeUndo(GUI_UNDO_CHANGE_ORDER);
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_SAMPLE_EDIT:
|
}
|
||||||
try {
|
case GUI_WINDOW_SAMPLE_EDIT: {
|
||||||
int action=actionMapSample.at(mapped);
|
auto actionI=actionMapSample.find(mapped);
|
||||||
|
if (actionI!=actionMapSample.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_INS_LIST:
|
}
|
||||||
try {
|
case GUI_WINDOW_INS_LIST: {
|
||||||
int action=actionMapInsList.at(mapped);
|
auto actionI=actionMapInsList.find(mapped);
|
||||||
|
if (actionI!=actionMapInsList.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_WAVE_LIST:
|
}
|
||||||
try {
|
case GUI_WINDOW_WAVE_LIST: {
|
||||||
int action=actionMapWaveList.at(mapped);
|
auto actionI=actionMapWaveList.find(mapped);
|
||||||
|
if (actionI!=actionMapWaveList.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_SAMPLE_LIST:
|
}
|
||||||
try {
|
case GUI_WINDOW_SAMPLE_LIST: {
|
||||||
int action=actionMapSampleList.at(mapped);
|
auto actionI=actionMapSampleList.find(mapped);
|
||||||
|
if (actionI!=actionMapSampleList.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// GLOBAL KEYS
|
// GLOBAL KEYS
|
||||||
try {
|
auto actionI=actionMapGlobal.find(mapped);
|
||||||
int action=actionMapGlobal.at(mapped);
|
if (actionI!=actionMapGlobal.cend()) {
|
||||||
|
int action=actionI->second;
|
||||||
if (action>0) {
|
if (action>0) {
|
||||||
doAction(action);
|
doAction(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2981,9 +2999,10 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
if (settings.notePreviewBehavior==0) return 1;
|
if (settings.notePreviewBehavior==0) return 1;
|
||||||
switch (curWindow) {
|
switch (curWindow) {
|
||||||
case GUI_WINDOW_SAMPLE_EDIT:
|
case GUI_WINDOW_SAMPLE_EDIT:
|
||||||
case GUI_WINDOW_SAMPLE_LIST:
|
case GUI_WINDOW_SAMPLE_LIST: {
|
||||||
try {
|
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
if (key!=100 && key!=101 && key!=102) {
|
if (key!=100 && key!=101 && key!=102) {
|
||||||
int pStart=-1;
|
int pStart=-1;
|
||||||
|
|
@ -3004,13 +3023,14 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
samplePreviewKey=ev->key.keysym.scancode;
|
samplePreviewKey=ev->key.keysym.scancode;
|
||||||
samplePreviewNote=num;
|
samplePreviewNote=num;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case GUI_WINDOW_WAVE_LIST:
|
case GUI_WINDOW_WAVE_LIST:
|
||||||
case GUI_WINDOW_WAVE_EDIT:
|
case GUI_WINDOW_WAVE_EDIT: {
|
||||||
try {
|
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
if (key!=100 && key!=101 && key!=102) {
|
if (key!=100 && key!=101 && key!=102) {
|
||||||
e->previewWave(curWave,num);
|
e->previewWave(curWave,num);
|
||||||
|
|
@ -3018,9 +3038,9 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
wavePreviewKey=ev->key.keysym.scancode;
|
wavePreviewKey=ev->key.keysym.scancode;
|
||||||
wavePreviewNote=num;
|
wavePreviewNote=num;
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case GUI_WINDOW_ORDERS: // ignore here
|
case GUI_WINDOW_ORDERS: // ignore here
|
||||||
break;
|
break;
|
||||||
case GUI_WINDOW_PATTERN:
|
case GUI_WINDOW_PATTERN:
|
||||||
|
|
@ -3030,9 +3050,10 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
if (edit && cursor.xFine!=0) break;
|
if (edit && cursor.xFine!=0) break;
|
||||||
}
|
}
|
||||||
// fall-through
|
// fall-through
|
||||||
default:
|
default: {
|
||||||
try {
|
auto it=noteKeys.find(ev->key.keysym.scancode);
|
||||||
int key=noteKeys.at(ev->key.keysym.scancode);
|
if (it!=noteKeys.cend()) {
|
||||||
|
int key=it->second;
|
||||||
int num=12*curOctave+key;
|
int num=12*curOctave+key;
|
||||||
|
|
||||||
if (num<-60) num=-60; // C-(-5)
|
if (num<-60) num=-60; // C-(-5)
|
||||||
|
|
@ -3041,11 +3062,11 @@ int FurnaceGUI::processEvent(SDL_Event* ev) {
|
||||||
if (key!=100 && key!=101 && key!=102) {
|
if (key!=100 && key!=101 && key!=102) {
|
||||||
previewNote(cursor.xCoarse,num);
|
previewNote(cursor.xCoarse,num);
|
||||||
}
|
}
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else if (ev->type==SDL_KEYUP) {
|
} else if (ev->type==SDL_KEYUP) {
|
||||||
stopPreviewNote(ev->key.keysym.scancode,true);
|
stopPreviewNote(ev->key.keysym.scancode,true);
|
||||||
if (wavePreviewOn) {
|
if (wavePreviewOn) {
|
||||||
|
|
|
||||||
|
|
@ -337,9 +337,11 @@ void FurnaceGUI::drawMixer() {
|
||||||
if (selectedSubPort>=0) {
|
if (selectedSubPort>=0) {
|
||||||
portDragActive=true;
|
portDragActive=true;
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
try {
|
|
||||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||||
} catch (std::out_of_range& e) {
|
if (subPortI!=portPos.cend()) {
|
||||||
|
subPortPos=subPortI->second;
|
||||||
|
} else {
|
||||||
portDragActive=false;
|
portDragActive=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -353,9 +355,10 @@ void FurnaceGUI::drawMixer() {
|
||||||
if (selectedSubPort>=0) {
|
if (selectedSubPort>=0) {
|
||||||
portDragActive=true;
|
portDragActive=true;
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
try {
|
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
if (subPortI!=portPos.cend()) {
|
||||||
} catch (std::out_of_range& e) {
|
subPortPos=subPortI->second;
|
||||||
|
} else {
|
||||||
portDragActive=false;
|
portDragActive=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -365,9 +368,10 @@ void FurnaceGUI::drawMixer() {
|
||||||
if (selectedSubPort>=0) {
|
if (selectedSubPort>=0) {
|
||||||
portDragActive=true;
|
portDragActive=true;
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
try {
|
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
if (subPortI!=portPos.cend()) {
|
||||||
} catch (std::out_of_range& e) {
|
subPortPos=subPortI->second;
|
||||||
|
} else {
|
||||||
portDragActive=false;
|
portDragActive=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -380,9 +384,10 @@ void FurnaceGUI::drawMixer() {
|
||||||
if (selectedSubPort>=0) {
|
if (selectedSubPort>=0) {
|
||||||
portDragActive=true;
|
portDragActive=true;
|
||||||
ImGui::InhibitInertialScroll();
|
ImGui::InhibitInertialScroll();
|
||||||
try {
|
auto subPortI=portPos.find((selectedPortSet<<4)|selectedSubPort);
|
||||||
subPortPos=portPos.at((selectedPortSet<<4)|selectedSubPort);
|
if (subPortI!=portPos.cend()) {
|
||||||
} catch (std::out_of_range& e) {
|
subPortPos=subPortI->second;
|
||||||
|
} else {
|
||||||
portDragActive=false;
|
portDragActive=false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -415,22 +420,24 @@ void FurnaceGUI::drawMixer() {
|
||||||
// draw connections
|
// draw connections
|
||||||
for (unsigned int i: e->song.patchbay) {
|
for (unsigned int i: e->song.patchbay) {
|
||||||
if ((i>>20)==selectedPortSet) continue;
|
if ((i>>20)==selectedPortSet) continue;
|
||||||
try {
|
auto portSrcI=portPos.find(i>>16);
|
||||||
ImVec2 portSrc=portPos.at(i>>16);
|
auto portDestI=portPos.find(0x10000|(i&0xffff));
|
||||||
ImVec2 portDest=portPos.at(0x10000|(i&0xffff));
|
if (portSrcI!=portPos.cend() && portDestI!=portPos.cend()) {
|
||||||
|
ImVec2 portSrc=portSrcI->second;
|
||||||
|
ImVec2 portDest=portDestI->second;
|
||||||
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION_BG]),2.0f*dpiScale);
|
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION_BG]),2.0f*dpiScale);
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// foreground
|
// foreground
|
||||||
for (unsigned int i: e->song.patchbay) {
|
for (unsigned int i: e->song.patchbay) {
|
||||||
if ((i>>20)!=selectedPortSet) continue;
|
if ((i>>20)!=selectedPortSet) continue;
|
||||||
try {
|
auto portSrcI=portPos.find(i>>16);
|
||||||
ImVec2 portSrc=portPos.at(i>>16);
|
auto portDestI=portPos.find(0x10000|(i&0xffff));
|
||||||
ImVec2 portDest=portPos.at(0x10000|(i&0xffff));
|
if (portSrcI!=portPos.cend() && portDestI!=portPos.cend()) {
|
||||||
|
ImVec2 portSrc=portSrcI->second;
|
||||||
|
ImVec2 portDest=portDestI->second;
|
||||||
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale);
|
dl->AddLine(portSrc,portDest,ImGui::GetColorU32(uiColors[GUI_COLOR_PATCHBAY_CONNECTION]),2.0f*dpiScale);
|
||||||
} catch (std::out_of_range& e) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue