diff --git a/ide-projects/NetBeans12/nbproject/configurations.xml b/ide-projects/NetBeans12/nbproject/configurations.xml index ee2b05462..6494934fd 100644 --- a/ide-projects/NetBeans12/nbproject/configurations.xml +++ b/ide-projects/NetBeans12/nbproject/configurations.xml @@ -540,6 +540,10 @@ GOMidiObject.cpp + GOMidiObjectWithDivision.cpp + GOMidiObjectWithShortcut.cpp + GOMidiReceivingSendingObject.cpp + GOMidiSendingObject.cpp GOMidiInPort.cpp @@ -800,6 +804,7 @@ commonFlags="-mtune=generic -march=x86-64 -std=gnu++17 -fPIC"/> + @@ -27223,46 +27228,39 @@ - + - /usr/include/wx-3.0/wx - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits + ../../build/current/src/core/go_defs.h ../../src/core - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/contrib - ../../src/core/archive - ../../src/core/config - ../../../../../../runner/build/linux/src/core + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/core + + GrandOrgueCore_EXPORTS + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + __WXGTK__ + - + - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext + ../../build/current/src/core/go_defs.h ../../src/core - /usr/include/x86_64-linux-gnu/bits - /usr/include/wx-3.0/wx - /usr/include/c++/9 - ../../src/core/archive - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/config - /usr/include/c++/9/pstl - ../../../../../../runner/build/linux/src/core + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/core + + GrandOrgueCore_EXPORTS + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + __WXGTK__ + @@ -27440,26 +27438,21 @@ ex="false" tool="1" flavor2="11"> - + - /usr/include/wx-3.0/wx - /usr/include/c++/9/bits - /usr/include/x86_64-linux-gnu/bits - /usr/include/c++/9/ext - ../../src/core/archive + ../../build/current/src/core/go_defs.h ../../src/core - /usr/include/c++/9 - ../../src/core/files - ../../src/core/config - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/c++/9/pstl - ../../src/core/threading - ../../../../../../runner/build/linux/src/core + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/core + + GrandOrgueCore_EXPORTS + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + __WXGTK__ + - + - /usr/include/wx-3.0/wx - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/core/archive - /usr/include/c++/9 + ../../build/current/src/core/go_defs.h ../../src/core - ../../src/core/config - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/files - /usr/include/c++/9/pstl - ../../src/core/threading - ../../../../../../runner/build/linux/src/core + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/core + + GrandOrgueCore_EXPORTS + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + __WXGTK__ + - + - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/core/config - /usr/include/wx-3.0/wx - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types + ../../build/current/src/core/go_defs.h ../../src/core - ../../../../../../runner/build/linux/src/core + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/core + + GrandOrgueCore_EXPORTS + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - /usr/include/c++/9/bits - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9 - ../../src/grandorgue - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/config - ../../src/grandorgue/config - /usr/include/c++/9/pstl - ../../src/core/threading - ../../src/grandorgue/updater - ../../src/grandorgue/sound - ../../src/grandorgue/sound/scheduler - ../../src/grandorgue/gui/frames - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - ../../src/grandorgue/config - ../../src/core/settings - /usr/include/wx-3.0/wx - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/core/config + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/c++/9 - ../../src/grandorgue/gui/size - ../../src/grandorgue/gui/dialogs/common - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/midi - ../../src/core/temperaments - /usr/include/c++/9/pstl - ../../src/core/threading - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - - - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs - ../../src/grandorgue/gui/dialogs/common - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core - ../../src/grandorgue/help - ../../src/core/config - ../../src/grandorgue/gui/size - ../../src/grandorgue/config - /usr/include/c++/9/pstl - ../../src/grandorgue/updater - ../../src/grandorgue - ../../../../../../runner/build/linux/src/grandorgue - - - - ../../build/current/src/core/go_defs.h @@ -29266,31 +29214,7 @@ - - - - /usr/include/wx-3.0/wx - /usr/include/c++/9 - ../../src/grandorgue/gui/dialogs - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/bits - /usr/include/c++/9/bits - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/c++/9/ext - /usr/include/wx-3.0/wx/meta - /usr/include/wx-3.0/wx/gtk - /usr/include/wx-3.0/wx/generic - ../../src/grandorgue/gui/wxcontrols - ../../../../../../runner/build/linux/src/grandorgue - - - - @@ -29318,38 +29242,86 @@ - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - /usr/include/wx-3.0/wx/generic - ../../src/grandorgue/gui/dialogs - ../../src/grandorgue/gui/dialogs/common - /usr/include/c++/9/bits - /usr/include/c++/9/ext /usr/include/c++/9 - ../../src/grandorgue/gui/size + ../../src/grandorgue/gui/dialogs + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/include/x86_64-linux-gnu/bits/types /usr/include/x86_64-linux-gnu/bits - ../../src/core + /usr/include/c++/9/bits /usr/include/x86_64-linux-gnu/c++/9/bits /usr/include/c++/9/debug - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types + /usr/include/c++/9/ext /usr/include/wx-3.0/wx/meta - ../../src/grandorgue/help - ../../src/core/config - ../../src/core/midi - ../../src/grandorgue/config - ../../src/core/archive + /usr/include/wx-3.0/wx/gtk + /usr/include/wx-3.0/wx/generic ../../src/grandorgue/gui/wxcontrols ../../../../../../runner/build/linux/src/grandorgue + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + - - - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/common - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/c++/9 - ../../src/grandorgue/gui/dialogs/midi-event - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/modification - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core - ../../src/grandorgue/help - ../../src/core/config - ../../src/grandorgue/gui/size - ../../src/grandorgue/config - ../../src/grandorgue/midi - ../../../../../../runner/build/linux/src/grandorgue - + - - - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/midi - ../../src/grandorgue/gui/dialogs/midi-event - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - /usr/include/c++/9 - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/modification - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core - ../../../../../../runner/build/linux/src/grandorgue - + + + + + + + + + ../../build/current/src/core/go_defs.h @@ -29579,67 +29522,6 @@ - - - - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/common - ../../src/grandorgue/gui/dialogs/midi-event - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - ../../src/core - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/config - ../../src/grandorgue/modification - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core/config - ../../src/grandorgue/midi - ../../../../../../runner/build/linux/src/grandorgue - - - - - - - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - /usr/include/wx-3.0/wx/generic - ../../src/grandorgue/gui/dialogs/settings - ../../src/core/settings - /usr/include/c++/9/bits - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - /usr/include/c++/9/ext - ../../src/grandorgue/config - ../../src/grandorgue/sound - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core - ../../src/core/config - /usr/include/c++/9/pstl - ../../src/core/threading - ../../src/grandorgue/sound/scheduler - ../../../../../../runner/build/linux/src/grandorgue - - - - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - ../../src/grandorgue/gui/dialogs/common - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/wx-3.0/wx/meta + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/grandorgue/help - ../../src/core/config - ../../src/grandorgue/gui/size - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - /usr/include/c++/9 - ../../src/grandorgue/config - /usr/include/c++/9/ext + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/settings - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/midi - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - ../../src/grandorgue/gui/dialogs/common - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/c++/9 - ../../src/grandorgue/gui/dialogs/midi-event - /usr/include/x86_64-linux-gnu/bits - ../../src/core/midi - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/config - ../../src/grandorgue/gui/size - ../../src/grandorgue/config - ../../src/grandorgue/help - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/config - ../../src/core/settings - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - /usr/include/c++/9/ext - ../../src/grandorgue/gui/dialogs/settings - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - ../../src/grandorgue/gui/wxcontrols - /usr/include/c++/9 - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/core/settings - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/config - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - ../../src/core/settings - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - ../../src/grandorgue/gui/wxcontrols - /usr/include/c++/9 - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/config - ../../src/grandorgue/config - /usr/include/c++/9/pstl - ../../src/core/files - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/wx-3.0/wx/gtk - ../../src/grandorgue/gui/dialogs/settings - /usr/include/wx-3.0/wx/generic - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/wx-3.0/wx/meta - ../../src/core/temperaments - ../../src/core/config - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/c++/9/bits - /usr/include/c++/9/ext - ../../src/grandorgue/loader + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/config - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/archive - /usr/include/c++/9/pstl - ../../src/core/threading - ../../src/core/config - ../../src/core/midi - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + /usr/include/wx-3.0/wx ../../src/grandorgue/loader/cache /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/include/x86_64-linux-gnu/bits/types @@ -31026,26 +30905,28 @@ ex="false" tool="1" flavor2="11"> - + - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits - ../../src/grandorgue/loader/cache + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/core/archive - ../../src/core/settings - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/sys - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core/config - ../../src/core/midi - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + /usr/include/wx-3.0/wx ../../src/grandorgue/loader/cache /usr/lib/gcc/x86_64-linux-gnu/9/include /usr/include/x86_64-linux-gnu/bits/types @@ -31072,27 +30954,28 @@ ex="false" tool="1" flavor2="11"> - + - /usr/include/wx-3.0/wx - ../../src/grandorgue/midi/ports - ../../src/grandorgue/midi - /usr/include/c++/9 - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/x86_64-linux-gnu/bits + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/grandorgue/config - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source ../../src/grandorgue - ../../src/core/config - /usr/include/wx-3.0/wx/gtk - ../../../../../../runner/build/linux/src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + + + + + ../../src/core/midi + /usr/include/c++/9/bits + /usr/include/c++/9/ext + ../../src/grandorgue/midi + /usr/include/x86_64-linux-gnu/bits + ../../src/core/config + /usr/include/wx-3.0/wx + /usr/include/c++/9 + /usr/lib/gcc/x86_64-linux-gnu/9/include + /usr/include/x86_64-linux-gnu/bits/types + /usr/include/x86_64-linux-gnu/c++/9/bits + /usr/include/c++/9/debug + ../../src/core + ../../../../../../runner/build/linux/src/grandorgue + + + + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + + - - - ../../build/current/src/core/go_defs.h - ../../src/grandorgue/resource - ../../src/core - ../../submodules/RtMidi - ../../submodules/RtAudio - ../../submodules/PortAudio/include - ../../submodules/ZitaConvolver/source - ../../src/grandorgue - /usr/lib64/wx/include/gtk3-unicode-3.2 - /usr/include/wx-3.2 - ../../build/current/src/grandorgue - - - GO_USE_JACK - WXUSINGDLL - _FILE_OFFSET_BITS=64 - _LARGEFILE_SOURCE= - _REENTRANT - __WXGTK__ - + - - - - ../../src/core/midi - /usr/include/c++/9/bits - /usr/include/c++/9/ext - ../../src/grandorgue/midi - /usr/include/x86_64-linux-gnu/bits - ../../src/core/config - /usr/include/wx-3.0/wx - /usr/include/c++/9 - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core - ../../../../../../runner/build/linux/src/grandorgue - + - - - - ../../src/grandorgue/midi - ../../../../../../runner/build/linux/src/grandorgue - + - - - - /usr/include/wx-3.0/wx - /usr/include/c++/9/bits - /usr/include/c++/9/ext - ../../src/grandorgue/midi - /usr/include/x86_64-linux-gnu/bits - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/c++/9 - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - ../../src/core - ../../src/core/config - ../../../../../../runner/build/linux/src/grandorgue - + - - + - @@ -31628,6 +31562,34 @@ + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + - + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - ../../src/grandorgue/model/pipe-config - /usr/include/c++/9/bits - /usr/include/c++/9/ext - /usr/include/c++/9 - /usr/include/wx-3.0/wx - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/x86_64-linux-gnu/bits - ../../src/core/config - ../../src/grandorgue/config - /usr/include/c++/9/pstl - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - /usr/include/wx-3.0/wx - /usr/include/c++/9/bits - /usr/include/c++/9/ext - ../../src/grandorgue/sound + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/x86_64-linux-gnu/bits + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include ../../submodules/ZitaConvolver/source - /usr/include/c++/9 - ../../src/core/settings - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/c++/9/pstl - ../../src/core/files - ../../src/core/config - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - ../../src/grandorgue/sound/scheduler - /usr/include/c++/9 - /usr/include/c++/9/bits - ../../src/grandorgue/sound - ../../src/core/threading - /usr/include/x86_64-linux-gnu/bits - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/c++/9/ext - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/c++/9/pstl + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/wx-3.0/wx - ../../src/core/config - ../../src/grandorgue/config - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + - + - ../../src/grandorgue/sound/scheduler - /usr/include/c++/9 - /usr/include/c++/9/bits - /usr/include/c++/9/ext + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource ../../src/core - /usr/include/x86_64-linux-gnu/c++/9/bits - /usr/include/c++/9/debug - /usr/include/x86_64-linux-gnu/bits - /usr/lib/gcc/x86_64-linux-gnu/9/include - /usr/include/x86_64-linux-gnu/bits/types - /usr/include/wx-3.0/wx - ../../src/core/config - ../../src/grandorgue/config - /usr/include/c++/9/pstl - ../../src/core/threading - ../../src/grandorgue/sound - ../../src/grandorgue/model - ../../../../../../runner/build/linux/src/grandorgue + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + + + ../../build/current/src/core/go_defs.h + ../../src/grandorgue/resource + ../../src/core + ../../submodules/RtMidi + ../../submodules/RtAudio + ../../submodules/PortAudio/include + ../../submodules/ZitaConvolver/source + ../../src/grandorgue + /usr/lib64/wx/include/gtk3-unicode-3.2 + /usr/include/wx-3.2 + ../../build/current/src/grandorgue + + + GO_USE_JACK + WXUSINGDLL + _FILE_OFFSET_BITS=64 + _LARGEFILE_SOURCE= + _REENTRANT + __WXGTK__ + + + @@ -33686,13 +33681,6 @@ - - - - /usr/include/wx-3.0/wx - - - diff --git a/src/grandorgue/CMakeLists.txt b/src/grandorgue/CMakeLists.txt index 789d635db..d3b5a799b 100644 --- a/src/grandorgue/CMakeLists.txt +++ b/src/grandorgue/CMakeLists.txt @@ -139,6 +139,11 @@ loader/cache/GOCache.cpp loader/cache/GOCacheCleaner.cpp loader/cache/GOCacheWriter.cpp midi/dialog-creator/GOMidiDialogCreatorProxy.cpp +midi/objects/GOMidiObject.cpp +midi/objects/GOMidiObjectWithDivision.cpp +midi/objects/GOMidiObjectWithShortcut.cpp +midi/objects/GOMidiReceivingSendingObject.cpp +midi/objects/GOMidiSendingObject.cpp midi/ports/GOMidiInPort.cpp midi/ports/GOMidiOutPort.cpp midi/ports/GOMidiPort.cpp @@ -158,7 +163,6 @@ midi/GOMidiShortcutPattern.cpp midi/GOMidiShortcutReceiver.cpp midi/GOMidiReceiver.cpp midi/GOMidiRecorder.cpp -midi/objects/GOMidiObject.cpp model/pipe-config/GOPipeConfig.cpp model/pipe-config/GOPipeConfigNode.cpp model/pipe-config/GOPipeConfigTreeNode.cpp diff --git a/src/grandorgue/GOMetronome.cpp b/src/grandorgue/GOMetronome.cpp index d1a6bbfdb..c21ff5a01 100644 --- a/src/grandorgue/GOMetronome.cpp +++ b/src/grandorgue/GOMetronome.cpp @@ -59,11 +59,11 @@ GOMetronome::GOMetronome(GOOrganController *organController) m_StopID(0) { CreateButtons(*m_OrganController); - m_buttons[ID_METRONOME_ON]->SetPreconfigIndex(25); - m_buttons[ID_METRONOME_MEASURE_P1]->SetPreconfigIndex(28); - m_buttons[ID_METRONOME_MEASURE_M1]->SetPreconfigIndex(29); - m_buttons[ID_METRONOME_BEAT_P1]->SetPreconfigIndex(26); - m_buttons[ID_METRONOME_BEAT_M1]->SetPreconfigIndex(27); + m_buttons[ID_METRONOME_ON]->SetInitialMidiIndex(25); + m_buttons[ID_METRONOME_MEASURE_P1]->SetInitialMidiIndex(28); + m_buttons[ID_METRONOME_MEASURE_M1]->SetInitialMidiIndex(29); + m_buttons[ID_METRONOME_BEAT_P1]->SetInitialMidiIndex(26); + m_buttons[ID_METRONOME_BEAT_M1]->SetInitialMidiIndex(27); m_OrganController->RegisterSoundStateHandler(this); } diff --git a/src/grandorgue/GOVirtualCouplerController.cpp b/src/grandorgue/GOVirtualCouplerController.cpp index 346fe3618..665e3bb12 100644 --- a/src/grandorgue/GOVirtualCouplerController.cpp +++ b/src/grandorgue/GOVirtualCouplerController.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -39,7 +39,7 @@ void load_coupler( keyshift, dstManualN, couplerType); - pCoupler->SetElementID(organModel.GetRecorderElementID( + pCoupler->SetElementId(organModel.GetRecorderElementID( wxString::Format(recorderNameFmt, srcManualN, dstManualN))); pSrcManual->AddCoupler(pCoupler); manualCouplers.push_back(pCoupler); diff --git a/src/grandorgue/combinations/GODivisionalSetter.cpp b/src/grandorgue/combinations/GODivisionalSetter.cpp index dddb7de94..c69c5a161 100644 --- a/src/grandorgue/combinations/GODivisionalSetter.cpp +++ b/src/grandorgue/combinations/GODivisionalSetter.cpp @@ -170,7 +170,6 @@ void GODivisionalSetter::Load(GOConfigReader &cfg) { assert(divisional); divisional->Init(cfg, buttonName, wxString::Format(wxT("%d"), j + 1)); - divisional->Load(cfg, buttonName); divisional->SetDisplayed(true); } diff --git a/src/grandorgue/combinations/GOSetter.cpp b/src/grandorgue/combinations/GOSetter.cpp index 3a34792ba..c29d354ac 100644 --- a/src/grandorgue/combinations/GOSetter.cpp +++ b/src/grandorgue/combinations/GOSetter.cpp @@ -308,33 +308,33 @@ GOSetter::GOSetter(GOOrganController *organController) m_CrescendoCtrl(*organController) { CreateButtons(*m_OrganController); - m_buttons[ID_SETTER_PREV]->SetPreconfigIndex(0); - m_buttons[ID_SETTER_NEXT]->SetPreconfigIndex(1); - m_buttons[ID_SETTER_SET]->SetPreconfigIndex(2); - m_buttons[ID_SETTER_CURRENT]->SetPreconfigIndex(3); - m_buttons[ID_SETTER_GC]->SetPreconfigIndex(4); - m_buttons[ID_SETTER_M10]->SetPreconfigIndex(5); - m_buttons[ID_SETTER_P10]->SetPreconfigIndex(6); - m_buttons[ID_SETTER_L0]->SetPreconfigIndex(7); - m_buttons[ID_SETTER_L1]->SetPreconfigIndex(8); - m_buttons[ID_SETTER_L2]->SetPreconfigIndex(9); - m_buttons[ID_SETTER_L3]->SetPreconfigIndex(10); - m_buttons[ID_SETTER_L4]->SetPreconfigIndex(11); - m_buttons[ID_SETTER_L5]->SetPreconfigIndex(12); - m_buttons[ID_SETTER_L6]->SetPreconfigIndex(13); - m_buttons[ID_SETTER_L7]->SetPreconfigIndex(14); - m_buttons[ID_SETTER_L8]->SetPreconfigIndex(15); - m_buttons[ID_SETTER_L9]->SetPreconfigIndex(16); - m_buttons[ID_SETTER_PITCH_M1]->SetPreconfigIndex(17); - m_buttons[ID_SETTER_PITCH_P1]->SetPreconfigIndex(18); - m_buttons[ID_SETTER_PITCH_M100]->SetPreconfigIndex(19); - m_buttons[ID_SETTER_PITCH_P100]->SetPreconfigIndex(20); - m_buttons[ID_SETTER_TEMPERAMENT_PREV]->SetPreconfigIndex(21); - m_buttons[ID_SETTER_TEMPERAMENT_NEXT]->SetPreconfigIndex(22); - m_buttons[ID_SETTER_TRANSPOSE_DOWN]->SetPreconfigIndex(23); - m_buttons[ID_SETTER_TRANSPOSE_UP]->SetPreconfigIndex(24); - m_buttons[ID_SETTER_AUDIO_PANIC]->SetPreconfigIndex(25); - m_buttons[ID_SETTER_FILE_EXIT]->SetPreconfigIndex(26); + m_buttons[ID_SETTER_PREV]->SetInitialMidiIndex(0); + m_buttons[ID_SETTER_NEXT]->SetInitialMidiIndex(1); + m_buttons[ID_SETTER_SET]->SetInitialMidiIndex(2); + m_buttons[ID_SETTER_CURRENT]->SetInitialMidiIndex(3); + m_buttons[ID_SETTER_GC]->SetInitialMidiIndex(4); + m_buttons[ID_SETTER_M10]->SetInitialMidiIndex(5); + m_buttons[ID_SETTER_P10]->SetInitialMidiIndex(6); + m_buttons[ID_SETTER_L0]->SetInitialMidiIndex(7); + m_buttons[ID_SETTER_L1]->SetInitialMidiIndex(8); + m_buttons[ID_SETTER_L2]->SetInitialMidiIndex(9); + m_buttons[ID_SETTER_L3]->SetInitialMidiIndex(10); + m_buttons[ID_SETTER_L4]->SetInitialMidiIndex(11); + m_buttons[ID_SETTER_L5]->SetInitialMidiIndex(12); + m_buttons[ID_SETTER_L6]->SetInitialMidiIndex(13); + m_buttons[ID_SETTER_L7]->SetInitialMidiIndex(14); + m_buttons[ID_SETTER_L8]->SetInitialMidiIndex(15); + m_buttons[ID_SETTER_L9]->SetInitialMidiIndex(16); + m_buttons[ID_SETTER_PITCH_M1]->SetInitialMidiIndex(17); + m_buttons[ID_SETTER_PITCH_P1]->SetInitialMidiIndex(18); + m_buttons[ID_SETTER_PITCH_M100]->SetInitialMidiIndex(19); + m_buttons[ID_SETTER_PITCH_P100]->SetInitialMidiIndex(20); + m_buttons[ID_SETTER_TEMPERAMENT_PREV]->SetInitialMidiIndex(21); + m_buttons[ID_SETTER_TEMPERAMENT_NEXT]->SetInitialMidiIndex(22); + m_buttons[ID_SETTER_TRANSPOSE_DOWN]->SetInitialMidiIndex(23); + m_buttons[ID_SETTER_TRANSPOSE_UP]->SetInitialMidiIndex(24); + m_buttons[ID_SETTER_AUDIO_PANIC]->SetInitialMidiIndex(25); + m_buttons[ID_SETTER_FILE_EXIT]->SetInitialMidiIndex(26); m_buttons[ID_SETTER_PREV]->SetShortcutKey(37); m_buttons[ID_SETTER_NEXT]->SetShortcutKey(39); @@ -1174,7 +1174,7 @@ void GOSetter::Crescendo(int newpos, bool force) { void GOSetter::ControlChanged(GOControl *control) { if (control == &m_CrescendoCtrl) - Crescendo(m_CrescendoCtrl.GetMidiValue() * CRESCENDO_STEPS / 128); + Crescendo(m_CrescendoCtrl.GetEnclosureValue() * CRESCENDO_STEPS / 128); } void GOSetter::UpdateTranspose() { diff --git a/src/grandorgue/combinations/control/GODivisionalButtonControl.cpp b/src/grandorgue/combinations/control/GODivisionalButtonControl.cpp index 7121626f2..a3e43097d 100644 --- a/src/grandorgue/combinations/control/GODivisionalButtonControl.cpp +++ b/src/grandorgue/combinations/control/GODivisionalButtonControl.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -12,25 +12,17 @@ #include "model/GOManual.h" #include "model/GOOrganModel.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Divisional"); +static const wxString WX_MIDI_TYPE_NAME = _("Divisional"); + GODivisionalButtonControl::GODivisionalButtonControl( GOOrganModel &organModel, unsigned manualNumber, unsigned divisionalIndex) - : GOPushbuttonControl(organModel), + : GOPushbuttonControl(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), r_OrganModel(organModel), m_ManualN(manualNumber), m_DivisionalIndex(divisionalIndex), m_combination(organModel, manualNumber, false) {} -const wxString WX_MIDI_TYPE_CODE = wxT("Divisional"); -const wxString WX_MIDI_TYPE = _("Divisional"); - -const wxString &GODivisionalButtonControl::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; -} - -const wxString &GODivisionalButtonControl::GetMidiType() const { - return WX_MIDI_TYPE; -} - void GODivisionalButtonControl::Init( GOConfigReader &cfg, const wxString &group, const wxString &name) { GOPushbuttonControl::Init(cfg, group, name); diff --git a/src/grandorgue/combinations/control/GODivisionalButtonControl.h b/src/grandorgue/combinations/control/GODivisionalButtonControl.h index dc10d9409..88570dc4d 100644 --- a/src/grandorgue/combinations/control/GODivisionalButtonControl.h +++ b/src/grandorgue/combinations/control/GODivisionalButtonControl.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -36,8 +36,6 @@ class GODivisionalButtonControl : public GOPushbuttonControl { GOOrganModel &organModel, unsigned manualNumber, unsigned divisionalIndex); GODivisionalCombination &GetCombination() { return m_combination; } - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; void Init(GOConfigReader &cfg, const wxString &group, const wxString &name); diff --git a/src/grandorgue/combinations/control/GOGeneralButtonControl.cpp b/src/grandorgue/combinations/control/GOGeneralButtonControl.cpp index ae9927004..0b2fb3c12 100644 --- a/src/grandorgue/combinations/control/GOGeneralButtonControl.cpp +++ b/src/grandorgue/combinations/control/GOGeneralButtonControl.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2023 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -12,13 +12,16 @@ #include "combinations/model/GOCombinationDefinition.h" #include "model/GOOrganModel.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("General"); +static const wxString WX_MIDI_TYPE_NAME = _("General"); + GOGeneralButtonControl::GOGeneralButtonControl( GOOrganModel &organModel, bool is_setter) - : GOPushbuttonControl(organModel), + : GOPushbuttonControl(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), r_OrganModel(organModel), m_combination(r_OrganModel, is_setter) {} -void GOGeneralButtonControl::Load(GOConfigReader &cfg, wxString group) { +void GOGeneralButtonControl::Load(GOConfigReader &cfg, const wxString &group) { m_combination.Load(cfg, group); GOPushbuttonControl::Load(cfg, group); } @@ -30,14 +33,3 @@ void GOGeneralButtonControl::Push() { GOGeneralCombination &GOGeneralButtonControl::GetCombination() { return m_combination; } - -const wxString WX_MIDI_TYPE_CODE = wxT("General"); -const wxString WX_MIDI_TYPE = _("General"); - -const wxString &GOGeneralButtonControl::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; -} - -const wxString &GOGeneralButtonControl::GetMidiType() const { - return WX_MIDI_TYPE; -} diff --git a/src/grandorgue/combinations/control/GOGeneralButtonControl.h b/src/grandorgue/combinations/control/GOGeneralButtonControl.h index 4c84b9269..58763daea 100644 --- a/src/grandorgue/combinations/control/GOGeneralButtonControl.h +++ b/src/grandorgue/combinations/control/GOGeneralButtonControl.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2023 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -21,12 +21,9 @@ class GOGeneralButtonControl : public GOPushbuttonControl { public: GOGeneralButtonControl(GOOrganModel &organModel, bool is_setter); - void Load(GOConfigReader &cfg, wxString group); + void Load(GOConfigReader &cfg, const wxString &group) override; void Push() override; GOGeneralCombination &GetCombination(); - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif /* GOGENERAL_H */ diff --git a/src/grandorgue/control/GOButtonControl.cpp b/src/grandorgue/control/GOButtonControl.cpp index c5b97c5be..339e13154 100644 --- a/src/grandorgue/control/GOButtonControl.cpp +++ b/src/grandorgue/control/GOButtonControl.cpp @@ -5,81 +5,55 @@ * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ +#include "GOButtonControl.h" + #include -#include "config/GOConfig.h" #include "config/GOConfigReader.h" -#include "control/GOButtonControl.h" +#include "model/GOOrganModel.h" #include "GODocument.h" -#include "GOOrganController.h" GOButtonControl::GOButtonControl( GOOrganModel &organModel, - GOMidiReceiverType midi_type, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiReceiverType midiType, bool pushbutton, bool isPiston) - : GOMidiObject(organModel), - r_MidiMap(organModel.GetConfig().GetMidiMap()), - r_OrganModel(organModel), - m_midi(organModel, midi_type), - m_sender(organModel, MIDI_SEND_BUTTON), - m_shortcut(GOMidiShortcutReceiver::KEY_RECV_BUTTON), + : GOMidiObjectWithShortcut( + organModel, + midiTypeCode, + midiTypeName, + MIDI_SEND_BUTTON, + midiType, + GOMidiShortcutReceiver::KEY_RECV_BUTTON), m_Pushbutton(pushbutton), m_Displayed(false), - m_Name(), m_Engaged(false), m_DisplayInInvertedState(false), m_ReadOnly(false), - m_IsPiston(isPiston) { - organModel.RegisterEventHandler(this); - organModel.RegisterMidiConfigurator(this); - organModel.RegisterSoundStateHandler(this); -} + m_IsPiston(isPiston) {} void GOButtonControl::Init( GOConfigReader &cfg, const wxString &group, const wxString &name) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = name; + GOMidiObjectWithShortcut::Init(cfg, group, name); m_Displayed = false; m_DisplayInInvertedState = false; - if (!m_ReadOnly) { - m_midi.Load(cfg, group, r_MidiMap); - m_shortcut.Load(cfg, group); - } - m_sender.Load(cfg, group, r_MidiMap); } void GOButtonControl::Load(GOConfigReader &cfg, const wxString &group) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = cfg.ReadStringNotEmpty(ODFSetting, group, wxT("Name"), true, m_Name); + GOMidiObjectWithShortcut::Load( + cfg, group, cfg.ReadStringNotEmpty(ODFSetting, group, wxT("Name"), true)); m_Displayed = cfg.ReadBoolean(ODFSetting, group, wxT("Displayed"), false, false); m_DisplayInInvertedState = cfg.ReadBoolean( ODFSetting, group, wxT("DisplayInInvertedState"), false, false); - if (!m_ReadOnly) { - m_midi.Load(cfg, group, r_MidiMap); - m_shortcut.Load(cfg, group); - } - m_sender.Load(cfg, group, r_MidiMap); -} - -void GOButtonControl::Save(GOConfigWriter &cfg) { - if (!m_ReadOnly) { - m_midi.Save(cfg, m_group, r_MidiMap); - m_shortcut.Save(cfg, m_group); - } - m_sender.Save(cfg, m_group, r_MidiMap); } -bool GOButtonControl::IsDisplayed() { return m_Displayed; } - -void GOButtonControl::HandleKey(int key) { - if (m_ReadOnly) - return; - switch (m_shortcut.Match(key)) { +void GOButtonControl::OnShortcutKeyReceived( + GOMidiShortcutReceiver::MatchType matchType, int key) { + switch (matchType) { case GOMidiShortcutReceiver::KEY_MATCH: Push(); break; @@ -95,24 +69,19 @@ void GOButtonControl::Push() { SetButtonState(m_Engaged ^ true); } -void GOButtonControl::SetButtonState(bool on) {} - -void GOButtonControl::AbortPlayback() { - m_sender.SetDisplay(false); - m_sender.SetName(wxEmptyString); +void GOButtonControl::PrepareRecording() { + GOMidiObjectWithShortcut::PrepareRecording(); + SendMidiValue(m_Engaged); } -void GOButtonControl::PreparePlayback() { - m_midi.PreparePlayback(); - m_sender.SetName(m_Name); +void GOButtonControl::AbortPlayback() { + SendMidiValue(false); + GOMidiObjectWithShortcut::AbortPlayback(); } -void GOButtonControl::PrepareRecording() { m_sender.SetDisplay(m_Engaged); } - -void GOButtonControl::ProcessMidi(const GOMidiEvent &event) { - if (m_ReadOnly) - return; - switch (m_midi.Match(event)) { +void GOButtonControl::OnMidiReceived( + const GOMidiEvent &event, GOMidiMatchType matchType, int key, int value) { + switch (matchType) { case MIDI_MATCH_CHANGE: Push(); break; @@ -137,32 +106,11 @@ void GOButtonControl::ProcessMidi(const GOMidiEvent &event) { void GOButtonControl::Display(bool onoff) { if (m_Engaged == onoff) return; - m_sender.SetDisplay(onoff); + SendMidiValue(onoff); m_Engaged = onoff; r_OrganModel.SendControlChanged(this); } -bool GOButtonControl::IsEngaged() const { return m_Engaged; } - -bool GOButtonControl::DisplayInverted() const { - return m_DisplayInInvertedState; -} - -void GOButtonControl::SetElementID(int id) { - if (!m_ReadOnly) { - m_midi.SetElementID(id); - m_sender.SetElementID(id); - } -} - -void GOButtonControl::SetShortcutKey(unsigned key) { - m_shortcut.SetShortcut(key); -} - -void GOButtonControl::SetPreconfigIndex(unsigned index) { - m_midi.SetIndex(index); -} - wxString GOButtonControl::GetElementStatus() { return m_Engaged ? _("ON") : _("OFF"); } @@ -176,4 +124,4 @@ std::vector GOButtonControl::GetElementActions() { void GOButtonControl::TriggerElementActions(unsigned no) { if (no == 0) Push(); -} +} \ No newline at end of file diff --git a/src/grandorgue/control/GOButtonControl.h b/src/grandorgue/control/GOButtonControl.h index 755807980..4050ae9a3 100644 --- a/src/grandorgue/control/GOButtonControl.h +++ b/src/grandorgue/control/GOButtonControl.h @@ -10,15 +10,9 @@ #include -#include "midi/GOMidiReceiver.h" -#include "midi/GOMidiSender.h" -#include "midi/GOMidiShortcutReceiver.h" -#include "midi/objects/GOMidiObject.h" -#include "sound/GOSoundStateHandler.h" +#include "midi/objects/GOMidiObjectWithShortcut.h" #include "GOControl.h" -#include "GOEventHandler.h" -#include "GOSaveableObject.h" class GOConfigReader; class GOConfigWriter; @@ -26,70 +20,50 @@ class GOMidiEvent; class GOMidiMap; class GOOrganModel; -class GOButtonControl : public GOControl, - private GOEventHandler, - public GOSaveableObject, - public GOSoundStateHandler, - public GOMidiObject { -private: - GOMidiMap &r_MidiMap; - +class GOButtonControl : public GOControl, public GOMidiObjectWithShortcut { protected: - GOOrganModel &r_OrganModel; - GOMidiReceiver m_midi; - GOMidiSender m_sender; - GOMidiShortcutReceiver m_shortcut; bool m_Pushbutton; bool m_Displayed; - wxString m_Name; bool m_Engaged; bool m_DisplayInInvertedState; bool m_ReadOnly; bool m_IsPiston; - void ProcessMidi(const GOMidiEvent &event) override; - void HandleKey(int key) override; - - void Save(GOConfigWriter &cfg) override; + void OnMidiReceived( + const GOMidiEvent &event, + GOMidiMatchType matchType, + int key, + int value) override; + void OnShortcutKeyReceived( + GOMidiShortcutReceiver::MatchType matchType, int key) override; - void AbortPlayback() override; - void PreparePlayback() override; void PrepareRecording() override; - - GOMidiReceiverBase *GetMidiReceiver() override { - return IsReadOnly() ? nullptr : &m_midi; - } - - GOMidiSender *GetMidiSender() override { return &m_sender; } - - GOMidiShortcutReceiver *GetMidiShortcutReceiver() override { - return IsReadOnly() ? nullptr : &m_shortcut; - } + void AbortPlayback() override; public: GOButtonControl( GOOrganModel &organModel, - GOMidiReceiverType midi_type, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiReceiverType midiType, bool pushbutton, bool isPiston = false); - void Init(GOConfigReader &cfg, const wxString &group, const wxString &name); - void Load(GOConfigReader &cfg, const wxString &group); - bool IsDisplayed(); + + void Init( + GOConfigReader &cfg, const wxString &group, const wxString &name) override; + using GOMidiObject::Load; // Avoiding a compilation warning + virtual void Load(GOConfigReader &cfg, const wxString &group); + + bool IsDisplayed() const { return m_Displayed; } void SetDisplayed(bool displayed) { m_Displayed = displayed; } - bool IsReadOnly() const { return m_ReadOnly; } - const wxString &GetName() const { return m_Name; } + bool IsReadOnly() const override { return m_ReadOnly; } bool IsPiston() const { return m_IsPiston; } + bool IsEngaged() const { return m_Engaged; } + bool DisplayInverted() const { return m_DisplayInInvertedState; } virtual void Push(); - virtual void SetButtonState(bool on); + virtual void SetButtonState(bool on) {} virtual void Display(bool onoff); - bool IsEngaged() const; - bool DisplayInverted() const; - void SetElementID(int id); - void SetShortcutKey(unsigned key); - void SetPreconfigIndex(unsigned index); - - const wxString &GetMidiName() const override { return GetName(); } wxString GetElementStatus() override; std::vector GetElementActions() override; diff --git a/src/grandorgue/control/GOCallbackButtonControl.cpp b/src/grandorgue/control/GOCallbackButtonControl.cpp index 4b8371cff..1802c12e9 100644 --- a/src/grandorgue/control/GOCallbackButtonControl.cpp +++ b/src/grandorgue/control/GOCallbackButtonControl.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -11,12 +11,21 @@ #include "control/GOButtonCallback.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Button"); +static const wxString WX_MIDI_TYPE_NAME = _("Button"); + GOCallbackButtonControl::GOCallbackButtonControl( GOOrganModel &organModel, GOButtonCallback *callback, bool isPushbutton, bool isPiston) - : GOButtonControl(organModel, MIDI_RECV_SETTER, isPushbutton, isPiston), + : GOButtonControl( + organModel, + WX_MIDI_TYPE_CODE, + WX_MIDI_TYPE_NAME, + MIDI_RECV_SETTER, + isPushbutton, + isPiston), m_callback(callback) {} void GOCallbackButtonControl::Push() { @@ -32,14 +41,3 @@ void GOCallbackButtonControl::SetButtonState(bool on) { m_callback->ButtonStateChanged(this, on); Display(on); } - -const wxString WX_MIDI_TYPE_CODE = wxT("Button"); -const wxString WX_MIDI_TYPE = _("Button"); - -const wxString &GOCallbackButtonControl::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; -} - -const wxString &GOCallbackButtonControl::GetMidiType() const { - return WX_MIDI_TYPE; -} diff --git a/src/grandorgue/control/GOCallbackButtonControl.h b/src/grandorgue/control/GOCallbackButtonControl.h index 7bffeb127..59cceb433 100644 --- a/src/grandorgue/control/GOCallbackButtonControl.h +++ b/src/grandorgue/control/GOCallbackButtonControl.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -24,9 +24,6 @@ class GOCallbackButtonControl : public GOButtonControl { bool isPiston = false); void Push(void) override; void SetButtonState(bool on) override; - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif diff --git a/src/grandorgue/control/GOLabelControl.cpp b/src/grandorgue/control/GOLabelControl.cpp index b86ac8e70..ab963d266 100644 --- a/src/grandorgue/control/GOLabelControl.cpp +++ b/src/grandorgue/control/GOLabelControl.cpp @@ -9,67 +9,33 @@ #include -#include "config/GOConfig.h" #include "model/GOOrganModel.h" -#include "GODocument.h" +const wxString WX_MIDI_TYPE_CODE = wxT("Label"); +const wxString WX_MIDI_TYPE_NAME = _("Label"); GOLabelControl::GOLabelControl(GOOrganModel &organModel) - : GOMidiObject(organModel), - r_OrganModel(organModel), - m_Name(), - m_Content(), - m_sender(organModel, MIDI_SEND_LABEL) { - r_OrganModel.RegisterMidiConfigurator(this); - r_OrganModel.RegisterSoundStateHandler(this); -} - -GOLabelControl::~GOLabelControl() {} - -void GOLabelControl::Init(GOConfigReader &cfg, wxString group, wxString name) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = name; - m_sender.Load(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); -} - -void GOLabelControl::Load(GOConfigReader &cfg, wxString group, wxString name) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = name; - m_sender.Load(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); -} - -void GOLabelControl::Save(GOConfigWriter &cfg) { - m_sender.Save(cfg, m_group, r_OrganModel.GetConfig().GetMidiMap()); -} + : GOMidiSendingObject( + organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME, MIDI_SEND_LABEL) {} const wxString &GOLabelControl::GetContent() { return m_Content; } void GOLabelControl::SetContent(wxString name) { m_Content = name; - m_sender.SetLabel(m_Content); + SendMidiValue(m_Content); r_OrganModel.SendControlChanged(this); } void GOLabelControl::AbortPlayback() { - m_sender.SetLabel(wxEmptyString); - m_sender.SetName(wxEmptyString); + SendMidiValue(wxEmptyString); + GOMidiSendingObject::AbortPlayback(); } -void GOLabelControl::PreparePlayback() { m_sender.SetName(m_Name); } - -void GOLabelControl::PrepareRecording() { m_sender.SetLabel(m_Content); } - -const wxString WX_MIDI_TYPE_CODE = wxT("Label"); -const wxString WX_MIDI_TYPE = _("Label"); - -const wxString &GOLabelControl::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; +void GOLabelControl::PrepareRecording() { + GOMidiSendingObject::PrepareRecording(); + SendMidiValue(m_Content); } -const wxString &GOLabelControl::GetMidiType() const { return WX_MIDI_TYPE; } - wxString GOLabelControl::GetElementStatus() { return m_Content; } std::vector GOLabelControl::GetElementActions() { diff --git a/src/grandorgue/control/GOLabelControl.h b/src/grandorgue/control/GOLabelControl.h index 731b3dd47..206d838b6 100644 --- a/src/grandorgue/control/GOLabelControl.h +++ b/src/grandorgue/control/GOLabelControl.h @@ -11,7 +11,7 @@ #include #include "midi/GOMidiSender.h" -#include "midi/objects/GOMidiObject.h" +#include "midi/objects/GOMidiSendingObject.h" #include "sound/GOSoundStateHandler.h" #include "GOControl.h" @@ -21,37 +21,18 @@ class GOConfigReader; class GOConfigWriter; class GOOrganModel; -class GOLabelControl : public GOControl, - private GOSaveableObject, - private GOSoundStateHandler, - public GOMidiObject { +class GOLabelControl : public GOControl, public GOMidiSendingObject { protected: - GOOrganModel &r_OrganModel; - wxString m_Name; wxString m_Content; - wxString m_group; - GOMidiSender m_sender; - - void Save(GOConfigWriter &cfg) override; void AbortPlayback() override; - void PreparePlayback() override; void PrepareRecording() override; public: GOLabelControl(GOOrganModel &organModel); - virtual ~GOLabelControl(); - void Init(GOConfigReader &cfg, wxString group, wxString name); - void Load(GOConfigReader &cfg, wxString group, wxString name); - const wxString &GetName() const { return m_Name; } const wxString &GetContent(); void SetContent(wxString name); - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; - const wxString &GetMidiName() const override { return GetName(); } - GOMidiSender *GetMidiSender() override { return &m_sender; } - wxString GetElementStatus() override; std::vector GetElementActions() override; void TriggerElementActions(unsigned no) override; diff --git a/src/grandorgue/control/GOPistonControl.cpp b/src/grandorgue/control/GOPistonControl.cpp index 88a055b87..a464c274a 100644 --- a/src/grandorgue/control/GOPistonControl.cpp +++ b/src/grandorgue/control/GOPistonControl.cpp @@ -19,8 +19,12 @@ #include "model/GOSwitch.h" #include "model/GOTremulant.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Piston"); +static const wxString WX_MIDI_TYPE_NAME = _("Piston"); + GOPistonControl::GOPistonControl(GOOrganModel &organModel) - : GOPushbuttonControl(organModel), drawstop(NULL) { + : GOPushbuttonControl(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), + drawstop(nullptr) { organModel.RegisterControlChangedHandler(this); } @@ -94,12 +98,3 @@ void GOPistonControl::ControlChanged(GOControl *control) { } void GOPistonControl::Push() { this->drawstop->Push(); } - -const wxString WX_MIDI_TYPE_CODE = wxT("Piston"); -const wxString WX_MIDI_TYPE = _("Piston"); - -const wxString &GOPistonControl::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; -} - -const wxString &GOPistonControl::GetMidiType() const { return WX_MIDI_TYPE; } diff --git a/src/grandorgue/control/GOPistonControl.h b/src/grandorgue/control/GOPistonControl.h index ea812c4f4..d429b9567 100644 --- a/src/grandorgue/control/GOPistonControl.h +++ b/src/grandorgue/control/GOPistonControl.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -26,9 +26,6 @@ class GOPistonControl : public GOPushbuttonControl, GOPistonControl(GOOrganModel &organModel); void Load(GOConfigReader &cfg, wxString group); void Push() override; - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif /* GOPISTON_H */ diff --git a/src/grandorgue/control/GOPushbuttonControl.h b/src/grandorgue/control/GOPushbuttonControl.h index a43ca1213..e4f002477 100644 --- a/src/grandorgue/control/GOPushbuttonControl.h +++ b/src/grandorgue/control/GOPushbuttonControl.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2023 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -12,8 +12,12 @@ class GOPushbuttonControl : public GOButtonControl { public: - GOPushbuttonControl(GOOrganModel &organModel) - : GOButtonControl(organModel, MIDI_RECV_BUTTON, true) {} + GOPushbuttonControl( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName) + : GOButtonControl( + organModel, midiTypeCode, midiTypeName, MIDI_RECV_BUTTON, true) {} }; #endif diff --git a/src/grandorgue/gui/dialogs/GOMidiListDialog.cpp b/src/grandorgue/gui/dialogs/GOMidiListDialog.cpp index 9354c9c0f..00109d8d8 100644 --- a/src/grandorgue/gui/dialogs/GOMidiListDialog.cpp +++ b/src/grandorgue/gui/dialogs/GOMidiListDialog.cpp @@ -72,9 +72,9 @@ GOMidiListDialog::GOMidiListDialog( for (unsigned i = 0; i < midi_elements.size(); i++) { GOMidiObject *obj = midi_elements[i]; - m_Objects->InsertItem(i, obj->GetMidiType()); + m_Objects->InsertItem(i, obj->GetMidiTypeName()); m_Objects->SetItemPtrData(i, (wxUIntPtr)obj); - m_Objects->SetItem(i, 1, obj->GetMidiName()); + m_Objects->SetItem(i, 1, obj->GetName()); } m_Objects->SetColumnWidth(0, wxLIST_AUTOSIZE); @@ -98,7 +98,7 @@ void GOMidiListDialog::OnStatus(wxCommandEvent &event) { wxString status = obj->GetElementStatus(); GOMessageBox( wxString::Format(_("Status: %s"), status), - obj->GetMidiType() + _(" ") + obj->GetMidiName(), + obj->GetMidiTypeName() + _(" ") + obj->GetName(), wxOK); } diff --git a/src/grandorgue/gui/panels/GOGUIEnclosure.cpp b/src/grandorgue/gui/panels/GOGUIEnclosure.cpp index d21e3e297..bf32e8da9 100644 --- a/src/grandorgue/gui/panels/GOGUIEnclosure.cpp +++ b/src/grandorgue/gui/panels/GOGUIEnclosure.cpp @@ -306,7 +306,7 @@ void GOGUIEnclosure::PrepareDraw(double scale, GOBitmap *background) { void GOGUIEnclosure::Draw(GODC &dc) { GOBitmap &bmp = m_Bitmaps - [((m_Bitmaps.size() - 1) * m_enclosure->GetMidiValue()) + [((m_Bitmaps.size() - 1) * m_enclosure->GetEnclosureValue()) / GOEnclosure::MAX_MIDI_VALUE]; dc.DrawBitmap(bmp, m_BoundingRect); @@ -342,7 +342,7 @@ bool GOGUIEnclosure::HandleMousePress( state.SetControl(this); state.SetIndex(value); - m_enclosure->SetIntMidiValue(value); + m_enclosure->SetEnclosureValue(value); return true; } } diff --git a/src/grandorgue/gui/panels/GOGUIFloatingPanel.cpp b/src/grandorgue/gui/panels/GOGUIFloatingPanel.cpp index 4358ce46b..9326f0497 100644 --- a/src/grandorgue/gui/panels/GOGUIFloatingPanel.cpp +++ b/src/grandorgue/gui/panels/GOGUIFloatingPanel.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -83,7 +83,7 @@ GOGUIPanel *GOGUIFloatingPanel::CreateFloatingPanel(GOConfigReader &cfg) { GOEnclosure *master_enc = new GOEnclosure(*m_OrganController); master_enc->Init(cfg, wxT("SetterMasterVolume"), _("Master"), 127); m_OrganController->AddEnclosure(master_enc); - master_enc->SetElementID( + master_enc->SetElementId( m_OrganController->GetRecorderElementID(wxString::Format(wxT("SM")))); GOGUIEnclosure *enclosure = new GOGUIEnclosure(panel, master_enc); @@ -101,7 +101,7 @@ GOGUIPanel *GOGUIFloatingPanel::CreateFloatingPanel(GOConfigReader &cfg) { windchest->GetName(), 127); m_OrganController->AddEnclosure(enc); - enc->SetElementID(m_OrganController->GetRecorderElementID( + enc->SetElementId(m_OrganController->GetRecorderElementID( wxString::Format(wxT("SM%d"), i))); windchest->AddEnclosure(enc); diff --git a/src/grandorgue/midi/objects/GOMidiObject.cpp b/src/grandorgue/midi/objects/GOMidiObject.cpp index d054c29e1..0c70787d1 100644 --- a/src/grandorgue/midi/objects/GOMidiObject.cpp +++ b/src/grandorgue/midi/objects/GOMidiObject.cpp @@ -9,21 +9,52 @@ #include -#include "midi/dialog-creator/GOMidiDialogCreator.h" +#include "midi/GOMidiReceiver.h" +#include "model/GOOrganModel.h" + +GOMidiObject::GOMidiObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiType) + : r_OrganModel(organModel), + r_MidiMap(organModel.GetConfig().GetMidiMap()), + r_MidiTypeCode(midiTypeCode), + r_MidiTypeName(midiType), + p_MidiSender(nullptr), + p_MidiReceiver(nullptr), + p_ShortcutReceiver(nullptr), + p_DivisionSender(nullptr) { + r_OrganModel.RegisterSoundStateHandler(this); + r_OrganModel.RegisterMidiObject(this); +} + +GOMidiObject::~GOMidiObject() { + r_OrganModel.UnregisterSaveableObject(this); + r_OrganModel.UnRegisterMidiObject(this); + r_OrganModel.UnRegisterSoundStateHandler(this); +} + +void GOMidiObject::InitMidiObject( + GOConfigReader &cfg, const wxString &group, const wxString &name) { + SetGroup(group); + m_name = name; + r_OrganModel.RegisterSaveableObject(this); + LoadMidiObject(cfg, group, r_MidiMap); +} void GOMidiObject::ShowConfigDialog() { - const wxString &midiTypeCode = GetMidiTypeCode(); - const wxString &midiName = GetMidiName(); - wxString title - = wxString::Format(_("Midi-Settings for %s - %s"), GetMidiType(), midiName); - wxString selector = wxString::Format(wxT("%s.%s"), midiTypeCode, midiName); + const bool isReadOnly = IsReadOnly(); + const wxString title + = wxString::Format(_("Midi-Settings for %s - %s"), r_MidiTypeName, m_name); + const wxString selector + = wxString::Format(wxT("%s.%s"), r_MidiTypeCode, m_name); - r_DialogCreator.ShowMIDIEventDialog( + r_OrganModel.ShowMIDIEventDialog( this, title, selector, - GetMidiReceiver(), - GetMidiSender(), - GetMidiShortcutReceiver(), - GetDivision()); + isReadOnly ? nullptr : p_MidiReceiver, + p_MidiSender, + isReadOnly ? nullptr : p_ShortcutReceiver, + p_DivisionSender); } diff --git a/src/grandorgue/midi/objects/GOMidiObject.h b/src/grandorgue/midi/objects/GOMidiObject.h index 58507a8b3..34616e1bc 100644 --- a/src/grandorgue/midi/objects/GOMidiObject.h +++ b/src/grandorgue/midi/objects/GOMidiObject.h @@ -12,33 +12,97 @@ #include -class GOMidiDialogCreator; -class GOMidiReceiverBase; +#include "sound/GOSoundStateHandler.h" + +#include "GOSaveableObject.h" + +class GOMidiMap; +class GOMidiReceiver; class GOMidiSender; class GOMidiShortcutReceiver; +class GOOrganModel; + +class GOMidiObject : public GOSoundStateHandler, public GOSaveableObject { +protected: + GOOrganModel &r_OrganModel; -class GOMidiObject { private: - GOMidiDialogCreator &r_DialogCreator; + GOMidiMap &r_MidiMap; + const wxString &r_MidiTypeCode; + const wxString &r_MidiTypeName; + + wxString m_name; + + GOMidiSender *p_MidiSender; + GOMidiReceiver *p_MidiReceiver; + GOMidiShortcutReceiver *p_ShortcutReceiver; + GOMidiSender *p_DivisionSender; protected: - virtual GOMidiReceiverBase *GetMidiReceiver() { return nullptr; } - virtual GOMidiSender *GetMidiSender() { return nullptr; } - virtual GOMidiShortcutReceiver *GetMidiShortcutReceiver() { return nullptr; } - virtual GOMidiSender *GetDivision() { return nullptr; } + GOMidiObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName); + + virtual ~GOMidiObject(); + + GOMidiSender *GetMidiSender() const { return p_MidiSender; } + void SetMidiSender(GOMidiSender *pMidiSender) { p_MidiSender = pMidiSender; } + GOMidiReceiver *GetMidiReceiver() const { return p_MidiReceiver; } + void SetMidiReceiver(GOMidiReceiver *pMidiReceiver) { + p_MidiReceiver = pMidiReceiver; + } + GOMidiShortcutReceiver *GetMidiShortcutReceiver() const { + return p_ShortcutReceiver; + } + void SetMidiShortcutReceiver(GOMidiShortcutReceiver *pShortcutReceiver) { + p_ShortcutReceiver = pShortcutReceiver; + } + GOMidiSender *GetDivisionSender() const { return p_DivisionSender; } + void SetDivisionSender(GOMidiSender *pDivisionSender) { + p_DivisionSender = pDivisionSender; + } + +private: + void InitMidiObject( + GOConfigReader &cfg, const wxString &group, const wxString &name); + +protected: + virtual void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) {} + virtual void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) {} public: - GOMidiObject(GOMidiDialogCreator &dialogCreator) - : r_DialogCreator(dialogCreator) {} + GOMidiMap &GetMidiMap() { return r_MidiMap; } + const wxString &GetMidiTypeCode() const { return r_MidiTypeCode; } + const wxString &GetMidiTypeName() const { return r_MidiTypeName; } + const wxString &GetName() const { return m_name; } + void SetName(const wxString &name) { m_name = name; } + + virtual void Init( + GOConfigReader &cfg, const wxString &group, const wxString &name) { + InitMidiObject(cfg, group, name); + } + + virtual void Load( + GOConfigReader &cfg, const wxString &group, const wxString &name) { + InitMidiObject(cfg, group, name); + } + + virtual void Save(GOConfigWriter &cfg) { + SaveMidiObject(cfg, m_group, r_MidiMap); + } - virtual ~GOMidiObject() {} + virtual bool IsReadOnly() const { return false; } - virtual const wxString &GetMidiTypeCode() const = 0; - virtual const wxString &GetMidiType() const = 0; - virtual const wxString &GetMidiName() const = 0; + void PreparePlayback() override {} + void PrepareRecording() override {} + void AbortPlayback() override {} void ShowConfigDialog(); + // Used in the GOMidiList dialog virtual wxString GetElementStatus() = 0; virtual std::vector GetElementActions() = 0; virtual void TriggerElementActions(unsigned no) = 0; diff --git a/src/grandorgue/midi/objects/GOMidiObjectWithDivision.cpp b/src/grandorgue/midi/objects/GOMidiObjectWithDivision.cpp new file mode 100644 index 000000000..d4025166a --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiObjectWithDivision.cpp @@ -0,0 +1,40 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#include "GOMidiObjectWithDivision.h" + +#include "model/GOOrganModel.h" + +GOMidiObjectWithDivision::GOMidiObjectWithDivision( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType receiverType) + : GOMidiReceivingSendingObject( + organModel, midiTypeCode, midiTypeName, senderType, receiverType), + m_DivisionSender(organModel, MIDI_SEND_MANUAL) { + SetDivisionSender(&m_DivisionSender); +} + +GOMidiObjectWithDivision::~GOMidiObjectWithDivision() { + SetDivisionSender(nullptr); +} + +static const wxString WX_DIVISION = wxT("Division"); + +void GOMidiObjectWithDivision::LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiReceivingSendingObject::LoadMidiObject(cfg, group, midiMap); + m_DivisionSender.Load(cfg, group + WX_DIVISION, midiMap); +} + +void GOMidiObjectWithDivision::SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiReceivingSendingObject::SaveMidiObject(cfg, group, midiMap); + m_DivisionSender.Save(cfg, group + WX_DIVISION, midiMap); +} diff --git a/src/grandorgue/midi/objects/GOMidiObjectWithDivision.h b/src/grandorgue/midi/objects/GOMidiObjectWithDivision.h new file mode 100644 index 000000000..43ec6d818 --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiObjectWithDivision.h @@ -0,0 +1,38 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#ifndef GOMIDIOBJECTWITHDIVISION_H +#define GOMIDIOBJECTWITHDIVISION_H + +#include "GOMidiReceivingSendingObject.h" + +class GOMidiObjectWithDivision : public GOMidiReceivingSendingObject { +private: + GOMidiSender m_DivisionSender; + +protected: + GOMidiObjectWithDivision( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType receiverType); + + ~GOMidiObjectWithDivision(); + + void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) override; + void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override; + + void SendDivisionMidiKey(unsigned key, unsigned value) { + m_DivisionSender.SetKey(key, value); + } + void ResetDivisionMidiKey() { m_DivisionSender.ResetKey(); } +}; + +#endif /* GOMIDIOBJECTWITHDIVISION_H */ diff --git a/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.cpp b/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.cpp new file mode 100644 index 000000000..cd335e402 --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.cpp @@ -0,0 +1,50 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#include "GOMidiObjectWithShortcut.h" + +GOMidiObjectWithShortcut::GOMidiObjectWithShortcut( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType receiverType, + GOMidiShortcutReceiver::ReceiverType shortcutType) + : GOMidiReceivingSendingObject( + organModel, midiTypeCode, midiTypeName, senderType, receiverType), + m_ShortcutReceiver(shortcutType) { + SetMidiShortcutReceiver(&m_ShortcutReceiver); +} + +GOMidiObjectWithShortcut::~GOMidiObjectWithShortcut() { + SetMidiShortcutReceiver(nullptr); +} + +void GOMidiObjectWithShortcut::LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiReceivingSendingObject::LoadMidiObject(cfg, group, midiMap); + if (!IsReadOnly()) { + m_ShortcutReceiver.Load(cfg, group); + } +} + +void GOMidiObjectWithShortcut::SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiReceivingSendingObject::SaveMidiObject(cfg, group, midiMap); + if (!IsReadOnly()) { + m_ShortcutReceiver.Save(cfg, group); + } +} + +void GOMidiObjectWithShortcut::HandleKey(int key) { + if (!IsReadOnly()) { + auto matchType = m_ShortcutReceiver.Match(key); + + if (matchType != GOMidiShortcutReceiver::KEY_MATCH_NONE) + OnShortcutKeyReceived(matchType, key); + } +} diff --git a/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.h b/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.h new file mode 100644 index 000000000..85c28172f --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiObjectWithShortcut.h @@ -0,0 +1,45 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#ifndef GOMIDIOBJECTWITHSHORTCUT_H +#define GOMIDIOBJECTWITHSHORTCUT_H + +#include "midi/GOMidiShortcutReceiver.h" + +#include "GOMidiReceivingSendingObject.h" + +class GOMidiObjectWithShortcut : public GOMidiReceivingSendingObject { +private: + GOMidiShortcutReceiver m_ShortcutReceiver; + + void HandleKey(int key) override; + +protected: + GOMidiObjectWithShortcut( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType receiverType, + GOMidiShortcutReceiver::ReceiverType shortcutType); + + virtual ~GOMidiObjectWithShortcut(); + + void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) override; + void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override; + + virtual void OnShortcutKeyReceived( + GOMidiShortcutReceiver::MatchType matchType, int key) + = 0; + +public: + void SetShortcutKey(unsigned key) { m_ShortcutReceiver.SetShortcut(key); } +}; + +#endif /* GOMIDIOBJECTWITHSHORTCUT_H */ diff --git a/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.cpp b/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.cpp new file mode 100644 index 000000000..4df8a9211 --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.cpp @@ -0,0 +1,68 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#include "GOMidiReceivingSendingObject.h" + +#include "model/GOOrganModel.h" + +GOMidiReceivingSendingObject::GOMidiReceivingSendingObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType reveiverType) + : GOMidiSendingObject(organModel, midiTypeCode, midiTypeName, senderType), + m_receiver(organModel, reveiverType), + p_ReceiverKeyMap(nullptr) { + SetMidiReceiver(&m_receiver); + r_OrganModel.RegisterEventHandler(this); +} + +GOMidiReceivingSendingObject::~GOMidiReceivingSendingObject() { + r_OrganModel.UnRegisterEventHandler(this); + SetMidiReceiver(nullptr); +} + +void GOMidiReceivingSendingObject::LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiSendingObject::LoadMidiObject(cfg, group, midiMap); + if (!IsReadOnly()) { + m_receiver.Load(cfg, group, midiMap); + } +} + +void GOMidiReceivingSendingObject::SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiSendingObject::SaveMidiObject(cfg, group, midiMap); + if (!IsReadOnly()) { + m_receiver.Save(cfg, group, midiMap); + } +} + +void GOMidiReceivingSendingObject::SetElementId(int id) { + if (!IsReadOnly()) { + m_receiver.SetElementID(id); + GOMidiSendingObject::SetElementId(id); + } +} + +void GOMidiReceivingSendingObject::PreparePlayback() { + GOMidiSendingObject::PreparePlayback(); + m_receiver.PreparePlayback(); +} + +void GOMidiReceivingSendingObject::ProcessMidi(const GOMidiEvent &event) { + if (!IsReadOnly()) { + int key; + int value; + GOMidiMatchType matchType + = m_receiver.Match(event, p_ReceiverKeyMap, key, value); + + if (matchType > MIDI_MATCH_NONE) + OnMidiReceived(event, matchType, key, value); + } +} diff --git a/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.h b/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.h new file mode 100644 index 000000000..abdec6144 --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiReceivingSendingObject.h @@ -0,0 +1,62 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#ifndef GOMIDIRECEIVINGSENDINGOBJECT_H +#define GOMIDIRECEIVINGSENDINGOBJECT_H + +#include "midi/GOMidiReceiver.h" + +#include "GOEventHandler.h" +#include "GOMidiSendingObject.h" + +class GOMidiReceivingSendingObject : public GOMidiSendingObject, + private GOEventHandler { +private: + GOMidiReceiver m_receiver; + const GOMidiReceiver::KeyMap *p_ReceiverKeyMap; + +protected: + GOMidiReceivingSendingObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType, + GOMidiReceiverType reveiverType); + + ~GOMidiReceivingSendingObject(); + + const GOMidiReceiver::KeyMap *GetReceiverKeyMap() { return p_ReceiverKeyMap; } + void SetReceiverKeyMap(const GOMidiReceiver::KeyMap *pKeyMap) { + p_ReceiverKeyMap = pKeyMap; + } + +public: + // Should be used before Load() + void SetInitialMidiIndex(unsigned index) { m_receiver.SetIndex(index); } + + virtual void SetElementId(int id) override; + +protected: + virtual void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) override; + virtual void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override; + + void PreparePlayback() override; + +private: + void ProcessMidi(const GOMidiEvent &event) override; + +protected: + virtual void OnMidiReceived( + const GOMidiEvent &event, GOMidiMatchType matchType, int key, int value) + = 0; + + virtual void HandleKey(int key) override {} +}; + +#endif /* GOMIDIRECEIVINGSENDINGOBJECT_H */ diff --git a/src/grandorgue/midi/objects/GOMidiSendingObject.cpp b/src/grandorgue/midi/objects/GOMidiSendingObject.cpp new file mode 100644 index 000000000..aa7262f1a --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiSendingObject.cpp @@ -0,0 +1,46 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#include "GOMidiSendingObject.h" + +#include "model/GOOrganModel.h" + +GOMidiSendingObject::GOMidiSendingObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType) + : GOMidiObject(organModel, midiTypeCode, midiTypeName), + m_sender(organModel, senderType) { + SetMidiSender(&m_sender); +} + +GOMidiSendingObject::~GOMidiSendingObject() { SetMidiSender(nullptr); } + +void GOMidiSendingObject::LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiObject::LoadMidiObject(cfg, group, midiMap); + m_sender.Load(cfg, group, midiMap); +} + +void GOMidiSendingObject::SetElementId(int id) { m_sender.SetElementID(id); } + +void GOMidiSendingObject::SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiObject::SaveMidiObject(cfg, group, midiMap); + m_sender.Save(cfg, group, midiMap); +} + +void GOMidiSendingObject::PreparePlayback() { + GOMidiObject::PreparePlayback(); + m_sender.SetName(GetName()); +} + +void GOMidiSendingObject::AbortPlayback() { + GOMidiObject::AbortPlayback(); + m_sender.SetName(wxEmptyString); +} diff --git a/src/grandorgue/midi/objects/GOMidiSendingObject.h b/src/grandorgue/midi/objects/GOMidiSendingObject.h new file mode 100644 index 000000000..e48e0b431 --- /dev/null +++ b/src/grandorgue/midi/objects/GOMidiSendingObject.h @@ -0,0 +1,50 @@ +/* + * Copyright 2006 Milan Digital Audio LLC + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) + * License GPL-2.0 or later + * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). + */ + +#ifndef GOMIDISENDINGOBJECT_H +#define GOMIDISENDINGOBJECT_H + +#include "midi/GOMidiSender.h" + +#include "GOMidiObject.h" + +class GOOrganModel; + +class GOMidiSendingObject : public GOMidiObject { +private: + GOMidiSender m_sender; + +protected: + GOMidiSendingObject( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName, + GOMidiSenderType senderType); + + ~GOMidiSendingObject(); + + void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) override; + void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override; + + void SendMidiValue(bool value) { m_sender.SetDisplay(value); } + void SendMidiValue(int value) { m_sender.SetValue(value); } + void SendMidiValue(const wxString &value) { m_sender.SetLabel(value); } + void SendMidiKey(unsigned key, unsigned value) { + m_sender.SetKey(key, value); + } + void ResetMidiKey() { m_sender.ResetKey(); } + + void PreparePlayback() override; + void AbortPlayback() override; + +public: + virtual void SetElementId(int id); +}; + +#endif /* GOMIDISENDINGOBJECT_H */ diff --git a/src/grandorgue/model/GOCoupler.cpp b/src/grandorgue/model/GOCoupler.cpp index c9f76eaa5..e247ec71b 100644 --- a/src/grandorgue/model/GOCoupler.cpp +++ b/src/grandorgue/model/GOCoupler.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -15,9 +15,12 @@ #include "GOManual.h" #include "GOOrganModel.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Coupler"); +static const wxString WX_MIDI_TYPE_NAME = _("Coupler"); + GOCoupler::GOCoupler( GOOrganModel &organModel, unsigned sourceManual, bool isVirtual) - : GODrawstop(organModel), + : GODrawstop(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), m_IsVirtual(isVirtual), m_UnisonOff(false), m_CoupleToSubsequentUnisonIntermanualCouplers(false), @@ -84,8 +87,8 @@ const struct IniFileEnumEntry GOCoupler::m_coupler_types[] = { void GOCoupler::Init( GOConfigReader &cfg, - wxString group, - wxString name, + const wxString &group, + const wxString &name, bool unison_off, bool recursive, int keyshift, @@ -397,10 +400,3 @@ bool GOCoupler::IsIntermanual() { } bool GOCoupler::IsUnisonOff() { return m_UnisonOff; } - -const wxString WX_MIDI_TYPE_CODE = wxT("Coupler"); -const wxString WX_MIDI_TYPE = _("Coupler"); - -const wxString &GOCoupler::GetMidiTypeCode() const { return WX_MIDI_TYPE_CODE; } - -const wxString &GOCoupler::GetMidiType() const { return WX_MIDI_TYPE; } diff --git a/src/grandorgue/model/GOCoupler.h b/src/grandorgue/model/GOCoupler.h index d5900b2f2..5e85d3a9a 100644 --- a/src/grandorgue/model/GOCoupler.h +++ b/src/grandorgue/model/GOCoupler.h @@ -66,16 +66,17 @@ class GOCoupler : public GODrawstop { } void SetRecursive(bool isRecursive); + using GODrawstop::Init; // for avoiding a compilation warning void Init( GOConfigReader &cfg, - wxString group, - wxString name, + const wxString &group, + const wxString &name, bool unison_off, bool recursive, int keyshift, int dest_manual, GOCouplerType coupler_type); - void Load(GOConfigReader &cfg, const wxString &group); + void Load(GOConfigReader &cfg, const wxString &group) override; // send key states for all chained couplers void RefreshState(); @@ -86,9 +87,6 @@ class GOCoupler : public GODrawstop { const std::vector &couplers); bool IsIntermanual(); bool IsUnisonOff(); - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif diff --git a/src/grandorgue/model/GODivisionalCoupler.cpp b/src/grandorgue/model/GODivisionalCoupler.cpp index 8110904e4..09e2d66e9 100644 --- a/src/grandorgue/model/GODivisionalCoupler.cpp +++ b/src/grandorgue/model/GODivisionalCoupler.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -15,14 +15,15 @@ #include "GOOrganModel.h" -const wxString GODivisionalCoupler::WX_MIDI_TYPE_CODE - = wxT("DivisionalCoupler"); -const wxString GODivisionalCoupler::WX_MIDI_TYPE_DESC = _("Divisional Coupler"); +static const wxString WX_MIDI_TYPE_CODE = wxT("DivisionalCoupler"); +static const wxString WX_MIDI_TYPE_NAME = _("Divisional Coupler"); GODivisionalCoupler::GODivisionalCoupler(GOOrganModel &organModel) - : GODrawstop(organModel), m_BiDirectionalCoupling(false), m_manuals(0) {} + : GODrawstop(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), + m_BiDirectionalCoupling(false), + m_manuals(0) {} -void GODivisionalCoupler::Load(GOConfigReader &cfg, wxString group) { +void GODivisionalCoupler::Load(GOConfigReader &cfg, const wxString &group) { wxString buffer; m_BiDirectionalCoupling diff --git a/src/grandorgue/model/GODivisionalCoupler.h b/src/grandorgue/model/GODivisionalCoupler.h index 564164d38..c01d2450c 100644 --- a/src/grandorgue/model/GODivisionalCoupler.h +++ b/src/grandorgue/model/GODivisionalCoupler.h @@ -17,9 +17,6 @@ class GOOrganModel; class GODivisionalCoupler : public GODrawstop { private: - static const wxString WX_MIDI_TYPE_CODE; - static const wxString WX_MIDI_TYPE_DESC; - bool m_BiDirectionalCoupling; std::vector m_manuals; @@ -28,7 +25,9 @@ class GODivisionalCoupler : public GODrawstop { public: GODivisionalCoupler(GOOrganModel &organModel); - void Load(GOConfigReader &cfg, wxString group); + + using GODrawstop::Load; // for avoiding a compilation warning + void Load(GOConfigReader &cfg, const wxString &group); /** * If the coupler is engaged and start manual participates in the coupler @@ -37,9 +36,6 @@ class GODivisionalCoupler : public GODrawstop { * @return the resulting set of other manuals */ std::set GetCoupledManuals(unsigned startManual) const; - - const wxString &GetMidiTypeCode() const override { return WX_MIDI_TYPE_CODE; } - const wxString &GetMidiType() const override { return WX_MIDI_TYPE_DESC; } }; #endif /* GODIVISIONALCOUPLER_H */ diff --git a/src/grandorgue/model/GODrawstop.cpp b/src/grandorgue/model/GODrawstop.cpp index 839c2e7ce..6802263fe 100644 --- a/src/grandorgue/model/GODrawstop.cpp +++ b/src/grandorgue/model/GODrawstop.cpp @@ -25,8 +25,12 @@ const struct IniFileEnumEntry GODrawstop::m_function_types[] = { {wxT("Xor"), FUNCTION_XOR}, }; -GODrawstop::GODrawstop(GOOrganModel &organModel) - : GOButtonControl(organModel, MIDI_RECV_DRAWSTOP, false), +GODrawstop::GODrawstop( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName) + : GOButtonControl( + organModel, midiTypeCode, midiTypeName, MIDI_RECV_DRAWSTOP, false), m_Type(FUNCTION_INPUT), m_GCState(0), m_ControlledDrawstops(), diff --git a/src/grandorgue/model/GODrawstop.h b/src/grandorgue/model/GODrawstop.h index 065d80071..206d171d7 100644 --- a/src/grandorgue/model/GODrawstop.h +++ b/src/grandorgue/model/GODrawstop.h @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -68,7 +68,10 @@ class GODrawstop : public GOButtonControl, virtual public GOCombinationElement { void StartPlayback() override; public: - GODrawstop(GOOrganModel &organModel); + GODrawstop( + GOOrganModel &organModel, + const wxString &midiTypeCode, + const wxString &midiTypeName); /* + For tests only */ GOFunctionType GetFunctionType() const { return m_Type; } @@ -83,8 +86,10 @@ class GODrawstop : public GOButtonControl, virtual public GOCombinationElement { bool IsToStoreInGeneral() const { return m_IsToStoreInGeneral; } bool GetCombinationState() const override { return IsEngaged(); } - void Init(GOConfigReader &cfg, const wxString &group, const wxString &name); - void Load(GOConfigReader &cfg, const wxString &group); + void Init( + GOConfigReader &cfg, const wxString &group, const wxString &name) override; + + void Load(GOConfigReader &cfg, const wxString &group) override; void RegisterControlled(GODrawstop *sw); void UnRegisterControlled(GODrawstop *sw); virtual void SetButtonState(bool on) override; diff --git a/src/grandorgue/model/GOEnclosure.cpp b/src/grandorgue/model/GOEnclosure.cpp index ed624a35d..782b1714e 100644 --- a/src/grandorgue/model/GOEnclosure.cpp +++ b/src/grandorgue/model/GOEnclosure.cpp @@ -9,50 +9,33 @@ #include -#include "config/GOConfig.h" #include "config/GOConfigReader.h" #include "config/GOConfigWriter.h" #include "GOOrganModel.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Enclosure"); +static const wxString WX_MIDI_TYPE_NAME = _("Enclosure"); + GOEnclosure::GOEnclosure(GOOrganModel &organModel) - : GOMidiObject(organModel), - r_OrganModel(organModel), - r_MidiMap(organModel.GetConfig().GetMidiMap()), - m_midi(organModel, MIDI_RECV_ENCLOSURE), - m_sender(organModel, MIDI_SEND_ENCLOSURE), - m_shortcut(GOMidiShortcutReceiver::KEY_RECV_ENCLOSURE), - m_Name(), + : GOMidiObjectWithShortcut( + organModel, + WX_MIDI_TYPE_CODE, + WX_MIDI_TYPE_NAME, + MIDI_SEND_ENCLOSURE, + MIDI_RECV_ENCLOSURE, + GOMidiShortcutReceiver::KEY_RECV_ENCLOSURE), m_DefaultAmpMinimumLevel(0), m_MIDIInputNumber(0), m_Displayed1(false), m_Displayed2(false), m_AmpMinimumLevel(0), - m_MIDIValue(0) { - organModel.RegisterEventHandler(this); - organModel.RegisterMidiConfigurator(this); - organModel.RegisterSoundStateHandler(this); -} - -void GOEnclosure::Init( - GOConfigReader &cfg, - const wxString &group, - const wxString &name, - uint8_t defaultValue) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = name; - m_DefaultAmpMinimumLevel = 0; - LoadFromCmb(cfg, defaultValue); -} + m_MIDIValue(0) {} static const wxString WX_AMP_MINIMUM_LEVEL = wxT("AmpMinimumLevel"); static const wxString WX_VALUE = wxT("Value"); void GOEnclosure::LoadFromCmb(GOConfigReader &cfg, uint8_t defaultValue) { - m_midi.Load(cfg, m_group, r_MidiMap); - m_sender.Load(cfg, m_group, r_MidiMap); - m_shortcut.Load(cfg, m_group); m_AmpMinimumLevel = cfg.ReadInteger( CMBSetting, m_group, @@ -61,39 +44,47 @@ void GOEnclosure::LoadFromCmb(GOConfigReader &cfg, uint8_t defaultValue) { 100, false, m_DefaultAmpMinimumLevel); - SetMidiValue(cfg.ReadInteger( + SetEnclosureValue(cfg.ReadInteger( CMBSetting, m_group, WX_VALUE, 0, MAX_MIDI_VALUE, false, defaultValue)); } +void GOEnclosure::Init( + GOConfigReader &cfg, + const wxString &group, + const wxString &name, + uint8_t defaultValue) { + m_MIDIInputNumber = 0; + GOMidiReceivingSendingObject::Init(cfg, group, name); + m_DefaultAmpMinimumLevel = 0; + LoadFromCmb(cfg, defaultValue); +} + void GOEnclosure::Load( - GOConfigReader &cfg, const wxString &group, int enclosure_nb) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_Name = cfg.ReadStringNotEmpty(ODFSetting, m_group, wxT("Name")); + GOConfigReader &cfg, const wxString &group, int enclosureNb) { + SetInitialMidiIndex(enclosureNb); // Used in LoadMidiObject + m_MIDIInputNumber = cfg.ReadInteger( + ODFSetting, group, wxT("MIDIInputNumber"), 0, 200, false, 0); + GOMidiReceivingSendingObject::Load( + cfg, group, cfg.ReadStringNotEmpty(ODFSetting, group, wxT("Name"))); m_Displayed1 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, true); m_Displayed2 = cfg.ReadBoolean(ODFSetting, m_group, wxT("Displayed"), false, false); m_DefaultAmpMinimumLevel = cfg.ReadInteger(ODFSetting, m_group, WX_AMP_MINIMUM_LEVEL, 0, 100); - m_MIDIInputNumber = cfg.ReadInteger( - ODFSetting, m_group, wxT("MIDIInputNumber"), 0, 200, false, 0); - m_midi.SetIndex(enclosure_nb); LoadFromCmb(cfg, MAX_MIDI_VALUE); } void GOEnclosure::Save(GOConfigWriter &cfg) { - m_midi.Save(cfg, m_group, r_MidiMap); - m_sender.Save(cfg, m_group, r_MidiMap); - m_shortcut.Save(cfg, m_group); + GOMidiReceivingSendingObject::Save(cfg); cfg.WriteInteger(m_group, WX_AMP_MINIMUM_LEVEL, m_AmpMinimumLevel); cfg.WriteInteger(m_group, WX_VALUE, m_MIDIValue); } -void GOEnclosure::SetMidiValue(uint8_t n) { +void GOEnclosure::SetEnclosureValue(uint8_t n) { if (n != m_MIDIValue) { m_MIDIValue = n; - m_sender.SetValue(n); + SendMidiValue(m_MIDIValue); } r_OrganModel.UpdateVolume(); r_OrganModel.SendControlChanged(this); @@ -106,24 +97,24 @@ float GOEnclosure::GetAttenuation() { } void GOEnclosure::Scroll(bool scroll_up) { - SetIntMidiValue(m_MIDIValue + (scroll_up ? 4 : -4)); + SetIntEnclosureValue(m_MIDIValue + (scroll_up ? 4 : -4)); } -void GOEnclosure::ProcessMidi(const GOMidiEvent &event) { - int value; - - if (m_midi.Match(event, value) == MIDI_MATCH_CHANGE) - SetIntMidiValue(value); +void GOEnclosure::OnMidiReceived( + const GOMidiEvent &event, GOMidiMatchType matchType, int key, int value) { + if (matchType == MIDI_MATCH_CHANGE) + SetEnclosureValue(value); } -void GOEnclosure::HandleKey(int key) { - switch (m_shortcut.Match(key)) { +void GOEnclosure::OnShortcutKeyReceived( + GOMidiShortcutReceiver::MatchType matchType, int key) { + switch (matchType) { case GOMidiShortcutReceiver::KEY_MATCH: - SetIntMidiValue(m_MIDIValue + 8); + SetIntEnclosureValue(m_MIDIValue + 8); break; case GOMidiShortcutReceiver::KEY_MATCH_MINUS: - SetIntMidiValue(m_MIDIValue - 8); + SetIntEnclosureValue(m_MIDIValue - 8); break; default: break; @@ -137,32 +128,16 @@ bool GOEnclosure::IsDisplayed(bool new_format) { return m_Displayed1; } -void GOEnclosure::AbortPlayback() { - m_sender.SetValue(0); - m_sender.SetName(wxEmptyString); -} - -void GOEnclosure::PreparePlayback() { - m_midi.PreparePlayback(); - m_sender.SetName(m_Name); -} - -void GOEnclosure::PrepareRecording() { m_sender.SetValue(m_MIDIValue); } - -void GOEnclosure::SetElementID(int id) { - m_midi.SetElementID(id); - m_sender.SetElementID(id); +void GOEnclosure::PrepareRecording() { + GOMidiReceivingSendingObject::PrepareRecording(); + SendMidiValue(m_MIDIValue); } -const wxString WX_MIDI_TYPE_CODE = wxT("Enclosure"); -const wxString WX_MIDI_TYPE = _("Enclosure"); - -const wxString &GOEnclosure::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; +void GOEnclosure::AbortPlayback() { + SendMidiValue(0); + GOMidiReceivingSendingObject::AbortPlayback(); } -const wxString &GOEnclosure::GetMidiType() const { return WX_MIDI_TYPE; } - wxString GOEnclosure::GetElementStatus() { return wxString::Format(_("%.3f %%"), (m_MIDIValue * 100.0 / 127)); } diff --git a/src/grandorgue/model/GOEnclosure.h b/src/grandorgue/model/GOEnclosure.h index e772c1918..09f18cd04 100644 --- a/src/grandorgue/model/GOEnclosure.h +++ b/src/grandorgue/model/GOEnclosure.h @@ -14,34 +14,14 @@ #include #include "control/GOControl.h" -#include "midi/GOMidiReceiver.h" -#include "midi/GOMidiSender.h" -#include "midi/GOMidiShortcutReceiver.h" -#include "midi/objects/GOMidiObject.h" -#include "sound/GOSoundStateHandler.h" - -#include "GOEventHandler.h" -#include "GOSaveableObject.h" +#include "midi/objects/GOMidiObjectWithShortcut.h" class GOConfigReader; class GOConfigWriter; -class GOMidiEvent; -class GOMidiMap; class GOOrganModel; -class GOEnclosure : public GOControl, - private GOEventHandler, - private GOSaveableObject, - private GOSoundStateHandler, - public GOMidiObject { +class GOEnclosure : public GOControl, public GOMidiObjectWithShortcut { private: - GOOrganModel &r_OrganModel; - GOMidiMap &r_MidiMap; - - GOMidiReceiver m_midi; - GOMidiSender m_sender; - GOMidiShortcutReceiver m_shortcut; - wxString m_Name; uint8_t m_DefaultAmpMinimumLevel; uint8_t m_MIDIInputNumber; bool m_Displayed1; @@ -50,55 +30,47 @@ class GOEnclosure : public GOControl, uint8_t m_AmpMinimumLevel; uint8_t m_MIDIValue; - void ProcessMidi(const GOMidiEvent &event) override; - void HandleKey(int key) override; + void OnMidiReceived( + const GOMidiEvent &event, + GOMidiMatchType matchType, + int key, + int value) override; + void OnShortcutKeyReceived( + GOMidiShortcutReceiver::MatchType matchType, int key) override; // Load all customizable values from the .cmb file void LoadFromCmb(GOConfigReader &cfg, uint8_t defaultValue); void Save(GOConfigWriter &cfg) override; - void AbortPlayback() override; - void PreparePlayback() override; - void PrepareRecording() override; + void SetIntEnclosureValue(int n) { SetEnclosureValue(std::clamp(n, 0, 127)); } - GOMidiReceiverBase *GetMidiReceiver() override { return &m_midi; } - GOMidiSender *GetMidiSender() override { return &m_sender; } - GOMidiShortcutReceiver *GetMidiShortcutReceiver() override { - return &m_shortcut; - } + void PrepareRecording() override; + void AbortPlayback() override; public: static constexpr uint8_t MAX_MIDI_VALUE = 127; GOEnclosure(GOOrganModel &organModel); + + using GOMidiObjectWithShortcut::Init; // for avoiding a warning void Init( GOConfigReader &cfg, const wxString &group, const wxString &name, - uint8_t defaultValue); - void Load(GOConfigReader &cfg, const wxString &group, int enclosure_nb); - const wxString &GetName() const { return m_Name; } - uint8_t GetAmpMinimumLevel() const { return m_AmpMinimumLevel; } - void SetAmpMinimumLevel(uint8_t v) { m_AmpMinimumLevel = v; } - uint8_t GetMIDIInputNumber() const { return m_MIDIInputNumber; } - uint8_t GetMidiValue() const { return m_MIDIValue; } - void SetMidiValue(uint8_t n); - void SetIntMidiValue(int n) { - SetMidiValue((uint8_t)std::clamp(n, 0, (int)MAX_MIDI_VALUE)); - } + uint8_t defValue); + using GOMidiObject::Load; // for avoiding a warning + void Load(GOConfigReader &cfg, const wxString &group, int enclosureNb); + void SetEnclosureValue(uint8_t n); + int GetEnclosureValue() const { return m_MIDIValue; } + int GetMIDIInputNumber() const { return m_MIDIInputNumber; } float GetAttenuation(); void Scroll(bool scroll_up); bool IsDisplayed(bool new_format); - void SetElementID(int id); - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; - const wxString &GetMidiName() const override { return GetName(); } wxString GetElementStatus() override; std::vector GetElementActions() override; void TriggerElementActions(unsigned no) override; }; -#endif /* GOENCLOSURE_H_ */ +#endif /* GOENCLOSURE_H_ */ \ No newline at end of file diff --git a/src/grandorgue/model/GOEventHandlerList.cpp b/src/grandorgue/model/GOEventHandlerList.cpp index cd4d16171..704f06faa 100644 --- a/src/grandorgue/model/GOEventHandlerList.cpp +++ b/src/grandorgue/model/GOEventHandlerList.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -18,7 +18,7 @@ void GOEventHandlerList::Cleanup() { m_CacheObjects.Clear(); m_CombinationButtonSets.Clear(); m_ControlChangedHandlers.Clear(); - m_MidiConfigurators.Clear(); + m_MidiObjects.Clear(); m_MidiEventHandlers.Clear(); m_SoundStateHandlers.Clear(); m_SaveableObjects.Clear(); diff --git a/src/grandorgue/model/GOEventHandlerList.h b/src/grandorgue/model/GOEventHandlerList.h index de8b2ac14..0d3d91d16 100644 --- a/src/grandorgue/model/GOEventHandlerList.h +++ b/src/grandorgue/model/GOEventHandlerList.h @@ -61,7 +61,7 @@ class GOEventHandlerList { UPVector m_ReferencingObjects; UPVector m_CombinationButtonSets; UPVector m_ControlChangedHandlers; - UPVector m_MidiConfigurators; + UPVector m_MidiObjects; UPVector m_MidiEventHandlers; UPVector m_SoundStateHandlers; UPVector m_SaveableObjects; @@ -78,7 +78,7 @@ class GOEventHandlerList { return m_CombinationButtonSets.AsVector(); } const std::vector &GetMidiConfigurators() const { - return m_MidiConfigurators.AsVector(); + return m_MidiObjects.AsVector(); } const std::vector &GetMidiEventHandlers() const { return m_MidiEventHandlers.AsVector(); @@ -104,6 +104,10 @@ class GOEventHandlerList { m_CombinationButtonSets.Add(obj); } + void UnRegisterCombinationButtonSet(GOCombinationButtonSet *obj) { + m_CombinationButtonSets.Remove(obj); + } + void RegisterControlChangedHandler(GOControlChangedHandler *handler) { m_ControlChangedHandlers.Add(handler); } @@ -112,14 +116,18 @@ class GOEventHandlerList { m_ControlChangedHandlers.Remove(handler); } - void RegisterMidiConfigurator(GOMidiObject *obj) { - m_MidiConfigurators.Add(obj); - } + void RegisterMidiObject(GOMidiObject *obj) { m_MidiObjects.Add(obj); } + + void UnRegisterMidiObject(GOMidiObject *obj) { m_MidiObjects.Remove(obj); } void RegisterEventHandler(GOEventHandler *handler) { m_MidiEventHandlers.Add(handler); } + void UnRegisterEventHandler(GOEventHandler *handler) { + m_MidiEventHandlers.Remove(handler); + } + void RegisterSoundStateHandler(GOSoundStateHandler *handler) { m_SoundStateHandlers.Add(handler); } diff --git a/src/grandorgue/model/GOManual.cpp b/src/grandorgue/model/GOManual.cpp index 64491542c..908f9b538 100644 --- a/src/grandorgue/model/GOManual.cpp +++ b/src/grandorgue/model/GOManual.cpp @@ -20,14 +20,16 @@ #include "GOSwitch.h" #include "GOTremulant.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Manual"); +static const wxString WX_MIDI_TYPE_NAME = _("Manual"); + GOManual::GOManual(GOOrganModel &organModel) - : GOMidiObject(organModel), - r_OrganModel(organModel), - r_MidiMap(organModel.GetConfig().GetMidiMap()), - m_group(wxT("---")), - m_midi(organModel, MIDI_RECV_MANUAL), - m_sender(organModel, MIDI_SEND_MANUAL), - m_division(organModel, MIDI_SEND_MANUAL), + : GOMidiObjectWithDivision( + organModel, + WX_MIDI_TYPE_CODE, + WX_MIDI_TYPE_NAME, + MIDI_SEND_MANUAL, + MIDI_RECV_MANUAL), m_InputCouplers(), m_KeyVelocity(0), m_RemoteVelocity(), @@ -43,18 +45,20 @@ GOManual::GOManual(GOOrganModel &organModel) m_MIDIInputNumber(0), m_tremulant_ids(0), m_GlobalSwitchIds(0), - m_name(), m_stops(0), m_couplers(0), m_divisionals(0), m_ODFCouplerCount(0), m_displayed(false), m_DivisionalTemplate(organModel) { + SetReceiverKeyMap(&m_MidiKeyMap); m_InputCouplers.push_back(NULL); - organModel.RegisterCombinationButtonSet(this); - organModel.RegisterEventHandler(this); - organModel.RegisterMidiConfigurator(this); - organModel.RegisterSoundStateHandler(this); + r_OrganModel.RegisterCombinationButtonSet(this); +} + +GOManual::~GOManual(void) { + r_OrganModel.UnRegisterCombinationButtonSet(this); + SetReceiverKeyMap(nullptr); } unsigned GOManual::RegisterCoupler(GOCoupler *coupler) { @@ -74,22 +78,23 @@ void GOManual::Resize() { void GOManual::Init( GOConfigReader &cfg, - wxString group, + const wxString &group, int manualNumber, - unsigned first_midi, + unsigned firstMidi, unsigned keys) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_name = wxString::Format( - _("Coupling manual %d"), - manualNumber - r_OrganModel.GetODFManualCount() + 1); + m_manual_number = manualNumber; + m_MIDIInputNumber = 0; + GOMidiReceivingSendingObject::Init( + cfg, + group, + wxString::Format( + _("Coupling manual %d"), + manualNumber - r_OrganModel.GetODFManualCount() + 1)); m_nb_logical_keys = keys; m_first_accessible_logical_key_nb = 1; - m_first_accessible_key_midi_note_nb = first_midi; + m_first_accessible_key_midi_note_nb = firstMidi; m_nb_accessible_keys = keys; - m_MIDIInputNumber = 0; m_displayed = false; - m_manual_number = manualNumber; for (unsigned i = 0; i < GOMidiReceiver::KEY_MAP_SIZE; i++) m_MidiKeyMap[i] = (uint8_t)i; @@ -99,11 +104,8 @@ void GOManual::Init( m_tremulant_ids.resize(0); m_GlobalSwitchIds.resize(0); m_divisionals.resize(0); - m_midi.Load(cfg, group, r_MidiMap); - m_sender.Load(cfg, group, r_MidiMap); - m_division.Load(cfg, group + wxT("Division"), r_MidiMap); - SetElementID(r_OrganModel.GetRecorderElementID( + SetElementId(r_OrganModel.GetRecorderElementID( wxString::Format(wxT("M%d"), m_manual_number))); Resize(); @@ -113,9 +115,12 @@ void GOManual::Init( void GOManual::Load( GOConfigReader &cfg, const wxString &group, int manualNumber) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; - m_name = cfg.ReadStringNotEmpty(ODFSetting, group, wxT("Name")); + m_manual_number = manualNumber; + SetInitialMidiIndex(manualNumber); // Used in LoadMidiObject + m_MIDIInputNumber = cfg.ReadInteger( + ODFSetting, group, wxT("MIDIInputNumber"), 0, 200, false, 0); + GOMidiReceivingSendingObject::Load( + cfg, group, cfg.ReadStringNotEmpty(ODFSetting, group, wxT("Name"))); m_nb_logical_keys = cfg.ReadInteger(ODFSetting, group, wxT("NumberOfLogicalKeys"), 1, 192); m_first_accessible_logical_key_nb = cfg.ReadInteger( @@ -128,8 +133,6 @@ void GOManual::Load( ODFSetting, group, wxT("FirstAccessibleKeyMIDINoteNumber"), 0, 127); m_nb_accessible_keys = cfg.ReadInteger(ODFSetting, group, wxT("NumberOfAccessibleKeys"), 0, 85); - m_MIDIInputNumber = cfg.ReadInteger( - ODFSetting, group, wxT("MIDIInputNumber"), 0, 200, false, 0); m_displayed = cfg.ReadBoolean(ODFSetting, group, wxT("Displayed"), false, false); unsigned nb_stops @@ -150,9 +153,6 @@ void GOManual::Load( 0, r_OrganModel.GetSwitchCount(), false); - m_manual_number = manualNumber; - - m_midi.SetIndex(manualNumber); for (unsigned i = 0; i < GOMidiReceiver::KEY_MAP_SIZE; i++) m_MidiKeyMap[i] = (uint8_t)cfg.ReadInteger( @@ -175,7 +175,7 @@ void GOManual::Load( wxT("Stop%03d"), cfg.ReadInteger(ODFSetting, group, buffer, 1, 999)); cfg.MarkGroupInUse(buffer); m_stops[i]->Load(cfg, buffer); - m_stops[i]->SetElementID(r_OrganModel.GetRecorderElementID( + m_stops[i]->SetElementId(r_OrganModel.GetRecorderElementID( wxString::Format(wxT("M%dS%d"), m_manual_number, i))); } @@ -187,7 +187,7 @@ void GOManual::Load( wxT("Coupler%03d"), cfg.ReadInteger(ODFSetting, group, buffer, 1, 999)); cfg.MarkGroupInUse(buffer); m_couplers[i]->Load(cfg, buffer); - m_couplers[i]->SetElementID(r_OrganModel.GetRecorderElementID( + m_couplers[i]->SetElementId(r_OrganModel.GetRecorderElementID( wxString::Format(wxT("M%dC%d"), m_manual_number, i))); } @@ -221,11 +221,7 @@ void GOManual::Load( ->AssociateWithManual(m_manual_number, i); } - m_midi.Load(cfg, group, r_MidiMap); - m_sender.Load(cfg, group, r_MidiMap); - m_division.Load(cfg, group + wxT("Division"), r_MidiMap); - - SetElementID(r_OrganModel.GetRecorderElementID( + SetElementId(r_OrganModel.GetRecorderElementID( wxString::Format(wxT("M%d"), m_manual_number))); Resize(); @@ -268,7 +264,7 @@ void GOManual::SetOutput(unsigned note, unsigned velocity) { int midi_note = note + m_first_accessible_key_midi_note_nb - m_first_accessible_logical_key_nb + 1; if (midi_note >= 0 && midi_note < 127) - m_division.SetKey(midi_note, velocity); + SendDivisionMidiKey(midi_note, velocity); } void GOManual::PropagateKeyToCouplers(unsigned note) { @@ -314,7 +310,7 @@ void GOManual::Set(unsigned note, unsigned velocity) { if (m_KeyVelocity[note - m_first_accessible_key_midi_note_nb] == velocity) return; m_KeyVelocity[note - m_first_accessible_key_midi_note_nb] = velocity; - m_sender.SetKey(note, velocity); + SendMidiKey(note, velocity); if (velocity) velocity = (velocity << 2) + 3; SetKey( @@ -336,8 +332,6 @@ void GOManual::SetUnisonOff(bool on) { SetOutput(note, on ? m_RemoteVelocity[note] : m_Velocity[note]); } -GOManual::~GOManual(void) {} - int GOManual::GetMIDIInputNumber() { return m_MIDIInputNumber; } unsigned GOManual::GetLogicalKeyCount() { return m_nb_logical_keys; } @@ -468,22 +462,11 @@ bool GOManual::IsKeyDown(unsigned midiNoteNumber) { bool GOManual::IsDisplayed() { return m_displayed; } -void GOManual::Save(GOConfigWriter &cfg) { - m_midi.Save(cfg, m_group, r_MidiMap); - m_sender.Save(cfg, m_group, r_MidiMap); - m_division.Save(cfg, m_group + wxT("Division"), r_MidiMap); -} - -void GOManual::AbortPlayback() { - AllNotesOff(); - m_sender.SetName(wxEmptyString); -} - void GOManual::PreparePlayback() { - m_midi.PreparePlayback(); + GOMidiReceivingSendingObject::PreparePlayback(); m_KeyVelocity.resize(m_nb_accessible_keys); std::fill(m_KeyVelocity.begin(), m_KeyVelocity.end(), 0x00); - m_division.ResetKey(); + ResetDivisionMidiKey(); m_UnisonOff = 0; for (unsigned i = 0; i < m_Velocity.size(); i++) m_Velocity[i] = 0; @@ -494,15 +477,19 @@ void GOManual::PreparePlayback() { for (unsigned i = 0; i < m_Velocities.size(); i++) for (unsigned j = 0; j < m_Velocities[i].size(); j++) m_Velocities[i][j] = 0; - m_sender.SetName(m_name); } void GOManual::PrepareRecording() { - m_sender.ResetKey(); + ResetMidiKey(); + GOMidiReceivingSendingObject::PrepareRecording(); for (unsigned i = 0; i < m_KeyVelocity.size(); i++) if (m_KeyVelocity[i] > 0) - m_sender.SetKey( - i + m_first_accessible_key_midi_note_nb, m_KeyVelocity[i]); + SendMidiKey(i + m_first_accessible_key_midi_note_nb, m_KeyVelocity[i]); +} + +void GOManual::AbortPlayback() { + AllNotesOff(); + GOMidiReceivingSendingObject::AbortPlayback(); } void GOManual::Update() { @@ -513,10 +500,9 @@ void GOManual::Update() { m_couplers[i]->Update(); } -void GOManual::ProcessMidi(const GOMidiEvent &event) { - int key, value; - - switch (m_midi.Match(event, &m_MidiKeyMap, key, value)) { +void GOManual::OnMidiReceived( + const GOMidiEvent &event, GOMidiMatchType matchType, int key, int value) { + switch (matchType) { case MIDI_MATCH_ON: if (value <= 0) value = 1; @@ -548,18 +534,6 @@ void GOManual::Reset() { GetStop(j)->Reset(); } -void GOManual::SetElementID(int id) { - m_midi.SetElementID(id); - m_sender.SetElementID(id); -} - -const wxString WX_MIDI_TYPE_CODE = wxT("Manual"); -const wxString WX_MIDI_TYPE = _("Manual"); - -const wxString &GOManual::GetMidiTypeCode() const { return WX_MIDI_TYPE_CODE; } - -const wxString &GOManual::GetMidiType() const { return WX_MIDI_TYPE; } - wxString GOManual::GetElementStatus() { return _("-"); } std::vector GOManual::GetElementActions() { diff --git a/src/grandorgue/model/GOManual.h b/src/grandorgue/model/GOManual.h index dab73b298..2be9052e9 100644 --- a/src/grandorgue/model/GOManual.h +++ b/src/grandorgue/model/GOManual.h @@ -15,16 +15,9 @@ #include "combinations/control/GOCombinationButtonSet.h" #include "combinations/model/GOCombinationDefinition.h" #include "control/GOControl.h" -#include "midi/GOMidiReceiver.h" -#include "midi/GOMidiSender.h" -#include "midi/objects/GOMidiObject.h" -#include "sound/GOSoundStateHandler.h" - -#include "GOEventHandler.h" -#include "GOSaveableObject.h" +#include "midi/objects/GOMidiObjectWithDivision.h" class GOConfigReader; -class GOConfigWriter; class GOCoupler; class GODivisionalButtonControl; class GOStop; @@ -33,19 +26,9 @@ class GOTremulant; class GOOrganModel; class GOManual : public GOControl, - private GOEventHandler, - private GOCombinationButtonSet, - private GOSaveableObject, - private GOSoundStateHandler, - public GOMidiObject { + public GOMidiObjectWithDivision, + private GOCombinationButtonSet { private: - GOOrganModel &r_OrganModel; - GOMidiMap &r_MidiMap; - - wxString m_group; - GOMidiReceiver m_midi; - GOMidiSender m_sender; - GOMidiSender m_division; std::vector m_InputCouplers; /* Keyboard state */ std::vector m_KeyVelocity; @@ -69,8 +52,6 @@ class GOManual : public GOControl, // Global Switch Id is the number of switch in ODF started with 1 std::vector m_GlobalSwitchIds; - wxString m_name; - ptr_vector m_stops; ptr_vector m_couplers; ptr_vector m_divisionals; @@ -80,12 +61,11 @@ class GOManual : public GOControl, void Resize(); - void ProcessMidi(const GOMidiEvent &event) override; + void OnMidiReceived( + const GOMidiEvent &event, GOMidiMatchType matchType, int key, int value); void HandleKey(int key) override; void SetOutput(unsigned note, unsigned velocity); - void Save(GOConfigWriter &cfg) override; - void AbortPlayback() override; void PreparePlayback() override; void PrepareRecording() override; @@ -98,22 +78,20 @@ class GOManual : public GOControl, void UpdateAllButtonsLight( GOButtonControl *buttonToLight, int manualIndexOnlyFor) override; -protected: - GOMidiReceiverBase *GetMidiReceiver() override { return &m_midi; } - GOMidiSender *GetMidiSender() override { return &m_sender; } - GOMidiSender *GetDivision() override { return &m_division; } - public: GOManual(GOOrganModel &organModel); + ~GOManual(); unsigned GetManulNumber() const { return m_manual_number; } + using GOMidiReceivingSendingObject::Init; // avoiding a compilation warning void Init( GOConfigReader &cfg, - wxString group, + const wxString &group, int manualNumber, - unsigned first_midi, + unsigned firstMidi, unsigned keys); + using GOMidiObject::Load; // avoiding a compilation warning void Load(GOConfigReader &cfg, const wxString &group, int manualNumber); void LoadDivisionals(GOConfigReader &cfg); unsigned RegisterCoupler(GOCoupler *coupler); @@ -124,8 +102,6 @@ class GOManual : public GOControl, void SetUnisonOff(bool on); void Update(); void Reset(); - void SetElementID(int id); - ~GOManual(void); unsigned GetNumberOfAccessibleKeys(); unsigned GetFirstAccessibleKeyMIDINoteNumber(); @@ -177,11 +153,7 @@ class GOManual : public GOControl, int FindSwitchByName(const wxString &name) const; GOCombinationDefinition &GetDivisionalTemplate(); - const wxString &GetName() const { return m_name; } bool IsDisplayed(); - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; - const wxString &GetMidiName() const override { return GetName(); } wxString GetElementStatus() override; std::vector GetElementActions() override; diff --git a/src/grandorgue/model/GOOrganModel.cpp b/src/grandorgue/model/GOOrganModel.cpp index 1346a2b2a..3aefeb12f 100644 --- a/src/grandorgue/model/GOOrganModel.cpp +++ b/src/grandorgue/model/GOOrganModel.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -160,15 +160,15 @@ void GOOrganModel::Load(GOConfigReader &cfg) { } for (unsigned i = 0; i < m_enclosures.size(); i++) - m_enclosures[i]->SetElementID( + m_enclosures[i]->SetElementId( GetRecorderElementID(wxString::Format(wxT("E%d"), i))); for (unsigned i = 0; i < m_switches.size(); i++) - m_switches[i]->SetElementID( + m_switches[i]->SetElementId( GetRecorderElementID(wxString::Format(wxT("S%d"), i))); for (unsigned i = 0; i < m_tremulants.size(); i++) - m_tremulants[i]->SetElementID( + m_tremulants[i]->SetElementId( GetRecorderElementID(wxString::Format(wxT("T%d"), i))); for (GOReferencingObject *pObj : GetReferencingObjects()) diff --git a/src/grandorgue/model/GORank.cpp b/src/grandorgue/model/GORank.cpp index 158f9a9fd..11bb01bad 100644 --- a/src/grandorgue/model/GORank.cpp +++ b/src/grandorgue/model/GORank.cpp @@ -11,7 +11,6 @@ #include -#include "config/GOConfig.h" #include "config/GOConfigReader.h" #include "GODummyPipe.h" @@ -20,12 +19,13 @@ #include "GOSoundingPipe.h" #include "GOWindchest.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Rank"); +static const wxString WX_MIDI_TYPE_NAME = _("Rank"); + GORank::GORank(GOOrganModel &organModel) - : GOMidiObject(organModel), + : GOMidiSendingObject( + organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME, MIDI_SEND_MANUAL), r_OrganModel(organModel), - r_MidiMap(organModel.GetConfig().GetMidiMap()), - m_Name(), - m_Pipes(), m_StopCount(0), m_NoteStopVelocities(), m_MaxNoteVelocities(), @@ -35,13 +35,12 @@ GORank::GORank(GOOrganModel &organModel) m_MinVolume(100), m_MaxVolume(100), m_RetuneRank(true), - m_sender(organModel, MIDI_SEND_MANUAL), - m_PipeConfig(NULL, &organModel, NULL) { - r_OrganModel.RegisterMidiConfigurator(this); - r_OrganModel.RegisterSoundStateHandler(this); -} + m_PipeConfig(NULL, &organModel, NULL) {} -GORank::~GORank() {} +void GORank::LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiSendingObject::LoadMidiObject(cfg, group + wxT("Rank"), midiMap); +} void GORank::Resize() { m_MaxNoteVelocities.resize(m_Pipes.size()); @@ -56,12 +55,9 @@ void GORank::Init( const wxString &name, unsigned firstMidiNoteNumber, unsigned windchestN) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; + GOMidiSendingObject::Init(cfg, group, name); m_FirstMidiNoteNumber = firstMidiNoteNumber; - m_Name = name; - m_PipeConfig.Init(cfg, group, wxEmptyString); m_WindchestN = windchestN; m_HarmonicNumber = 8; @@ -75,15 +71,14 @@ void GORank::Init( m_PipeConfig.SetParent(&windchest->GetPipeConfig()); m_Pipes.clear(); - m_sender.Load(cfg, group + wxT("Rank"), r_MidiMap); m_PipeConfig.SetName(GetName()); Resize(); } void GORank::Load( GOConfigReader &cfg, const wxString &group, int defaultFirstMidiNoteNumber) { - r_OrganModel.RegisterSaveableObject(this); - m_group = group; + GOMidiSendingObject::Load( + cfg, group, cfg.ReadString(ODFSetting, group, wxT("Name"), true)); m_FirstMidiNoteNumber = cfg.ReadInteger( ODFSetting, @@ -93,7 +88,6 @@ void GORank::Load( 256, defaultFirstMidiNoteNumber < 0, std::max(defaultFirstMidiNoteNumber, 0)); - m_Name = cfg.ReadString(ODFSetting, group, wxT("Name"), true); unsigned number_of_logical_pipes = cfg.ReadInteger(ODFSetting, group, wxT("NumberOfLogicalPipes"), 1, 192); @@ -142,20 +136,20 @@ void GORank::Load( } m_Pipes[i]->Load(cfg, group, buffer); } - m_sender.Load(cfg, group + wxT("Rank"), r_MidiMap); m_PipeConfig.SetName(GetName()); Resize(); } +void GORank::SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) { + GOMidiSendingObject::SaveMidiObject(cfg, group + wxT("Rank"), midiMap); +} + void GORank::AddPipe(GOPipe *pipe) { m_Pipes.push_back(pipe); Resize(); } -void GORank::Save(GOConfigWriter &cfg) { - m_sender.Save(cfg, m_group + wxT("Rank"), r_MidiMap); -} - unsigned GORank::RegisterStop(GOStop *stop) { unsigned id = m_StopCount++; Resize(); @@ -192,29 +186,16 @@ void GORank::SetTemperament(const GOTemperament &temperament) { m_Pipes[j]->SetTemperament(temperament); } -void GORank::AbortPlayback() { m_sender.SetName(wxEmptyString); } - void GORank::PreparePlayback() { - m_sender.ResetKey(); + ResetMidiKey(); for (unsigned i = 0; i < m_MaxNoteVelocities.size(); i++) m_MaxNoteVelocities[i] = 0; for (unsigned i = 0; i < m_NoteStopVelocities.size(); i++) for (unsigned j = 0; j < m_NoteStopVelocities[i].size(); j++) m_NoteStopVelocities[i][j] = 0; - m_sender.SetName(m_Name); -} - -void GORank::SendKey(unsigned note, unsigned velocity) { - m_sender.SetKey(note, velocity); + GOMidiSendingObject::PreparePlayback(); } -const wxString WX_MIDI_TYPE_CODE = wxT("Rank"); -const wxString WX_MIDI_TYPE = _("Rank"); - -const wxString &GORank::GetMidiTypeCode() const { return WX_MIDI_TYPE_CODE; } - -const wxString &GORank::GetMidiType() const { return WX_MIDI_TYPE; } - wxString GORank::GetElementStatus() { return _("-"); } std::vector GORank::GetElementActions() { diff --git a/src/grandorgue/model/GORank.h b/src/grandorgue/model/GORank.h index 73697c073..bfc7007e5 100644 --- a/src/grandorgue/model/GORank.h +++ b/src/grandorgue/model/GORank.h @@ -10,26 +10,20 @@ #include "ptrvector.h" -#include "midi/GOMidiSender.h" -#include "midi/objects/GOMidiObject.h" +#include "midi/objects/GOMidiSendingObject.h" #include "pipe-config/GOPipeConfigTreeNode.h" #include "sound/GOSoundStateHandler.h" -#include "GOSaveableObject.h" +#include "GOPipe.h" class GOMidiMap; class GOOrganModel; -class GOPipe; class GOStop; class GOTemperament; -class GORank : private GOSaveableObject, - public GOMidiObject, - private GOSoundStateHandler { +class GORank : public GOMidiSendingObject { private: GOOrganModel &r_OrganModel; - GOMidiMap &r_MidiMap; - wxString m_Name; ptr_vector m_Pipes; /** * Number of stops using this rank @@ -49,22 +43,21 @@ class GORank : private GOSaveableObject, float m_MinVolume; float m_MaxVolume; bool m_RetuneRank; - GOMidiSender m_sender; GOPipeConfigTreeNode m_PipeConfig; - void Resize(); + void LoadMidiObject( + GOConfigReader &cfg, const wxString &group, GOMidiMap &midiMap) override; + void SaveMidiObject( + GOConfigWriter &cfg, const wxString &group, GOMidiMap &midiMap) override; - void Save(GOConfigWriter &cfg) override; + void Resize(); - void AbortPlayback() override; void PreparePlayback() override; -protected: - GOMidiSender *GetMidiSender() override { return &m_sender; } - public: GORank(GOOrganModel &organModel); - ~GORank(); + + using GOMidiObject::Init; // Avoiding a compilation warning void Init( GOConfigReader &cfg, const wxString &group, @@ -78,6 +71,7 @@ class GORank : private GOSaveableObject, * @param firstMidiNoteNumber. -1 means no default and must be specified in * the ODF */ + using GOMidiObject::Load; // Avoiding a compilation warning void Load( GOConfigReader &cfg, const wxString &group, int defaultFirstMidiNoteNumber); void AddPipe(GOPipe *pipe); @@ -87,17 +81,14 @@ class GORank : private GOSaveableObject, unsigned GetPipeCount(); GOPipeConfigNode &GetPipeConfig(); void SetTemperament(const GOTemperament &temperament); - const wxString &GetName() const { return m_Name; } - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; - const wxString &GetMidiName() const override { return GetName(); } wxString GetElementStatus() override; std::vector GetElementActions() override; void TriggerElementActions(unsigned no) override; - void SendKey(unsigned note, unsigned velocity); + void SendKey(unsigned note, unsigned velocity) { + SendMidiKey(note, velocity); + } }; #endif diff --git a/src/grandorgue/model/GOStop.cpp b/src/grandorgue/model/GOStop.cpp index 1229cbe76..c7fa2517f 100644 --- a/src/grandorgue/model/GOStop.cpp +++ b/src/grandorgue/model/GOStop.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -14,8 +14,11 @@ #include "GOOrganModel.h" #include "GORank.h" +static const wxString WX_MIDI_TYPE_CODE = wxT("Stop"); +static const wxString WX_MIDI_TYPE_NAME = _("Stop"); + GOStop::GOStop(GOOrganModel &organModel, unsigned first_midi_note_number) - : GODrawstop(organModel), + : GODrawstop(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), m_RankInfo(0), m_KeyVelocity(0), m_FirstMidiNoteNumber(first_midi_note_number), @@ -162,10 +165,3 @@ void GOStop::StartPlayback() { } GORank *GOStop::GetRank(unsigned index) { return m_RankInfo[index].Rank; } - -const wxString WX_MIDI_TYPE_CODE = wxT("Stop"); -const wxString WX_MIDI_TYPE = _("Stop"); - -const wxString &GOStop::GetMidiTypeCode() const { return WX_MIDI_TYPE_CODE; } - -const wxString &GOStop::GetMidiType() const { return WX_MIDI_TYPE; } diff --git a/src/grandorgue/model/GOStop.h b/src/grandorgue/model/GOStop.h index 8f7033ea4..579d37c73 100644 --- a/src/grandorgue/model/GOStop.h +++ b/src/grandorgue/model/GOStop.h @@ -46,9 +46,6 @@ class GOStop : public GODrawstop { ~GOStop(void); unsigned IsAuto() const; - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif /* GOSTOP_H_ */ diff --git a/src/grandorgue/model/GOSwitch.cpp b/src/grandorgue/model/GOSwitch.cpp index 6a38f6fe9..07431ac15 100644 --- a/src/grandorgue/model/GOSwitch.cpp +++ b/src/grandorgue/model/GOSwitch.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2023 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -9,14 +9,13 @@ #include +const wxString WX_MIDI_TYPE_CODE = wxT("Drawstop"); +const wxString WX_MIDI_TYPE_NAME = _("Drawstop"); + +GOSwitch::GOSwitch(GOOrganModel &organModel) + : GODrawstop(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME) {} + void GOSwitch::AssociateWithManual(int manualN, unsigned indexInManual) { m_AssociatedManualN = m_AssociatedManualN < -1 ? manualN : -1; m_IndexInManual = m_AssociatedManualN >= 0 ? indexInManual : 0; } - -const wxString WX_MIDI_TYPE_CODE = wxT("Drawstop"); -const wxString WX_MIDI_TYPE = _("Drawstop"); - -const wxString &GOSwitch::GetMidiTypeCode() const { return WX_MIDI_TYPE_CODE; } - -const wxString &GOSwitch::GetMidiType() const { return WX_MIDI_TYPE; } diff --git a/src/grandorgue/model/GOSwitch.h b/src/grandorgue/model/GOSwitch.h index c69f3b365..231556ad6 100644 --- a/src/grandorgue/model/GOSwitch.h +++ b/src/grandorgue/model/GOSwitch.h @@ -22,7 +22,7 @@ class GOSwitch : public GODrawstop { void OnDrawstopStateChanged(bool) override {} public: - GOSwitch(GOOrganModel &organModel) : GODrawstop(organModel) {} + GOSwitch(GOOrganModel &organModel); // Return -1 for all kinds of global switches int GetAssociatedManualN() const { return std::max(m_AssociatedManualN, -1); } @@ -31,9 +31,6 @@ class GOSwitch : public GODrawstop { // Set m_AssociatedManualN. // Check that the switch is referenced not more than once void AssociateWithManual(int manualN, unsigned indexInManual); - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif diff --git a/src/grandorgue/model/GOTremulant.cpp b/src/grandorgue/model/GOTremulant.cpp index 5f215544b..bc202bbce 100644 --- a/src/grandorgue/model/GOTremulant.cpp +++ b/src/grandorgue/model/GOTremulant.cpp @@ -1,6 +1,6 @@ /* * Copyright 2006 Milan Digital Audio LLC - * Copyright 2009-2024 GrandOrgue contributors (see AUTHORS) + * Copyright 2009-2025 GrandOrgue contributors (see AUTHORS) * License GPL-2.0 or later * (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html). */ @@ -27,8 +27,11 @@ const struct IniFileEnumEntry GOTremulant::m_tremulant_types[] = { {wxT("Wave"), GOWavTrem}, }; +static const wxString WX_MIDI_TYPE_CODE = wxT("Tremulant"); +static const wxString WX_MIDI_TYPE_NAME = _("Tremulant"); + GOTremulant::GOTremulant(GOOrganModel &organModel) - : GODrawstop(organModel), + : GODrawstop(organModel, WX_MIDI_TYPE_CODE, WX_MIDI_TYPE_NAME), m_TremulantType(GOSynthTrem), m_Period(0), m_StartRate(0), @@ -135,12 +138,3 @@ void GOTremulant::StartPlayback() { } GOTremulantType GOTremulant::GetTremulantType() { return m_TremulantType; } - -const wxString WX_MIDI_TYPE_CODE = wxT("Tremulant"); -const wxString WX_MIDI_TYPE = _("Tremulant"); - -const wxString &GOTremulant::GetMidiTypeCode() const { - return WX_MIDI_TYPE_CODE; -} - -const wxString &GOTremulant::GetMidiType() const { return WX_MIDI_TYPE; } diff --git a/src/grandorgue/model/GOTremulant.h b/src/grandorgue/model/GOTremulant.h index a8df62dd3..c3f9259a7 100644 --- a/src/grandorgue/model/GOTremulant.h +++ b/src/grandorgue/model/GOTremulant.h @@ -45,7 +45,7 @@ class GOTremulant : public GODrawstop, private GOCacheObject { bool LoadCache(GOMemoryPool &pool, GOCache &cache) override; bool SaveCache(GOCacheWriter &cache) const override { return true; } void UpdateHash(GOHash &hash) const override {} - const wxString &GetLoadTitle() const override { return m_Name; }; + const wxString &GetLoadTitle() const override { return GetName(); }; void AbortPlayback() override; void StartPlayback() override; @@ -53,11 +53,9 @@ class GOTremulant : public GODrawstop, private GOCacheObject { public: GOTremulant(GOOrganModel &organModel); ~GOTremulant(); + using GODrawstop::Load; // Avoiding a compilation warning void Load(GOConfigReader &cfg, const wxString &group, unsigned tremulantN); GOTremulantType GetTremulantType(); - - const wxString &GetMidiTypeCode() const override; - const wxString &GetMidiType() const override; }; #endif /* GOTREMULANT_H_ */ diff --git a/src/tests/testing/model/GOTestWindchest.cpp b/src/tests/testing/model/GOTestWindchest.cpp index 3639b5742..2f92869e9 100644 --- a/src/tests/testing/model/GOTestWindchest.cpp +++ b/src/tests/testing/model/GOTestWindchest.cpp @@ -47,20 +47,20 @@ void GOTestWindchest::run() { GOEnclosure *enclosure = new GOEnclosure(*this->controller); windchest->AddEnclosure(enclosure); - enclosure->SetMidiValue(127); + enclosure->SetEnclosureValue(127); float volume = windchest->GetVolume(); message = "The Windchest volume is not 1 but "; message = message + std::to_string(volume); this->GOAssert(volume == 1, message); - enclosure->SetMidiValue(0); + enclosure->SetEnclosureValue(0); volume = windchest->GetVolume(); message = "The Windchest volume is not 0 but "; message = message + std::to_string(volume); this->GOAssert(volume == 0, message); // Check a MIDI value of 50 (50/127) - enclosure->SetMidiValue(50); + enclosure->SetEnclosureValue(50); volume = windchest->GetVolume(); message = "The Windchest volume is not 0.393701 but "; message = message + std::to_string(volume);