From ac372918071bd18f243ff77dd180a30d5a105fd2 Mon Sep 17 00:00:00 2001 From: Pieter Pas Date: Fri, 10 Apr 2020 00:55:30 +0200 Subject: [PATCH] Make BankConfig a template Allows specifying the default BankType for PBPotentiometer etc. --- .../ManyAddressBankNoteButton.hpp | 4 +- src/Banks/BankAddresses.hpp | 6 +-- src/Banks/BankConfig.hpp | 39 +++++++++++++++---- src/Banks/BankableAddresses.hpp | 2 +- src/Banks/BankableMIDIInput.hpp | 2 +- src/MIDI_Inputs/LEDs/NoteCCRangeLEDBar.hpp | 4 +- src/MIDI_Inputs/LEDs/NoteCCRangeLEDs.hpp | 16 ++++---- src/MIDI_Inputs/MCU/VPotRing.hpp | 2 +- src/MIDI_Inputs/MCU/VU.hpp | 6 +-- .../Bankable/Abstract/MIDIButton.hpp | 2 +- .../Bankable/Abstract/MIDIButtonLatched.hpp | 2 +- .../Bankable/Abstract/MIDIButtonLatching.hpp | 2 +- .../Bankable/Abstract/MIDIButtonMatrix.hpp | 2 +- .../Bankable/Abstract/MIDIButtons.hpp | 2 +- .../Bankable/Abstract/MIDIChordButton.hpp | 5 +-- .../Bankable/Abstract/MIDIFilteredAnalog.hpp | 4 +- .../MIDIIncrementDecrementButtons.hpp | 2 +- .../Bankable/Abstract/MIDIRotaryEncoder.hpp | 4 +- src/MIDI_Outputs/Bankable/CCButton.hpp | 3 +- src/MIDI_Outputs/Bankable/CCButtonLatched.hpp | 7 ++-- .../Bankable/CCButtonLatching.hpp | 3 +- src/MIDI_Outputs/Bankable/CCButtonMatrix.hpp | 3 +- src/MIDI_Outputs/Bankable/CCButtons.hpp | 5 +-- .../Bankable/CCIncrementDecrementButtons.hpp | 9 ++--- src/MIDI_Outputs/Bankable/CCPotentiometer.hpp | 4 +- src/MIDI_Outputs/Bankable/CCRotaryEncoder.hpp | 8 ++-- src/MIDI_Outputs/Bankable/NoteButton.hpp | 4 +- .../Bankable/NoteButtonLatched.hpp | 5 +-- .../Bankable/NoteButtonLatching.hpp | 5 +-- .../Bankable/NoteButtonMatrix.hpp | 3 +- src/MIDI_Outputs/Bankable/NoteButtons.hpp | 5 +-- src/MIDI_Outputs/Bankable/NoteChordButton.hpp | 5 +-- src/MIDI_Outputs/Bankable/PBPotentiometer.hpp | 4 +- src/MIDI_Outputs/Bankable/PCButton.hpp | 3 +- 34 files changed, 96 insertions(+), 86 deletions(-) diff --git a/examples/Other/GitHub-issues/Note-ManyAddresses-Transposer/ManyAddressBankNoteButton.hpp b/examples/Other/GitHub-issues/Note-ManyAddresses-Transposer/ManyAddressBankNoteButton.hpp index edd39bf3b8..9e9918bb90 100644 --- a/examples/Other/GitHub-issues/Note-ManyAddresses-Transposer/ManyAddressBankNoteButton.hpp +++ b/examples/Other/GitHub-issues/Note-ManyAddresses-Transposer/ManyAddressBankNoteButton.hpp @@ -9,7 +9,7 @@ template class ManyAddressBank { public: ManyAddressBank(const ManyAddresses &manyaddresses, - OutputBankConfig bank) + BaseOutputBankConfig bank) : manyaddresses{manyaddresses}, bank{bank} {} void lock() { manyaddresses.lock(), bank.lock(); } @@ -29,7 +29,7 @@ class ManyAddressBankNoteButton : public MIDIButton, DigitalNoteSender> { public: ManyAddressBankNoteButton(const ManyAddresses &manyaddresses, - OutputBankConfig bank, pin_t pin, + OutputBankConfig<> bank, pin_t pin, const DigitalNoteSender &sender = {}) : MIDIButton, DigitalNoteSender>{ {manyaddresses, bank}, diff --git a/src/Banks/BankAddresses.hpp b/src/Banks/BankAddresses.hpp index 3b799956f1..056401cbb5 100644 --- a/src/Banks/BankAddresses.hpp +++ b/src/Banks/BankAddresses.hpp @@ -8,7 +8,7 @@ namespace Bankable { class SingleAddress : public OutputBankableMIDIAddress { public: - SingleAddress(OutputBankConfig config, MIDIAddress address) + SingleAddress(BaseOutputBankConfig config, MIDIAddress address) : OutputBankableMIDIAddress{config}, address{address} {} MIDIAddress getBaseAddress() const { return address; } @@ -54,7 +54,7 @@ class SingleAddressMultipleBanks { class DualAddresses : public OutputBankableMIDIAddress { public: - DualAddresses(OutputBankConfig config, + DualAddresses(BaseOutputBankConfig config, const Array &addresses) : OutputBankableMIDIAddress{config}, first(addresses[0]), second(addresses[1]) {} @@ -76,7 +76,7 @@ class DualAddresses : public OutputBankableMIDIAddress { template class MatrixAddress : public OutputBankableMIDIAddress { public: - MatrixAddress(OutputBankConfig config, + MatrixAddress(BaseOutputBankConfig config, const AddressMatrix &addresses, MIDIChannelCN channelCN) : OutputBankableMIDIAddress{config}, addresses{addresses}, diff --git a/src/Banks/BankConfig.hpp b/src/Banks/BankConfig.hpp index f16167027e..ab8ad7c88b 100644 --- a/src/Banks/BankConfig.hpp +++ b/src/Banks/BankConfig.hpp @@ -31,30 +31,53 @@ template class Bank; class OutputBank; +template +struct OutputBankConfig; + /** * @brief A struct for selecting the bank of BankableMIDIInput%s and the * bank type. */ template -struct BankConfig { - BankConfig(Bank &bank, BankType type = CHANGE_ADDRESS) - : bank(bank), type(type) {} +class BaseBankConfig { + protected: + BaseBankConfig(Bank &bank, BankType type) : bank(bank), type(type) {} + + public: Bank &bank; const BankType type; }; +/// @copydoc BaseBankConfig +template +struct BankConfig : BaseBankConfig { + BankConfig(Bank &bank, BankType type = DefaultBankType) + : BaseBankConfig(bank, type) {} +}; + /** * @brief A struct for selecting the bank of BankableMIDIOutput%s and the * bank type. */ -struct OutputBankConfig { - template - OutputBankConfig(const BankConfig &bankconfig) - : bank(bankconfig.bank), type(bankconfig.type) {} - OutputBankConfig(OutputBank &bank, BankType type = CHANGE_ADDRESS) +class BaseOutputBankConfig { + protected: + BaseOutputBankConfig(OutputBank &bank, BankType type) : bank(bank), type(type) {} + + public: + template + BaseOutputBankConfig(BaseBankConfig config) + : bank(config.bank), type(config.type) {} + OutputBank &bank; const BankType type; }; +/// @copydoc BaseOutputBankConfig +template +struct OutputBankConfig : BaseOutputBankConfig { + OutputBankConfig(OutputBank &bank, BankType type = DefaultBankType) + : BaseOutputBankConfig(bank, type) {} +}; + END_CS_NAMESPACE \ No newline at end of file diff --git a/src/Banks/BankableAddresses.hpp b/src/Banks/BankableAddresses.hpp index 772c268818..90ebdf8e05 100644 --- a/src/Banks/BankableAddresses.hpp +++ b/src/Banks/BankableAddresses.hpp @@ -99,7 +99,7 @@ class OutputBankableMIDIAddress : public OutputBankableMIDIAddress_Base { * * @see OutputBankableMIDIAddress::OutputBankableMIDIAddress(Bank &, BankType) */ - OutputBankableMIDIAddress(const OutputBankConfig &config) + OutputBankableMIDIAddress(BaseOutputBankConfig config) : OutputBankableMIDIAddress(config.bank, config.type) {} /** diff --git a/src/Banks/BankableMIDIInput.hpp b/src/Banks/BankableMIDIInput.hpp index 31b739cc81..d1e3afbd08 100644 --- a/src/Banks/BankableMIDIInput.hpp +++ b/src/Banks/BankableMIDIInput.hpp @@ -42,7 +42,7 @@ class BankableMIDIInput : public DoublyLinkable> { * * @see BankableMIDIInput::BankableMIDIInput(Bank &, BankType) */ - BankableMIDIInput(const BankConfig &config) + BankableMIDIInput(BankConfig config) : BankableMIDIInput(config.bank, config.type) {} public: diff --git a/src/MIDI_Inputs/LEDs/NoteCCRangeLEDBar.hpp b/src/MIDI_Inputs/LEDs/NoteCCRangeLEDBar.hpp index 5734feeb5f..a8e7440eb3 100644 --- a/src/MIDI_Inputs/LEDs/NoteCCRangeLEDBar.hpp +++ b/src/MIDI_Inputs/LEDs/NoteCCRangeLEDBar.hpp @@ -118,7 +118,7 @@ template class NoteLEDBar : public GenericNoteCCRange> { public: - NoteLEDBar(const BankConfig &config, + NoteLEDBar(BankConfig config, const AH::DotBarDisplayLEDs &leds, const MIDIAddress &address) : GenericNoteCCRange class CCLEDBar : public GenericNoteCCRange> { public: - CCLEDBar(const BankConfig &config, + CCLEDBar(BankConfig config, const AH::DotBarDisplayLEDs &leds, const MIDIAddress &address) : GenericNoteCCRange class NoteRangeLEDs : public GenericNoteCCRange> { public: - NoteRangeLEDs(const BankConfig &config, + NoteRangeLEDs(BankConfig config, const PinList &ledPins, const MIDIAddress &address) : GenericNoteCCRange class NoteValueLED : public GenericNoteCCRange> { public: - NoteValueLED(const BankConfig &config, pin_t ledPin, + NoteValueLED(BankConfig config, pin_t ledPin, const MIDIAddress &address) : GenericNoteCCRange>{ config, @@ -233,7 +233,7 @@ template class CCRangeLEDs : public GenericNoteCCRange> { public: - CCRangeLEDs(const BankConfig &config, + CCRangeLEDs(BankConfig config, const PinList &ledPins, const MIDIAddress &address) : GenericNoteCCRange class CCValueLED : public GenericNoteCCRange> { public: - CCValueLED(const BankConfig &config, pin_t ledPin, + CCValueLED(BankConfig config, pin_t ledPin, const MIDIAddress &address) : GenericNoteCCRange>{ config, @@ -385,7 +385,7 @@ template class NoteRangeLEDsPWM : public GenericNoteCCRange> { public: - NoteRangeLEDsPWM(const BankConfig &config, + NoteRangeLEDsPWM(BankConfig config, const PinList &ledPins, const MIDIAddress &address) : GenericNoteCCRange class NoteValueLEDPWM : public GenericNoteCCRange> { public: - NoteValueLEDPWM(const BankConfig &config, pin_t ledPin, + NoteValueLEDPWM(BankConfig config, pin_t ledPin, const MIDIAddress &address) : GenericNoteCCRange>{ config, @@ -413,7 +413,7 @@ template class CCRangeLEDsPWM : public GenericNoteCCRange> { public: - CCRangeLEDsPWM(const BankConfig &config, + CCRangeLEDsPWM(BankConfig config, const PinList &ledPins, const MIDIAddress &address) : GenericNoteCCRange class CCValueLEDPWM : public GenericNoteCCRange> { public: - CCValueLEDPWM(const BankConfig &config, pin_t ledPin, + CCValueLEDPWM(BankConfig config, pin_t ledPin, const MIDIAddress &address) : GenericNoteCCRange>{ config, diff --git a/src/MIDI_Inputs/MCU/VPotRing.hpp b/src/MIDI_Inputs/MCU/VPotRing.hpp index 35027bf444..7841e3e95a 100644 --- a/src/MIDI_Inputs/MCU/VPotRing.hpp +++ b/src/MIDI_Inputs/MCU/VPotRing.hpp @@ -179,7 +179,7 @@ template class GenericVPotRing : public VPotRing_Base, public BankableMIDIInput { public: - GenericVPotRing(const BankConfig &config, uint8_t track, + GenericVPotRing(BankConfig config, uint8_t track, const MIDIChannelCN &channelCN, const Callback &callback) : VPotRing_Base{track, channelCN, callback}, BankableMIDIInput{config} {} diff --git a/src/MIDI_Inputs/MCU/VU.hpp b/src/MIDI_Inputs/MCU/VU.hpp index 0c9b0fd364..ab5618b30d 100644 --- a/src/MIDI_Inputs/MCU/VU.hpp +++ b/src/MIDI_Inputs/MCU/VU.hpp @@ -310,7 +310,7 @@ class GenericVU : public VU_Base, * changes. * Used for displaying the value on a range of LEDs etc. */ - GenericVU(const BankConfig &config, uint8_t track, + GenericVU(BankConfig config, uint8_t track, const MIDIChannelCN &channelCN, unsigned int decayTime, const Callback &callback) : VU_Base{ @@ -371,7 +371,7 @@ class VU : public GenericVU { * in that case, you can set the decay time to zero to disable * the decay. */ - VU(const BankConfig &config, uint8_t track, + VU(BankConfig config, uint8_t track, const MIDIChannelCN &channelCN, unsigned int decayTime = VUDecay::Default) : GenericVU{ @@ -394,7 +394,7 @@ class VU : public GenericVU { * in that case, you can set the decay time to zero to disable * the decay. */ - VU(const BankConfig &config, uint8_t track, + VU(BankConfig config, uint8_t track, unsigned int decayTime = VUDecay::Default) : GenericVU{ config, track, CHANNEL_1, decayTime, {}, diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIButton.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIButton.hpp index 0ec0cae56a..2d2e7742f7 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIButton.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIButton.hpp @@ -30,7 +30,7 @@ class MIDIButton : public MIDIOutputElement { * @param sender * The MIDI sender to use. */ - MIDIButton(const BankAddress &bankAddress, pin_t pin, const Sender &sender) + MIDIButton(BankAddress bankAddress, pin_t pin, const Sender &sender) : address{bankAddress}, button{pin}, sender(sender) {} void begin() override { button.begin(); } diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatched.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatched.hpp index 75bf50c8e6..e3ac4ba2ef 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatched.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatched.hpp @@ -33,7 +33,7 @@ class MIDIButtonLatched : public MIDIOutputElement { * @param sender * The MIDI sender to use. */ - MIDIButtonLatched(const BankAddress &bankAddress, pin_t pin, + MIDIButtonLatched(BankAddress bankAddress, pin_t pin, const Sender &sender) : address{bankAddress}, button{pin}, sender{sender} {} diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatching.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatching.hpp index 90a81b2e3b..9dd2e7351b 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatching.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonLatching.hpp @@ -30,7 +30,7 @@ class MIDIButtonLatching : public MIDIOutputElement { * @param sender * The MIDI sender to use. */ - MIDIButtonLatching(const BankAddress &bankAddress, pin_t pin, + MIDIButtonLatching(BankAddress bankAddress, pin_t pin, const Sender &sender) : address{bankAddress}, button{pin}, sender{sender} {} diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonMatrix.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonMatrix.hpp index 5ba4b41522..1ddc2b7148 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonMatrix.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtonMatrix.hpp @@ -47,7 +47,7 @@ class MIDIButtonMatrix : public MIDIOutputElement, * @param sender * The MIDI sender to use. */ - MIDIButtonMatrix(const BankAddress &bankAddress, + MIDIButtonMatrix(BankAddress bankAddress, const PinList &rowPins, const PinList &colPins, const Sender &sender) : AH::ButtonMatrix(rowPins, colPins), diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtons.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtons.hpp index 42b98368d5..b615d7b847 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIButtons.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIButtons.hpp @@ -27,7 +27,7 @@ class MIDIButtons : public MIDIOutputElement { * * @todo Documentation */ - MIDIButtons(const BankAddress &bankAddress, + MIDIButtons(BankAddress bankAddress, const Array &buttons, const RelativeMIDIAddress &incrementAddress, const Sender &sender) diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIChordButton.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIChordButton.hpp index e77160a2d0..41044ef87e 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIChordButton.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIChordButton.hpp @@ -41,9 +41,8 @@ class MIDIChordButton : public MIDIOutputElement { * The MIDI sender to use. */ template - MIDIChordButton(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, const Chord &chord, - const Sender &sender) + MIDIChordButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address, + const Chord &chord, const Sender &sender) : address{config, address}, button{pin}, newChord(AH::MakeUnique>(chord)), sender{sender} {} diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp index 38b3e4ea55..14d9ecd832 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIFilteredAnalog.hpp @@ -31,7 +31,7 @@ class MIDIFilteredAnalogAddressable : public MIDIOutputElement { * @param sender * The MIDI sender to use. */ - MIDIFilteredAnalogAddressable(const BankAddress &bankAddress, + MIDIFilteredAnalogAddressable(BankAddress bankAddress, pin_t analogPin, const Sender &sender) : address{bankAddress}, filteredAnalog{analogPin}, sender(sender) {} @@ -103,7 +103,7 @@ class MIDIFilteredAnalog : public MIDIOutputElement { * @param sender * The MIDI sender to use. */ - MIDIFilteredAnalog(const BankAddress &bankAddress, pin_t analogPin, + MIDIFilteredAnalog(BankAddress bankAddress, pin_t analogPin, const Sender &sender) : address(bankAddress), filteredAnalog(analogPin), sender(sender) {} diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIIncrementDecrementButtons.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIIncrementDecrementButtons.hpp index 1874fe28cd..31826d3e91 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIIncrementDecrementButtons.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIIncrementDecrementButtons.hpp @@ -23,7 +23,7 @@ class MIDIIncrementDecrementButtons : public MIDIOutputElement { * * @todo Documentation */ - MIDIIncrementDecrementButtons(const BankAddress &addresses, + MIDIIncrementDecrementButtons(BankAddress addresses, const AH::IncrementDecrementButtons &buttons, uint8_t multiplier, const RelativeSender &relativeSender, diff --git a/src/MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp b/src/MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp index f2a028fb6d..a9320ba096 100644 --- a/src/MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp +++ b/src/MIDI_Outputs/Bankable/Abstract/MIDIRotaryEncoder.hpp @@ -27,7 +27,7 @@ class MIDIRotaryEncoder : public MIDIOutputElement { * * @todo Documentation */ - MIDIRotaryEncoder(const BankAddress &bankAddress, + MIDIRotaryEncoder(BankAddress bankAddress, const EncoderPinList &pins, uint8_t speedMultiply, uint8_t pulsesPerStep, const Sender &sender) @@ -37,7 +37,7 @@ class MIDIRotaryEncoder : public MIDIOutputElement { // For tests only #ifndef ARDUINO - MIDIRotaryEncoder(const BankAddress &bankAddress, const Encoder &encoder, + MIDIRotaryEncoder(BankAddress bankAddress, const Encoder &encoder, uint8_t speedMultiply, uint8_t pulsesPerStep, const Sender &sender) : address(bankAddress), encoder{encoder}, diff --git a/src/MIDI_Outputs/Bankable/CCButton.hpp b/src/MIDI_Outputs/Bankable/CCButton.hpp index 9e721d37f1..7c316f5c9e 100644 --- a/src/MIDI_Outputs/Bankable/CCButton.hpp +++ b/src/MIDI_Outputs/Bankable/CCButton.hpp @@ -42,8 +42,7 @@ class CCButton : public MIDIButton { * @param sender * The MIDI sender to use. */ - CCButton(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, + CCButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address, const DigitalCCSender &sender = {}) : MIDIButton{{config, address}, pin, sender} {} }; diff --git a/src/MIDI_Outputs/Bankable/CCButtonLatched.hpp b/src/MIDI_Outputs/Bankable/CCButtonLatched.hpp index aef2498379..2b81101436 100644 --- a/src/MIDI_Outputs/Bankable/CCButtonLatched.hpp +++ b/src/MIDI_Outputs/Bankable/CCButtonLatched.hpp @@ -46,11 +46,10 @@ class CCButtonLatched * @param sender * The MIDI sender to use. */ - CCButtonLatched(const BankConfig &config, pin_t pin, - const MIDIAddress &address, + CCButtonLatched(BankConfig config, pin_t pin, MIDIAddress address, const DigitalCCSender &sender = {}) - : MIDIButtonLatched{ - {config, address}, pin, sender} {} + : MIDIButtonLatched( + {config, address}, pin, sender) {} }; } // namespace Bankable diff --git a/src/MIDI_Outputs/Bankable/CCButtonLatching.hpp b/src/MIDI_Outputs/Bankable/CCButtonLatching.hpp index 2a709b2357..810b8ff4a3 100644 --- a/src/MIDI_Outputs/Bankable/CCButtonLatching.hpp +++ b/src/MIDI_Outputs/Bankable/CCButtonLatching.hpp @@ -41,8 +41,7 @@ class CCButtonLatching * @param sender * The MIDI sender to use. */ - CCButtonLatching(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, + CCButtonLatching(OutputBankConfig<> config, pin_t pin, MIDIAddress address, const DigitalCCSender &sender = {}) : MIDIButtonLatching{ {config, address}, pin, sender} {} diff --git a/src/MIDI_Outputs/Bankable/CCButtonMatrix.hpp b/src/MIDI_Outputs/Bankable/CCButtonMatrix.hpp index f9cfaf898a..8e591c74bb 100644 --- a/src/MIDI_Outputs/Bankable/CCButtonMatrix.hpp +++ b/src/MIDI_Outputs/Bankable/CCButtonMatrix.hpp @@ -56,8 +56,7 @@ class CCButtonMatrix * @param sender * The MIDI sender to use. */ - CCButtonMatrix(const OutputBankConfig &config, - const PinList &rowPins, + CCButtonMatrix(OutputBankConfig<> config, const PinList &rowPins, const PinList &colPins, const AddressMatrix &controllers, MIDIChannelCN channelCN, const DigitalCCSender &sender = {}) diff --git a/src/MIDI_Outputs/Bankable/CCButtons.hpp b/src/MIDI_Outputs/Bankable/CCButtons.hpp index d7fd848799..07689c2047 100644 --- a/src/MIDI_Outputs/Bankable/CCButtons.hpp +++ b/src/MIDI_Outputs/Bankable/CCButtons.hpp @@ -49,10 +49,9 @@ class CCButtons * @param sender * The MIDI sender to use. */ - CCButtons(const OutputBankConfig &config, + CCButtons(OutputBankConfig<> config, const Array &buttons, - const MIDIAddress &baseAddress, - const RelativeMIDIAddress &incrementAddress, + MIDIAddress baseAddress, RelativeMIDIAddress incrementAddress, const DigitalCCSender &sender = {}) : MIDIButtons( {config, baseAddress}, buttons, incrementAddress, sender) {} diff --git a/src/MIDI_Outputs/Bankable/CCIncrementDecrementButtons.hpp b/src/MIDI_Outputs/Bankable/CCIncrementDecrementButtons.hpp index 7c2e68df15..76652d20a8 100644 --- a/src/MIDI_Outputs/Bankable/CCIncrementDecrementButtons.hpp +++ b/src/MIDI_Outputs/Bankable/CCIncrementDecrementButtons.hpp @@ -48,11 +48,10 @@ class CCIncrementDecrementButtons * @param resetSender * The MIDI sender to use for reset events. */ - CCIncrementDecrementButtons(const OutputBankConfig &config, - const AH::IncrementDecrementButtons &buttons, - const MIDIAddress &address, - uint8_t multiplier = 1, - const MIDIAddress &resetNote = {}, + CCIncrementDecrementButtons(OutputBankConfig<> config, + AH::IncrementDecrementButtons buttons, + MIDIAddress address, uint8_t multiplier = 1, + MIDIAddress resetNote = {}, const RelativeCCSender &relativeSender = {}, const DigitalNoteSender &resetSender = {}) : MIDIIncrementDecrementButtons config, pin_t analogPin, + MIDIAddress address) : MIDIFilteredAnalogAddressable(SingleAddress{config, address}, analogPin, {}) {} }; diff --git a/src/MIDI_Outputs/Bankable/CCRotaryEncoder.hpp b/src/MIDI_Outputs/Bankable/CCRotaryEncoder.hpp index 6f6e1bfccd..1dbe8d57ea 100644 --- a/src/MIDI_Outputs/Bankable/CCRotaryEncoder.hpp +++ b/src/MIDI_Outputs/Bankable/CCRotaryEncoder.hpp @@ -54,16 +54,16 @@ class CCRotaryEncoder * speed, increasing the number of pulsesPerStep will result in a * lower speed. */ - CCRotaryEncoder(const OutputBankConfig &config, const EncoderPinList &pins, - const MIDIAddress &address, int8_t speedMultiply = 1, + CCRotaryEncoder(OutputBankConfig<> config, EncoderPinList pins, + MIDIAddress address, int8_t speedMultiply = 1, uint8_t pulsesPerStep = 4) : MIDIRotaryEncoder({config, address}, pins, speedMultiply, pulsesPerStep, {}) {} // For tests only (PJRC Encoder library's copy constructor doesn't work) #ifndef ARDUINO - CCRotaryEncoder(const OutputBankConfig &config, const Encoder &encoder, - const MIDIAddress &address, int8_t speedMultiply = 1, + CCRotaryEncoder(OutputBankConfig<> config, const Encoder &encoder, + MIDIAddress address, int8_t speedMultiply = 1, uint8_t pulsesPerStep = 4) : MIDIRotaryEncoder({config, address}, encoder, speedMultiply, pulsesPerStep, {}) {} diff --git a/src/MIDI_Outputs/Bankable/NoteButton.hpp b/src/MIDI_Outputs/Bankable/NoteButton.hpp index 015ca9b22b..5574036ac0 100644 --- a/src/MIDI_Outputs/Bankable/NoteButton.hpp +++ b/src/MIDI_Outputs/Bankable/NoteButton.hpp @@ -38,8 +38,8 @@ class NoteButton : public MIDIButton { * @param velocity * The velocity of the MIDI Note events. */ - NoteButton(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, uint8_t velocity = 0x7F) + NoteButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address, + uint8_t velocity = 0x7F) : MIDIButton{ {config, address}, pin, diff --git a/src/MIDI_Outputs/Bankable/NoteButtonLatched.hpp b/src/MIDI_Outputs/Bankable/NoteButtonLatched.hpp index 10cbae38a4..77872a95d6 100644 --- a/src/MIDI_Outputs/Bankable/NoteButtonLatched.hpp +++ b/src/MIDI_Outputs/Bankable/NoteButtonLatched.hpp @@ -43,9 +43,8 @@ class NoteButtonLatched * @param velocity * The velocity of the MIDI Note events. */ - NoteButtonLatched(const BankConfig &config, pin_t pin, - const MIDIAddress &address, - uint8_t velocity = 0x7F) + NoteButtonLatched(BankConfig config, pin_t pin, + MIDIAddress address, uint8_t velocity = 0x7F) : MIDIButtonLatched{ {config, address}, pin, diff --git a/src/MIDI_Outputs/Bankable/NoteButtonLatching.hpp b/src/MIDI_Outputs/Bankable/NoteButtonLatching.hpp index 4ed49627c0..71ce378bc8 100644 --- a/src/MIDI_Outputs/Bankable/NoteButtonLatching.hpp +++ b/src/MIDI_Outputs/Bankable/NoteButtonLatching.hpp @@ -39,9 +39,8 @@ class NoteButtonLatching * @param velocity * The velocity of the MIDI Note events. */ - NoteButtonLatching(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, - uint8_t velocity = 0x7F) + NoteButtonLatching(OutputBankConfig<> config, pin_t pin, + MIDIAddress address, uint8_t velocity = 0x7F) : MIDIButtonLatching{ {config, address}, pin, diff --git a/src/MIDI_Outputs/Bankable/NoteButtonMatrix.hpp b/src/MIDI_Outputs/Bankable/NoteButtonMatrix.hpp index 3eea9d7187..0d1d92e281 100644 --- a/src/MIDI_Outputs/Bankable/NoteButtonMatrix.hpp +++ b/src/MIDI_Outputs/Bankable/NoteButtonMatrix.hpp @@ -55,8 +55,7 @@ class NoteButtonMatrix * @param velocity * The velocity of the MIDI Note events. */ - NoteButtonMatrix(const OutputBankConfig &config, - const PinList &rowPins, + NoteButtonMatrix(OutputBankConfig<> config, const PinList &rowPins, const PinList &colPins, const AddressMatrix ¬es, MIDIChannelCN channelCN = {CHANNEL_1, 0}, diff --git a/src/MIDI_Outputs/Bankable/NoteButtons.hpp b/src/MIDI_Outputs/Bankable/NoteButtons.hpp index 7d94589a16..85e32eb367 100644 --- a/src/MIDI_Outputs/Bankable/NoteButtons.hpp +++ b/src/MIDI_Outputs/Bankable/NoteButtons.hpp @@ -49,10 +49,9 @@ class NoteButtons * @param velocity * The velocity of the MIDI Note events. */ - NoteButtons(const OutputBankConfig &config, + NoteButtons(OutputBankConfig<> config, const Array &buttons, - const MIDIAddress &baseAddress, - const RelativeMIDIAddress &incrementAddress, + MIDIAddress baseAddress, RelativeMIDIAddress incrementAddress, uint8_t velocity = 0x7F) : MIDIButtons{ {config, baseAddress}, diff --git a/src/MIDI_Outputs/Bankable/NoteChordButton.hpp b/src/MIDI_Outputs/Bankable/NoteChordButton.hpp index 7e3a72ecab..fef8ebc20e 100644 --- a/src/MIDI_Outputs/Bankable/NoteChordButton.hpp +++ b/src/MIDI_Outputs/Bankable/NoteChordButton.hpp @@ -43,9 +43,8 @@ class NoteChordButton : public MIDIChordButton { * The number of notes in the chord. */ template - NoteChordButton(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address, const Chord &chord, - uint8_t velocity = 0x7F) + NoteChordButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address, + const Chord &chord, uint8_t velocity = 0x7F) : MIDIChordButton{ config, pin, address, chord, {velocity}, } {} diff --git a/src/MIDI_Outputs/Bankable/PBPotentiometer.hpp b/src/MIDI_Outputs/Bankable/PBPotentiometer.hpp index 8557c894b7..908c088aee 100644 --- a/src/MIDI_Outputs/Bankable/PBPotentiometer.hpp +++ b/src/MIDI_Outputs/Bankable/PBPotentiometer.hpp @@ -41,8 +41,8 @@ class PBPotentiometer * The MIDI channel [CHANNEL_1, CHANNEL_16] and optional Cable * Number [0, 15]. */ - PBPotentiometer(const OutputBankConfig &config, pin_t analogPin, - const MIDIChannelCN &address) + PBPotentiometer(OutputBankConfig config, + pin_t analogPin, MIDIChannelCN address) : MIDIFilteredAnalog{{config, address}, analogPin, {}} {} }; diff --git a/src/MIDI_Outputs/Bankable/PCButton.hpp b/src/MIDI_Outputs/Bankable/PCButton.hpp index 9cbaff6779..28be89db92 100644 --- a/src/MIDI_Outputs/Bankable/PCButton.hpp +++ b/src/MIDI_Outputs/Bankable/PCButton.hpp @@ -36,8 +36,7 @@ class PCButton : public MIDIButton { * channel [CHANNEL_1, CHANNEL_16], and optional cable number * [0, 15]. */ - PCButton(const OutputBankConfig &config, pin_t pin, - const MIDIAddress &address) + PCButton(OutputBankConfig<> config, pin_t pin, MIDIAddress address) : MIDIButton({config, address}, pin, {}) {} };