Line data Source code
1 : /* ✔ */
2 :
3 : #pragma once
4 :
5 : #include <Def/Def.hpp>
6 :
7 : BEGIN_CS_NAMESPACE
8 :
9 : /**
10 : * @brief An enumeration of the different bank types.
11 : */
12 : enum BankType {
13 : /**
14 : * @brief Change the offset of the address (i.e. Controller number or
15 : * Note number) of the element.
16 : */
17 : ChangeAddress = 0,
18 : CHANGE_ADDRESS CS_DEPREC("Use ChangeAddress instead") = ChangeAddress,
19 : /**
20 : * @brief Change the offset of the channel number of the element.
21 : */
22 : ChangeChannel = 1,
23 : CHANGE_CHANNEL CS_DEPREC("Use ChangeChannel instead") = ChangeChannel,
24 : /**
25 : * @brief Change the offset of the cable number of the element.
26 : */
27 : ChangeCable = 2,
28 : CHANGE_CABLENB CS_DEPREC("Use ChangeCable instead") = ChangeCable,
29 : };
30 :
31 : template <setting_t NumBanks>
32 : class Bank;
33 : class OutputBank;
34 :
35 : template <BankType DefaultBankType>
36 : struct OutputBankConfig;
37 :
38 : /**
39 : * @brief A struct for selecting the bank of BankableMIDIInput%s and the
40 : * bank type.
41 : */
42 : template <setting_t N>
43 : class BaseBankConfig {
44 : protected:
45 21 : BaseBankConfig(Bank<N> &bank, BankType type) : bank(bank), type(type) {}
46 :
47 : public:
48 : Bank<N> &bank;
49 : const BankType type;
50 : };
51 :
52 : /// @copydoc BaseBankConfig
53 : template <setting_t N, BankType DefaultBankType = BankType::ChangeAddress>
54 : struct BankConfig : BaseBankConfig<N> {
55 21 : BankConfig(Bank<N> &bank, BankType type = DefaultBankType)
56 21 : : BaseBankConfig<N>(bank, type) {}
57 : };
58 :
59 : /**
60 : * @brief A struct for selecting the bank of BankableMIDIOutput%s and the
61 : * bank type.
62 : */
63 : class BaseOutputBankConfig {
64 : protected:
65 27 : BaseOutputBankConfig(OutputBank &bank, BankType type)
66 27 : : bank(bank), type(type) {}
67 :
68 : public:
69 : template <setting_t N>
70 4 : BaseOutputBankConfig(BaseBankConfig<N> config)
71 4 : : bank(config.bank), type(config.type) {}
72 :
73 : OutputBank &bank;
74 : const BankType type;
75 : };
76 :
77 : /// @copydoc BaseOutputBankConfig
78 : template <BankType DefaultBankType = BankType::ChangeAddress>
79 : struct OutputBankConfig : BaseOutputBankConfig {
80 27 : OutputBankConfig(OutputBank &bank, BankType type = DefaultBankType)
81 27 : : BaseOutputBankConfig(bank, type) {}
82 : };
83 :
84 : END_CS_NAMESPACE
|