Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fixed controlling organ elements when recording or playing MIDI https://github.com/GrandOrgue/grandorgue/issues/2388
- Fixed listening a SYSEX Johanus event in the MIDI event editor https://github.com/GrandOrgue/grandorgue/issues/2114
# 3.17.0 (2026-02-09)
- Added capability of entering a setter combination number with the new "N" MIDI button https://github.com/GrandOrgue/grandorgue/issues/1237
Expand Down
13 changes: 7 additions & 6 deletions src/grandorgue/midi/GOMidiMap.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* Copyright 2009-2026 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
Expand All @@ -17,7 +17,7 @@
class GOMidiMap {
private:
GONameMap m_DeviceMap;
GONameMap m_ElementMap;
GONameMap m_RecorderElementMap;

static uint_fast16_t getIdByName(const GONameMap &map, const wxString &name) {
return map.GetIdByName(name.utf8_str().data());
Expand Down Expand Up @@ -56,12 +56,13 @@ class GOMidiMap {
return getNameById(m_DeviceMap, id);
}

uint_fast16_t GetElementByString(const wxString &str) {
return getIdByName(m_ElementMap, str);
// Recoder element ids start with 0
uint_fast16_t EnsureRecorderElementName(const wxString &str) {
return ensureName(m_RecorderElementMap, str) - 1;
}

wxString GetElementByID(uint_fast16_t id) const {
return getNameById(m_ElementMap, id);
wxString GetRecorderElementNameById(uint_fast16_t id) const {
return getNameById(m_RecorderElementMap, id + 1);
}
};

Expand Down
4 changes: 2 additions & 2 deletions src/grandorgue/midi/GOMidiPlayerContent.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* Copyright 2009-2026 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
Expand Down Expand Up @@ -51,7 +51,7 @@ void GOMidiPlayerContent::SetupManual(
e.SetTime(0);

e.SetMidiType(GOMidiEvent::MIDI_SYSEX_GO_SETUP);
e.SetKey(map.GetElementByString(ID));
e.SetKey(map.EnsureRecorderElementName(ID));
e.SetChannel(channel);
e.SetValue(0);
m_Events.push_back(e);
Expand Down
4 changes: 2 additions & 2 deletions src/grandorgue/midi/GOMidiRecorder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,8 @@ void GOMidiRecorder::PreconfigureMapping(const wxString &element, bool isNRPN) {

void GOMidiRecorder::PreconfigureMapping(
const wxString &element, bool isNRPN, const wxString &reference) {
unsigned id = m_Map.GetElementByString(element);
unsigned ref = m_Map.GetElementByString(reference);
unsigned id = m_Map.EnsureRecorderElementName(element);
unsigned ref = m_Map.EnsureRecorderElementName(reference);
for (unsigned i = 0; i < m_Preconfig.size(); i++)
if (m_Preconfig[i].elementID == ref) {
GOMidiEvent e1;
Expand Down
8 changes: 4 additions & 4 deletions src/grandorgue/midi/events/GOMidiEvent.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* Copyright 2009-2026 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
Expand Down Expand Up @@ -150,7 +150,7 @@ void GOMidiEvent::FromMidi(
SetChannel((msg[4] & 0x0F) + 1);
SetValue(((msg[5] & 0x7F) << 7) | (msg[6] & 0x7F));
wxString s = wxString::FromAscii(b);
SetKey(map.GetElementByString(s));
SetKey(map.EnsureRecorderElementName(s));
SetMidiType(MIDI_SYSEX_GO_SETUP);
break;
}
Expand Down Expand Up @@ -317,7 +317,7 @@ void GOMidiEvent::ToMidi(
return;

case MIDI_SYSEX_GO_SETUP: {
const wxString &s = map.GetElementByID(GetKey());
const wxString &s = map.GetRecorderElementNameById(GetKey());
wxCharBuffer b = s.ToAscii();
unsigned len = s.length();
m.resize(len + 8);
Expand Down Expand Up @@ -478,7 +478,7 @@ wxString GOMidiEvent::ToString(GOMidiMap &map) const {
_("sysex GrandOrgue setup channel: %d NRPN: %d: name: %s"),
GetChannel(),
GetValue(),
map.GetElementByID(GetKey()).c_str());
map.GetRecorderElementNameById(GetKey()).c_str());

case MIDI_SYSEX_HW_STRING:
return wxString::Format(
Expand Down
4 changes: 2 additions & 2 deletions src/grandorgue/model/GOOrganModel.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright 2006 Milan Digital Audio LLC
* Copyright 2009-2025 GrandOrgue contributors (see AUTHORS)
* Copyright 2009-2026 GrandOrgue contributors (see AUTHORS)
* License GPL-2.0 or later
* (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html).
*/
Expand Down Expand Up @@ -57,7 +57,7 @@ GOOrganModel::GOOrganModel(GOConfig &config)
GOOrganModel::~GOOrganModel() {}

unsigned GOOrganModel::GetRecorderElementID(const wxString &name) {
return m_config.GetMidiMap().GetElementByString(name);
return m_config.GetMidiMap().EnsureRecorderElementName(name);
}

static const wxString WX_ORGAN = wxT("Organ");
Expand Down