Replies: 2 comments 11 replies
-
Try reading the post #308. |
Beta Was this translation helpful? Give feedback.
-
It's possible but requires a bit of extra boilerplate. The way most bankable elements are implemented is as follows:
To get a MIDI element that has its address controlled by two banks, you can use the As an example, let's say you want something like You would implement it as follows: class DualBankCCPotentiometer : public Bankable::MIDIFilteredAnalog<Bankable::SingleAddressMultipleBanks<2>, ContinuousCCSender> {
public:
DualBankCCPotentiometer(const Array<OutputBankableMIDIAddress, 2> &banks, pin_t pin, MIDIAddress address)
: Bankable::MIDIFilteredAnalog<Bankable::SingleAddressMultipleBanks<2>, ContinuousCCSender>({banks, address}, pin, {}) {}
}; You can look at the implementation of To use it in your sketch, you can then use: DualBankCCPotentiometer pot {
{{
{channelbank, BankType::CHANGE_CHANNEL},
{addressbank, BankType::CHANGE_ADDRESS},
}}, // Banks and types
A0, // analog input pin
{0x07, CHANNEL_1}, // base address
}; Here's the full sketch: #include <Control_Surface.h> // Include the Control Surface library
USBDebugMIDI_Interface midi; // Debug output for easy testing
class DualBankCCPotentiometer : public Bankable::MIDIFilteredAnalog<Bankable::SingleAddressMultipleBanks<2>, ContinuousCCSender> {
public:
DualBankCCPotentiometer(const Array<OutputBankableMIDIAddress, 2> &banks, pin_t pin, MIDIAddress address)
: Bankable::MIDIFilteredAnalog<Bankable::SingleAddressMultipleBanks<2>, ContinuousCCSender>({banks, address}, pin, {}) {}
};
Bank<3> channelbank(1); // 3 modes which offset the channel by +1
Bank<3> addressbank(5); // 3 modes which offset the address by +5
IncrementSelector<3> selectors[] {
{channelbank, 2},
{addressbank, 3},
};
DualBankCCPotentiometer pot {
{{
{channelbank, BankType::CHANGE_CHANNEL},
{addressbank, BankType::CHANGE_ADDRESS},
}}, // Banks and types
A0, // analog input pin
{0x07, CHANNEL_1}, // base address
};
void setup() {
Control_Surface.begin();
}
void loop() {
Control_Surface.loop();
} Note that I tested it using the |
Beta Was this translation helpful? Give feedback.
-
Many thanks for your library, it is so helpful, especially for someone who does not master code writing. I have a question, though, relative to the creation of banks. My project requires that I should be able to change the midi channel of my ccpotentiometers and ccbuttons manually (an incrementSelectorLEDS button seemed the most obvious candidate) AND also change their addresses (CC controller number) with another incrementSelectorLEDS.
The comments in bank.ino say that I can change CHANGE_CHANNEL into CHANGE_ADDRESS, but I have found no reference to the possibility of using the two bank types to modify the address and channel of each controller.
This is the file I am using as a test:
As you see, that also means that I had to declare more than one bank and I thought that I could freely name them bank1 and bank2 (in a particularly eccentric flight of my imagination). But maybe I am deceived (there again I could not find an example of multiple banks using the library.)
If I am mistaken and some of the issues pages contain that information, please ignore my query. But if the information may be found elsewhere, would you have the kindness to redirect me? Thanks a lot.
Philippe
Beta Was this translation helpful? Give feedback.
All reactions