mirror of
https://github.com/tildearrow/furnace.git
synced 2024-11-23 13:05:11 +00:00
GUI: make it possible to wheel on the note combo
like OpenMPT
This commit is contained in:
parent
2da7002fc8
commit
ecf24b39fe
1 changed files with 32 additions and 14 deletions
|
@ -270,13 +270,15 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
sampleNoteFine=63;
|
sampleNoteFine=63;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool coarseChanged=false;
|
||||||
|
|
||||||
ImGui::TableNextColumn();
|
ImGui::TableNextColumn();
|
||||||
ImGui::Text("Hz");
|
ImGui::Text("Hz");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
ImGui::SetNextItemWidth(ImGui::GetContentRegionAvail().x);
|
||||||
if (ImGui::InputInt("##SampleRate",&targetRate,10,200)) { MARK_MODIFIED
|
if (ImGui::InputInt("##SampleRate",&targetRate,10,200)) { MARK_MODIFIED
|
||||||
if (targetRate<100) targetRate=100;
|
if (targetRate<100) targetRate=100;
|
||||||
if (targetRate>192000) targetRate=192000;
|
if (targetRate>384000) targetRate=384000;
|
||||||
|
|
||||||
if (sampleCompatRate) {
|
if (sampleCompatRate) {
|
||||||
sample->rate=targetRate;
|
sample->rate=targetRate;
|
||||||
|
@ -294,12 +296,31 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
snprintf(temp,1023,"%s##_SRN%d",noteNames[i+60],i);
|
snprintf(temp,1023,"%s##_SRN%d",noteNames[i+60],i);
|
||||||
if (ImGui::Selectable(temp,i==sampleNoteCoarse)) {
|
if (ImGui::Selectable(temp,i==sampleNoteCoarse)) {
|
||||||
sampleNoteCoarse=i;
|
sampleNoteCoarse=i;
|
||||||
|
coarseChanged=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
ImGui::EndCombo();
|
||||||
|
} else if (ImGui::IsItemHovered()) {
|
||||||
|
if (wheelY!=0) {
|
||||||
|
sampleNoteCoarse-=wheelY;
|
||||||
|
if (sampleNoteCoarse<0) {
|
||||||
|
sampleNoteCoarse=0;
|
||||||
|
sampleNoteFine=-64;
|
||||||
|
}
|
||||||
|
if (sampleNoteCoarse>119) {
|
||||||
|
sampleNoteCoarse=119;
|
||||||
|
sampleNoteFine=63;
|
||||||
|
}
|
||||||
|
coarseChanged=true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (coarseChanged) { MARK_MODIFIED
|
||||||
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
sampleNote=((sampleNoteCoarse-60)<<7)+sampleNoteFine;
|
||||||
|
|
||||||
targetRate=8363.0*pow(2.0,(double)sampleNote/(128.0*12.0));
|
targetRate=8363.0*pow(2.0,(double)sampleNote/(128.0*12.0));
|
||||||
if (targetRate<100) targetRate=100;
|
if (targetRate<100) targetRate=100;
|
||||||
if (targetRate>192000) targetRate=192000;
|
if (targetRate>384000) targetRate=384000;
|
||||||
|
|
||||||
if (sampleCompatRate) {
|
if (sampleCompatRate) {
|
||||||
sample->rate=targetRate;
|
sample->rate=targetRate;
|
||||||
|
@ -307,9 +328,6 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
sample->centerRate=targetRate;
|
sample->centerRate=targetRate;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
ImGui::EndCombo();
|
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::Text("Fine");
|
ImGui::Text("Fine");
|
||||||
ImGui::SameLine();
|
ImGui::SameLine();
|
||||||
|
@ -335,7 +353,7 @@ void FurnaceGUI::drawSampleEdit() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (targetRate<100) targetRate=100;
|
if (targetRate<100) targetRate=100;
|
||||||
if (targetRate>192000) targetRate=192000;
|
if (targetRate>384000) targetRate=384000;
|
||||||
|
|
||||||
if (sampleCompatRate) {
|
if (sampleCompatRate) {
|
||||||
sample->rate=targetRate;
|
sample->rate=targetRate;
|
||||||
|
|
Loading…
Reference in a new issue