Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: Yoshimi/yoshimi
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: AnClark/yoshimi
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: reform
Choose a head ref

There isn’t anything to compare.

Yoshimi:master and AnClark:reform are entirely different commit histories.

Showing with 46 additions and 0 deletions.
  1. +45 −0 plugin/YoshimiEditor.cpp
  2. +1 −0 plugin/YoshimiEditor.h
45 changes: 45 additions & 0 deletions plugin/YoshimiEditor.cpp
Original file line number Diff line number Diff line change
@@ -46,6 +46,7 @@ YoshimiEditor::YoshimiEditor()
// Read bank list
YoshimiExchange::Bank::getBankEntries(fSynthesizer, fBankEntries);
fBankCurrent = YoshimiExchange::Bank::getCurrentBank(fSynthesizer);
fInstCurrent = YoshimiExchange::Bank::getCurrentInstrument(fSynthesizer);
}

YoshimiEditor::~YoshimiEditor()
@@ -78,6 +79,13 @@ void YoshimiEditor::onImGuiDisplay()
static char aboutText[256] = "This is a demo UI for Yoshimi, based on Dear ImGui.\n";
ImGui::InputTextMultiline("About", aboutText, sizeof(aboutText));

#if 0
if (ImGui::Button("Set Instrument Test")) {
YoshimiExchange::Bank::switchBank(fSynthesizer, 105); // Standalone: 80, VST3: 105
YoshimiExchange::Bank::switchInstrument(fSynthesizer, 33, 0); // Standalone: 33
}
#endif

if (ImGui::SliderFloat("Master Volume", &fParams.pVolume, 0.0f, 127.0f)) {
// NOTICE: Methods from FLTK UI does not take effects. Use CLI-provided one instead.
// YoshimiExchange::MasterUI::send_data(fSynthesizer, 0, MAIN::control::volume, fParams.pVolume, 0, TOPLEVEL::section::main);
@@ -114,6 +122,7 @@ void YoshimiEditor::onImGuiDisplay()

if (ImGui::Selectable(it->second.dirname.c_str(), is_selected)) {
fBankCurrent = it->first;
fInstCurrent = YoshimiExchange::Bank::getCurrentInstrument(fSynthesizer);
YoshimiExchange::Bank::switchBank(fSynthesizer, fBankCurrent);
}

@@ -125,6 +134,42 @@ void YoshimiEditor::onImGuiDisplay()
ImGui::EndCombo();
}

if (ImGui::BeginTable("Instruments", 5)) {
if (fBankEntries.count(fBankCurrent)) {
InstrumentEntryMap& instruments = fBankEntries.at(fBankCurrent).instruments;

int instrument_index = 0;

for (auto it = instruments.begin(); it != instruments.end(); it++) {
const bool is_selected = fInstCurrent == it->first;

if (!it->second.name.empty()) {
char instrument_label[50];
snprintf(instrument_label, 50, "%02d: %s", it->first, it->second.name.c_str());

if (ImGui::Selectable(instrument_label, is_selected)) {
fInstCurrent = it->first;

if (!YoshimiExchange::Bank::fetchData(fSynthesizer, 0, PART::control::enable, 0))
d_stderr("Active part disabled");
else {
// TODO: Specify active part
YoshimiExchange::Bank::switchInstrument(fSynthesizer, fInstCurrent, 0);
}
}
} else {
ImGui::Selectable("##EMPTY", false);
}

if (instrument_index % 31 == 0)
ImGui::TableNextColumn();
instrument_index++;
}
}

ImGui::EndTable();
}

if (ImGui::IsItemDeactivated()) {
_syncStateToHost();
}
1 change: 1 addition & 0 deletions plugin/YoshimiEditor.h
Original file line number Diff line number Diff line change
@@ -44,6 +44,7 @@ class YoshimiEditor : public UI {

BankEntryMap fBankEntries;
long fBankCurrent;
long fInstCurrent;

// ----------------------------------------------------------------------------------------------------------------