Skip to content

Commit

Permalink
Fixed limits for PGM numbers of the Cx Program Change Range midi event
Browse files Browse the repository at this point in the history
…GrandOrgue#1058 (GrandOrgue#1071)

Co-authored-by: Oleg Samarin <osamarin@openwaygroup.com>
  • Loading branch information
oleg68 and Oleg Samarin authored Mar 6, 2022
1 parent cda96b5 commit f564095
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
- Fixed limits for PGM numbers of the Cx Program Change Range midi event https://github.com/GrandOrgue/grandorgue/issues/1058
- Clarified the guide how to obtain submodule sources manually in the BUILD.md https://github.com/GrandOrgue/grandorgue/issues/1062
# 3.6.3 (2022-03-02)
- Added the wave file name to an error message related to a certain sample file https://github.com/GrandOrgue/grandorgue/discussions/1055
Expand Down
23 changes: 13 additions & 10 deletions src/grandorgue/midi/GOMidiSender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,48 +61,51 @@ void GOMidiSender::Load(GOConfigReader &cfg, wxString group, GOMidiMap &map) {
group,
wxString::Format(wxT("MIDISendDevice%03d"), i + 1),
false));
m_events[i].type = (GOMidiSendMessageType)cfg.ReadEnum(

const GOMidiSendMessageType eventType = (GOMidiSendMessageType)cfg.ReadEnum(
CMBSetting,
group,
wxString::Format(wxT("MIDISendEventType%03d"), i + 1),
m_MidiTypes,
sizeof(m_MidiTypes) / sizeof(m_MidiTypes[0]));
if (HasChannel(m_events[i].type))

m_events[i].type = eventType;
if (HasChannel(eventType))
m_events[i].channel = cfg.ReadInteger(
CMBSetting,
group,
wxString::Format(wxT("MIDISendChannel%03d"), i + 1),
1,
16);
if (HasKey(m_events[i].type))
if (HasKey(eventType))
m_events[i].key = cfg.ReadInteger(
CMBSetting,
group,
wxString::Format(wxT("MIDISendKey%03d"), i + 1),
0,
0x200000);

if (HasLowValue(m_events[i].type))
if (HasLowValue(eventType))
m_events[i].low_value = cfg.ReadInteger(
CMBSetting,
group,
wxString::Format(wxT("MIDISendLowValue%03d"), i + 1),
0,
0x3fff,
LowValueLimit(eventType),
false,
0);

if (HasHighValue(m_events[i].type))
if (HasHighValue(eventType))
m_events[i].high_value = cfg.ReadInteger(
CMBSetting,
group,
wxString::Format(wxT("MIDISendHighValue%03d"), i + 1),
0,
0x3fff,
HighValueLimit(eventType),
false,
0x7f);

if (HasStart(m_events[i].type))
if (HasStart(eventType))
m_events[i].start = cfg.ReadInteger(
CMBSetting,
group,
Expand All @@ -111,15 +114,15 @@ void GOMidiSender::Load(GOConfigReader &cfg, wxString group, GOMidiMap &map) {
0x1f,
false,
0);
if (HasLength(m_events[i].type))
if (HasLength(eventType))
m_events[i].length = cfg.ReadInteger(
CMBSetting,
group,
wxString::Format(wxT("MIDISendLength%03d"), i + 1),
0,
0x1f,
false,
LengthLimit(m_events[i].type));
LengthLimit(eventType));
}
}

Expand Down

0 comments on commit f564095

Please sign in to comment.