Merge branch 'master' of github.com:tildearrow/furnace
This commit is contained in:
commit
6a3d130c51
|
@ -123,16 +123,16 @@ void FurnaceGUI::doAction(int what) {
|
||||||
pendingStepUpdate=1;
|
pendingStepUpdate=1;
|
||||||
break;
|
break;
|
||||||
case GUI_ACTION_OCTAVE_UP:
|
case GUI_ACTION_OCTAVE_UP:
|
||||||
if (++curOctave>7) {
|
if (++curOctave>GUI_EDIT_OCTAVE_MAX) {
|
||||||
curOctave=7;
|
curOctave=GUI_EDIT_OCTAVE_MAX;
|
||||||
} else {
|
} else {
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case GUI_ACTION_OCTAVE_DOWN:
|
case GUI_ACTION_OCTAVE_DOWN:
|
||||||
if (--curOctave<-5) {
|
if (--curOctave<GUI_EDIT_OCTAVE_MIN) {
|
||||||
curOctave=-5;
|
curOctave=GUI_EDIT_OCTAVE_MIN;
|
||||||
} else {
|
} else {
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
|
@ -679,10 +679,26 @@ void FurnaceGUI::doAction(int what) {
|
||||||
case GUI_ACTION_PAT_ABSORB_INSTRUMENT: {
|
case GUI_ACTION_PAT_ABSORB_INSTRUMENT: {
|
||||||
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],false);
|
DivPattern* pat=e->curPat[cursor.xCoarse].getPattern(e->curOrders->ord[cursor.xCoarse][curOrder],false);
|
||||||
if (!pat) break;
|
if (!pat) break;
|
||||||
for (int i=cursor.y; i>=0; i--) {
|
bool foundIns=false;
|
||||||
if (pat->data[i][2] >= 0) {
|
bool foundOctave=false;
|
||||||
|
for (int i=cursor.y; i>=0 && !(foundIns && foundOctave); i--) {
|
||||||
|
// absorb most recent instrument
|
||||||
|
if (!foundIns && pat->data[i][2] >= 0) {
|
||||||
curIns=pat->data[i][2];
|
curIns=pat->data[i][2];
|
||||||
break;
|
foundIns=true;
|
||||||
|
}
|
||||||
|
// absorb most recent octave (i.e. set curOctave such that the "main row" (QWERTY) of notes
|
||||||
|
// will result in an octave number equal to the previous note).
|
||||||
|
if (!foundOctave && pat->data[i][0] != 0) {
|
||||||
|
// decode octave data (was signed cast to unsigned char)
|
||||||
|
int octave=pat->data[i][1];
|
||||||
|
if (octave>128) octave-=256;
|
||||||
|
// @NOTE the special handling when note==12, which is really an octave above what's
|
||||||
|
// stored in the octave data. without this handling, if you press Q, then
|
||||||
|
// "ABSORB_INSTRUMENT", then Q again, you'd get a different octave!
|
||||||
|
if (pat->data[i][0]==12) octave++;
|
||||||
|
curOctave=CLAMP(octave-1, GUI_EDIT_OCTAVE_MIN, GUI_EDIT_OCTAVE_MAX);
|
||||||
|
foundOctave=true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -647,8 +647,8 @@ void FurnaceGUI::drawEditControls() {
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
||||||
if (curOctave>7) curOctave=7;
|
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
|
||||||
if (curOctave<-5) curOctave=-5;
|
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
|
|
||||||
|
@ -808,8 +808,8 @@ void FurnaceGUI::drawEditControls() {
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(96.0f*dpiScale);
|
ImGui::SetNextItemWidth(96.0f*dpiScale);
|
||||||
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
||||||
if (curOctave>7) curOctave=7;
|
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
|
||||||
if (curOctave<-5) curOctave=-5;
|
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
|
|
||||||
|
@ -926,8 +926,8 @@ void FurnaceGUI::drawEditControls() {
|
||||||
float avail=ImGui::GetContentRegionAvail().x;
|
float avail=ImGui::GetContentRegionAvail().x;
|
||||||
ImGui::SetNextItemWidth(avail);
|
ImGui::SetNextItemWidth(avail);
|
||||||
if (ImGui::InputInt("##Octave",&curOctave,0,0)) {
|
if (ImGui::InputInt("##Octave",&curOctave,0,0)) {
|
||||||
if (curOctave>7) curOctave=7;
|
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
|
||||||
if (curOctave<-5) curOctave=-5;
|
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
|
|
||||||
|
@ -1093,8 +1093,8 @@ void FurnaceGUI::drawEditControls() {
|
||||||
float avail=ImGui::GetContentRegionAvail().x;
|
float avail=ImGui::GetContentRegionAvail().x;
|
||||||
ImGui::SetNextItemWidth(avail);
|
ImGui::SetNextItemWidth(avail);
|
||||||
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
if (ImGui::InputInt("##Octave",&curOctave,1,1)) {
|
||||||
if (curOctave>7) curOctave=7;
|
if (curOctave>GUI_EDIT_OCTAVE_MAX) curOctave=GUI_EDIT_OCTAVE_MAX;
|
||||||
if (curOctave<-5) curOctave=-5;
|
if (curOctave<GUI_EDIT_OCTAVE_MIN) curOctave=GUI_EDIT_OCTAVE_MIN;
|
||||||
e->autoNoteOffAll();
|
e->autoNoteOffAll();
|
||||||
failedNoteOn=false;
|
failedNoteOn=false;
|
||||||
|
|
||||||
|
|
|
@ -137,6 +137,9 @@ enum FurnaceGUIRenderBackend {
|
||||||
#define ngettext momo_ngettext
|
#define ngettext momo_ngettext
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define GUI_EDIT_OCTAVE_MIN -5
|
||||||
|
#define GUI_EDIT_OCTAVE_MAX 7
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
// - add colors for FM envelope and waveform
|
// - add colors for FM envelope and waveform
|
||||||
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
|
// - maybe add "alternate" color for FM modulators/carriers (a bit difficult)
|
||||||
|
|
|
@ -687,7 +687,7 @@ const FurnaceGUIActionDef guiActions[GUI_ACTION_MAX]={
|
||||||
D("PAT_LATCH", _N("Set note input latch"), 0),
|
D("PAT_LATCH", _N("Set note input latch"), 0),
|
||||||
D("PAT_SCROLL_MODE", _N("Change mobile scroll mode"), 0),
|
D("PAT_SCROLL_MODE", _N("Change mobile scroll mode"), 0),
|
||||||
D("PAT_CLEAR_LATCH", _N("Clear note input latch"), 0),
|
D("PAT_CLEAR_LATCH", _N("Clear note input latch"), 0),
|
||||||
D("PAT_ABSORB_INSTRUMENT", _N("Set current instrument to channel's current instrument column"), 0),
|
D("PAT_ABSORB_INSTRUMENT", _N("Absorb instrument/octave from status at cursor"), 0),
|
||||||
D("PAT_MAX", "", NOT_AN_ACTION),
|
D("PAT_MAX", "", NOT_AN_ACTION),
|
||||||
|
|
||||||
D("INS_LIST_MIN", _N("---Instrument list"), NOT_AN_ACTION),
|
D("INS_LIST_MIN", _N("---Instrument list"), NOT_AN_ACTION),
|
||||||
|
|
Loading…
Reference in a new issue