| 1 |
/* |
| 2 |
* Copyright (C) 2018-2023 Rerrah |
| 3 |
* |
| 4 |
* Permission is hereby granted, free of charge, to any person |
| 5 |
* obtaining a copy of this software and associated documentation |
| 6 |
* files (the "Software"), to deal in the Software without |
| 7 |
* restriction, including without limitation the rights to use, |
| 8 |
* copy, modify, merge, publish, distribute, sublicense, and/or sell |
| 9 |
* copies of the Software, and to permit persons to whom the |
| 10 |
* Software is furnished to do so, subject to the following |
| 11 |
* conditions: |
| 12 |
* |
| 13 |
* The above copyright notice and this permission notice shall be |
| 14 |
* included in all copies or substantial portions of the Software. |
| 15 |
* |
| 16 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 17 |
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES |
| 18 |
* OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 19 |
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT |
| 20 |
* HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, |
| 21 |
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 |
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR |
| 23 |
* OTHER DEALINGS IN THE SOFTWARE. |
| 24 |
*/ |
| 25 |
|
| 26 |
#pragma once |
| 27 |
|
| 28 |
#include <string> |
| 29 |
#include <memory> |
| 30 |
#include <array> |
| 31 |
#include <vector> |
| 32 |
#include <set> |
| 33 |
#include "instrument.hpp" |
| 34 |
#include "envelope_fm.hpp" |
| 35 |
#include "lfo_fm.hpp" |
| 36 |
#include "sample_adpcm.hpp" |
| 37 |
#include "sequence_property.hpp" |
| 38 |
#include "instrument_property_defs.hpp" |
| 39 |
#include "enum_hash.hpp" |
| 40 |
|
| 41 |
enum class InstrumentType; |
| 42 |
class AbstractInstrument; |
| 43 |
class InstrumentFM; |
| 44 |
enum class FMEnvelopeParameter; |
| 45 |
class EnvelopeFM; |
| 46 |
class InstrumentSSG; |
| 47 |
class InstrumentADPCM; |
| 48 |
class InstrumentDrumkit; |
| 49 |
|
| 50 |
class InstrumentsManager |
| 51 |
{ |
| 52 |
public: |
| 53 |
explicit InstrumentsManager(bool unedited); |
| 54 |
|
| 55 |
void addInstrument(int instNum, InstrumentType type, const std::string& name); |
| 56 |
void addInstrument(AbstractInstrument* newInstPtr); |
| 57 |
std::unique_ptr<AbstractInstrument> removeInstrument(int instNum); |
| 58 |
void cloneInstrument(int cloneInstNum, int resInstNum); |
| 59 |
void deepCloneInstrument(int cloneInstNum, int resInstNum); |
| 60 |
void swapInstruments(int inst1Num, int inst2Num); |
| 61 |
std::shared_ptr<AbstractInstrument> getInstrumentSharedPtr(int instNum); |
| 62 |
void clearAll(); |
| 63 |
std::vector<int> getInstrumentIndices() const; |
| 64 |
|
| 65 |
void setInstrumentName(int instNum, const std::string& name); |
| 66 |
std::string getInstrumentName(int instNum) const; |
| 67 |
std::vector<std::string> getInstrumentNameList() const; |
| 68 |
|
| 69 |
void clearUnusedInstrumentProperties(); |
| 70 |
|
| 71 |
int findFirstFreeInstrument() const; |
| 72 |
|
| 73 |
std::unordered_map<int, int> getDuplicateInstrumentMap() const; |
| 74 |
|
| 75 |
inline void setPropertyFindMode(bool unedited) noexcept { regardingUnedited_ = unedited; } |
| 76 |
|
| 77 |
private: |
| 78 |
std::array<std::shared_ptr<AbstractInstrument>, 128> insts_; |
| 79 |
bool regardingUnedited_; |
| 80 |
|
| 81 |
//----- FM methods ----- |
| 82 |
public: |
| 83 |
void setInstrumentFMEnvelope(int instNum, int envNum); |
| 84 |
int getInstrumentFMEnvelope(int instNum) const; |
| 85 |
void setEnvelopeFMParameter(int envNum, FMEnvelopeParameter param, int value); |
| 86 |
int getEnvelopeFMParameter(int envNum, FMEnvelopeParameter param) const; |
| 87 |
void setEnvelopeFMOperatorEnabled(int envNum, int opNum, bool enabled); |
| 88 |
bool getEnvelopeFMOperatorEnabled(int envNum, int opNum) const; |
| 89 |
std::multiset<int> getEnvelopeFMUsers(int envNum) const; |
| 90 |
std::vector<int> getEnvelopeFMEntriedIndices() const; |
| 91 |
int findFirstAssignableEnvelopeFM() const; |
| 92 |
|
| 93 |
void setInstrumentFMLFOEnabled(int instNum, bool enabled); |
| 94 |
bool getInstrumentFMLFOEnabled(int instNum) const; |
| 95 |
void setInstrumentFMLFO(int instNum, int lfoNum); |
| 96 |
int getInstrumentFMLFO(int instNum) const; |
| 97 |
void setLFOFMParameter(int lfoNum, FMLFOParameter param, int value); |
| 98 |
int getLFOFMparameter(int lfoNum, FMLFOParameter param) const; |
| 99 |
std::multiset<int> getLFOFMUsers(int lfoNum) const; |
| 100 |
std::vector<int> getLFOFMEntriedIndices() const; |
| 101 |
int findFirstAssignableLFOFM() const; |
| 102 |
|
| 103 |
void setInstrumentFMOperatorSequenceEnabled(int instNum, FMEnvelopeParameter param, bool enabled); |
| 104 |
bool getInstrumentFMOperatorSequenceEnabled(int instNum, FMEnvelopeParameter param) const; |
| 105 |
void setInstrumentFMOperatorSequence(int instNum, FMEnvelopeParameter param, int opSeqNum); |
| 106 |
int getInstrumentFMOperatorSequence(int instNum, FMEnvelopeParameter param); |
| 107 |
void addOperatorSequenceFMSequenceData(FMEnvelopeParameter param, int opSeqNum, int data); |
| 108 |
void removeOperatorSequenceFMSequenceData(FMEnvelopeParameter param, int opSeqNum); |
| 109 |
void setOperatorSequenceFMSequenceData(FMEnvelopeParameter param, int opSeqNum, int cnt, int data); |
| 110 |
std::vector<FMOperatorSequenceUnit> getOperatorSequenceFMSequence(FMEnvelopeParameter param, int opSeqNum); |
| 111 |
void addOperatorSequenceFMLoop(FMEnvelopeParameter param, int opSeqNum, const InstrumentSequenceLoop& loop); |
| 112 |
void removeOperatorSequenceFMLoop(FMEnvelopeParameter param, int opSeqNum, int begin, int end); |
| 113 |
void changeOperatorSequenceFMLoop(FMEnvelopeParameter param, int opSeqNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 114 |
void clearOperatorSequenceFMLoops(FMEnvelopeParameter param, int opSeqNum); |
| 115 |
InstrumentSequenceLoopRoot getOperatorSequenceFMLoopRoot(FMEnvelopeParameter param, int opSeqNum) const; |
| 116 |
void setOperatorSequenceFMRelease(FMEnvelopeParameter param, int opSeqNum, const InstrumentSequenceRelease& release); |
| 117 |
InstrumentSequenceRelease getOperatorSequenceFMRelease(FMEnvelopeParameter param, int opSeqNum) const; |
| 118 |
FMOperatorSequenceIter getOperatorSequenceFMIterator(FMEnvelopeParameter param, int opSeqNum) const; |
| 119 |
std::multiset<int> getOperatorSequenceFMUsers(FMEnvelopeParameter param, int opSeqNum) const; |
| 120 |
std::vector<int> getOperatorSequenceFMEntriedIndices(FMEnvelopeParameter param) const; |
| 121 |
int findFirstAssignableOperatorSequenceFM(FMEnvelopeParameter param) const; |
| 122 |
|
| 123 |
void setInstrumentFMArpeggioEnabled(int instNum, FMOperatorType op, bool enabled); |
| 124 |
bool getInstrumentFMArpeggioEnabled(int instNum, FMOperatorType op) const; |
| 125 |
void setInstrumentFMArpeggio(int instNum, FMOperatorType op, int arpNum); |
| 126 |
int getInstrumentFMArpeggio(int instNum, FMOperatorType op); |
| 127 |
void setArpeggioFMType(int arpNum, SequenceType type); |
| 128 |
SequenceType getArpeggioFMType(int arpNum) const; |
| 129 |
void addArpeggioFMSequenceData(int arpNum, int data); |
| 130 |
void removeArpeggioFMSequenceData(int arpNum); |
| 131 |
void setArpeggioFMSequenceData(int arpNum, int cnt, int data); |
| 132 |
std::vector<ArpeggioUnit> getArpeggioFMSequence(int arpNum); |
| 133 |
void addArpeggioFMLoop(int arpNum, const InstrumentSequenceLoop& loop); |
| 134 |
void removeArpeggioFMLoop(int arpNum, int begin, int end); |
| 135 |
void changeArpeggioFMLoop(int arpNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 136 |
void clearArpeggioFMLoops(int arpNum); |
| 137 |
InstrumentSequenceLoopRoot getArpeggioFMLoopRoot(int arpNum) const; |
| 138 |
void setArpeggioFMRelease(int arpNum, const InstrumentSequenceRelease& release); |
| 139 |
InstrumentSequenceRelease getArpeggioFMRelease(int arpNum) const; |
| 140 |
ArpeggioIter getArpeggioFMIterator(int arpNum) const; |
| 141 |
std::multiset<int> getArpeggioFMUsers(int arpNum) const; |
| 142 |
std::vector<int> getArpeggioFMEntriedIndices() const; |
| 143 |
int findFirstAssignableArpeggioFM() const; |
| 144 |
|
| 145 |
void setInstrumentFMPitchEnabled(int instNum, FMOperatorType op, bool enabled); |
| 146 |
bool getInstrumentFMPitchEnabled(int instNum, FMOperatorType op) const; |
| 147 |
void setInstrumentFMPitch(int instNum, FMOperatorType op, int ptNum); |
| 148 |
int getInstrumentFMPitch(int instNum, FMOperatorType op); |
| 149 |
void setPitchFMType(int ptNum, SequenceType type); |
| 150 |
SequenceType getPitchFMType(int ptNum) const; |
| 151 |
void addPitchFMSequenceData(int ptNum, int data); |
| 152 |
void removePitchFMSequenceData(int ptNum); |
| 153 |
void setPitchFMSequenceData(int ptNum, int cnt, int data); |
| 154 |
std::vector<PitchUnit> getPitchFMSequence(int ptNum); |
| 155 |
void addPitchFMLoop(int ptNum, const InstrumentSequenceLoop& loop); |
| 156 |
void removePitchFMLoop(int ptNum, int begin, int end); |
| 157 |
void changePitchFMLoop(int ptNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 158 |
void clearPitchFMLoops(int ptNum); |
| 159 |
InstrumentSequenceLoopRoot getPitchFMLoopRoot(int ptNum) const; |
| 160 |
void setPitchFMRelease(int ptNum, const InstrumentSequenceRelease& release); |
| 161 |
InstrumentSequenceRelease getPitchFMRelease(int ptNum) const; |
| 162 |
PitchIter getPitchFMIterator(int ptNum) const; |
| 163 |
std::multiset<int> getPitchFMUsers(int ptNum) const; |
| 164 |
std::vector<int> getPitchFMEntriedIndices() const; |
| 165 |
int findFirstAssignablePitchFM() const; |
| 166 |
|
| 167 |
void setInstrumentFMPanEnabled(int instNum, bool enabled); |
| 168 |
bool getInstrumentFMPanEnabled(int instNum) const; |
| 169 |
void setInstrumentFMPan(int instNum, int panNum); |
| 170 |
int getInstrumentFMPan(int instNum); |
| 171 |
void addPanFMSequenceData(int panNum, int data); |
| 172 |
void removePanFMSequenceData(int panNum); |
| 173 |
void setPanFMSequenceData(int panNum, int cnt, int data); |
| 174 |
std::vector<PanUnit> getPanFMSequence(int panNum); |
| 175 |
void addPanFMLoop(int panNum, const InstrumentSequenceLoop& loop); |
| 176 |
void removePanFMLoop(int panNum, int begin, int end); |
| 177 |
void changePanFMLoop(int panNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 178 |
void clearPanFMLoops(int panNum); |
| 179 |
InstrumentSequenceLoopRoot getPanFMLoopRoot(int panNum) const; |
| 180 |
void setPanFMRelease(int panNum, const InstrumentSequenceRelease& release); |
| 181 |
InstrumentSequenceRelease getPanFMRelease(int panNum) const; |
| 182 |
PanIter getPanFMIterator(int panNum) const; |
| 183 |
std::multiset<int> getPanFMUsers(int panNum) const; |
| 184 |
std::vector<int> getPanFMEntriedIndices() const; |
| 185 |
int findFirstAssignablePanFM() const; |
| 186 |
|
| 187 |
void setInstrumentFMEnvelopeResetEnabled(int instNum, FMOperatorType op, bool enabled); |
| 188 |
|
| 189 |
private: |
| 190 |
std::array<std::shared_ptr<EnvelopeFM>, 128> envFM_; |
| 191 |
std::array<std::shared_ptr<LFOFM>, 128> lfoFM_; |
| 192 |
std::unordered_map<FMEnvelopeParameter, std::array<std::shared_ptr<InstrumentSequenceProperty<FMOperatorSequenceUnit>>, 128>> opSeqFM_; |
| 193 |
std::array<std::shared_ptr<InstrumentSequenceProperty<ArpeggioUnit>>, 128> arpFM_; |
| 194 |
std::array<std::shared_ptr<InstrumentSequenceProperty<PitchUnit>>, 128> ptFM_; |
| 195 |
std::array<std::shared_ptr<InstrumentSequenceProperty<PanUnit>>, 128> panFM_; |
| 196 |
|
| 197 |
bool equalPropertiesFM(std::shared_ptr<AbstractInstrument> a, std::shared_ptr<AbstractInstrument> b) const; |
| 198 |
|
| 199 |
//----- SSG methods ----- |
| 200 |
public: |
| 201 |
void setInstrumentSSGWaveformEnabled(int instNum, bool enabled); |
| 202 |
bool getInstrumentSSGWaveformEnabled(int instNum) const; |
| 203 |
void setInstrumentSSGWaveform(int instNum, int wfNum); |
| 204 |
int getInstrumentSSGWaveform(int instNum); |
| 205 |
void addWaveformSSGSequenceData(int wfNum, const SSGWaveformUnit& data); |
| 206 |
void removeWaveformSSGSequenceData(int wfNum); |
| 207 |
void setWaveformSSGSequenceData(int wfNum, int cnt, const SSGWaveformUnit& data); |
| 208 |
std::vector<SSGWaveformUnit> getWaveformSSGSequence(int wfNum); |
| 209 |
void addWaveformSSGLoop(int wfNum, const InstrumentSequenceLoop& loop); |
| 210 |
void removeWaveformSSGLoop(int wfNum, int begin, int end); |
| 211 |
void changeWaveformSSGLoop(int wfNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 212 |
void clearWaveformSSGLoops(int wfNum); |
| 213 |
InstrumentSequenceLoopRoot getWaveformSSGLoopRoot(int wfNum) const; |
| 214 |
void setWaveformSSGRelease(int wfNum, const InstrumentSequenceRelease& release); |
| 215 |
InstrumentSequenceRelease getWaveformSSGRelease(int wfNum) const; |
| 216 |
SSGWaveformIter getWaveformSSGIterator(int wfNum) const; |
| 217 |
std::multiset<int> getWaveformSSGUsers(int wfNum) const; |
| 218 |
std::vector<int> getWaveformSSGEntriedIndices() const; |
| 219 |
int findFirstAssignableWaveformSSG() const; |
| 220 |
|
| 221 |
void setInstrumentSSGToneNoiseEnabled(int instNum, bool enabled); |
| 222 |
bool getInstrumentSSGToneNoiseEnabled(int instNum) const; |
| 223 |
void setInstrumentSSGToneNoise(int instNum, int tnNum); |
| 224 |
int getInstrumentSSGToneNoise(int instNum); |
| 225 |
void addToneNoiseSSGSequenceData(int tnNum, int data); |
| 226 |
void removeToneNoiseSSGSequenceData(int tnNum); |
| 227 |
void setToneNoiseSSGSequenceData(int tnNum, int cnt, int data); |
| 228 |
std::vector<SSGToneNoiseUnit> getToneNoiseSSGSequence(int tnNum); |
| 229 |
void addToneNoiseSSGLoop(int tnNum, const InstrumentSequenceLoop& loop); |
| 230 |
void removeToneNoiseSSGLoop(int tnNum, int begin, int end); |
| 231 |
void changeToneNoiseSSGLoop(int tnNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 232 |
void clearToneNoiseSSGLoops(int tnNum); |
| 233 |
InstrumentSequenceLoopRoot getToneNoiseSSGLoopRoot(int tnNum) const; |
| 234 |
void setToneNoiseSSGRelease(int tnNum, const InstrumentSequenceRelease& release); |
| 235 |
InstrumentSequenceRelease getToneNoiseSSGRelease(int tnNum) const; |
| 236 |
SSGToneNoiseIter getToneNoiseSSGIterator(int tnNum) const; |
| 237 |
std::multiset<int> getToneNoiseSSGUsers(int tnNum) const; |
| 238 |
std::vector<int> getToneNoiseSSGEntriedIndices() const; |
| 239 |
int findFirstAssignableToneNoiseSSG() const; |
| 240 |
|
| 241 |
void setInstrumentSSGEnvelopeEnabled(int instNum, bool enabled); |
| 242 |
bool getInstrumentSSGEnvelopeEnabled(int instNum) const; |
| 243 |
void setInstrumentSSGEnvelope(int instNum, int envNum); |
| 244 |
int getInstrumentSSGEnvelope(int instNum); |
| 245 |
void addEnvelopeSSGSequenceData(int envNum, const SSGEnvelopeUnit& data); |
| 246 |
void removeEnvelopeSSGSequenceData(int envNum); |
| 247 |
void setEnvelopeSSGSequenceData(int envNum, int cnt, const SSGEnvelopeUnit& data); |
| 248 |
std::vector<SSGEnvelopeUnit> getEnvelopeSSGSequence(int envNum); |
| 249 |
void addEnvelopeSSGLoop(int envNum, const InstrumentSequenceLoop& loop); |
| 250 |
void removeEnvelopeSSGLoop(int envNum, int begin, int end); |
| 251 |
void changeEnvelopeSSGLoop(int envNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 252 |
void clearEnvelopeSSGLoops(int envNum); |
| 253 |
InstrumentSequenceLoopRoot getEnvelopeSSGLoopRoot(int envNum) const; |
| 254 |
void setEnvelopeSSGRelease(int envNum, const InstrumentSequenceRelease& release); |
| 255 |
InstrumentSequenceRelease getEnvelopeSSGRelease(int envNum) const; |
| 256 |
SSGEnvelopeIter getEnvelopeSSGIterator(int envNum) const; |
| 257 |
std::multiset<int> getEnvelopeSSGUsers(int envNum) const; |
| 258 |
std::vector<int> getEnvelopeSSGEntriedIndices() const; |
| 259 |
int findFirstAssignableEnvelopeSSG() const; |
| 260 |
|
| 261 |
void setInstrumentSSGArpeggioEnabled(int instNum, bool enabled); |
| 262 |
bool getInstrumentSSGArpeggioEnabled(int instNum) const; |
| 263 |
void setInstrumentSSGArpeggio(int instNum, int arpNum); |
| 264 |
int getInstrumentSSGArpeggio(int instNum); |
| 265 |
void setArpeggioSSGType(int arpNum, SequenceType type); |
| 266 |
SequenceType getArpeggioSSGType(int arpNum) const; |
| 267 |
void addArpeggioSSGSequenceData(int arpNum, int data); |
| 268 |
void removeArpeggioSSGSequenceData(int arpNum); |
| 269 |
void setArpeggioSSGSequenceData(int arpNum, int cnt, int data); |
| 270 |
std::vector<ArpeggioUnit> getArpeggioSSGSequence(int arpNum); |
| 271 |
void addArpeggioSSGLoop(int arpNum, const InstrumentSequenceLoop& loop); |
| 272 |
void removeArpeggioSSGLoop(int arpNum, int begin, int end); |
| 273 |
void changeArpeggioSSGLoop(int arpNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 274 |
void clearArpeggioSSGLoops(int arpNum); |
| 275 |
InstrumentSequenceLoopRoot getArpeggioSSGLoopRoot(int arpNum) const; |
| 276 |
void setArpeggioSSGRelease(int arpNum, const InstrumentSequenceRelease& release); |
| 277 |
InstrumentSequenceRelease getArpeggioSSGRelease(int arpNum) const; |
| 278 |
ArpeggioIter getArpeggioSSGIterator(int arpNum) const; |
| 279 |
std::multiset<int> getArpeggioSSGUsers(int arpNum) const; |
| 280 |
std::vector<int> getArpeggioSSGEntriedIndices() const; |
| 281 |
int findFirstAssignableArpeggioSSG() const; |
| 282 |
|
| 283 |
void setInstrumentSSGPitchEnabled(int instNum, bool enabled); |
| 284 |
bool getInstrumentSSGPitchEnabled(int instNum) const; |
| 285 |
void setInstrumentSSGPitch(int instNum, int ptNum); |
| 286 |
int getInstrumentSSGPitch(int instNum); |
| 287 |
void setPitchSSGType(int ptNum, SequenceType type); |
| 288 |
SequenceType getPitchSSGType(int ptNum) const; |
| 289 |
void addPitchSSGSequenceData(int ptNum, int data); |
| 290 |
void removePitchSSGSequenceData(int ptNum); |
| 291 |
void setPitchSSGSequenceData(int ptNum, int cnt, int data); |
| 292 |
std::vector<PitchUnit> getPitchSSGSequence(int ptNum); |
| 293 |
void addPitchSSGLoop(int ptNum, const InstrumentSequenceLoop& loop); |
| 294 |
void removePitchSSGLoop(int ptNum, int begin, int end); |
| 295 |
void changePitchSSGLoop(int ptNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 296 |
void clearPitchSSGLoops(int ptNum); |
| 297 |
InstrumentSequenceLoopRoot getPitchSSGLoopRoot(int ptNum) const; |
| 298 |
void setPitchSSGRelease(int ptNum, const InstrumentSequenceRelease& release); |
| 299 |
InstrumentSequenceRelease getPitchSSGRelease(int ptNum) const; |
| 300 |
PitchIter getPitchSSGIterator(int ptNum) const; |
| 301 |
std::multiset<int> getPitchSSGUsers(int ptNum) const; |
| 302 |
std::vector<int> getPitchSSGEntriedIndices() const; |
| 303 |
int findFirstAssignablePitchSSG() const; |
| 304 |
|
| 305 |
private: |
| 306 |
std::array<std::shared_ptr<InstrumentSequenceProperty<SSGWaveformUnit>>, 128> wfSSG_; |
| 307 |
std::array<std::shared_ptr<InstrumentSequenceProperty<SSGEnvelopeUnit>>, 128> envSSG_; |
| 308 |
std::array<std::shared_ptr<InstrumentSequenceProperty<SSGToneNoiseUnit>>, 128> tnSSG_; |
| 309 |
std::array<std::shared_ptr<InstrumentSequenceProperty<ArpeggioUnit>>, 128> arpSSG_; |
| 310 |
std::array<std::shared_ptr<InstrumentSequenceProperty<PitchUnit>>, 128> ptSSG_; |
| 311 |
|
| 312 |
bool equalPropertiesSSG(std::shared_ptr<AbstractInstrument> a, std::shared_ptr<AbstractInstrument> b) const; |
| 313 |
|
| 314 |
//----- ADPCM methods ----- |
| 315 |
public: |
| 316 |
void setInstrumentADPCMSample(int instNum, int sampNum); |
| 317 |
int getInstrumentADPCMSample(int instNum); |
| 318 |
void setSampleADPCMRootKeyNumber(int sampNum, int n); |
| 319 |
int getSampleADPCMRootKeyNumber(int sampNum) const; |
| 320 |
void setSampleADPCMRootDeltaN(int sampNum, int dn); |
| 321 |
int getSampleADPCMRootDeltaN(int sampNum) const; |
| 322 |
void setSampleADPCMRepeatEnabled(int sampNum, bool enabled); |
| 323 |
bool isSampleADPCMRepeatable(int sampNum) const; |
| 324 |
bool setSampleADPCMRepeatrange(int sampNum, const SampleRepeatRange& range); |
| 325 |
SampleRepeatFlag getSampleADPCMRepeatFlag(int sampNum) const; |
| 326 |
SampleRepeatRange getSampleADPCMRepeatRange(int sampNum) const; |
| 327 |
void storeSampleADPCMRawSample(int sampNum, const std::vector<uint8_t>& sample); |
| 328 |
void storeSampleADPCMRawSample(int sampNum, std::vector<uint8_t>&& sample); |
| 329 |
void clearSampleADPCMRawSample(int sampNum); |
| 330 |
std::vector<uint8_t> getSampleADPCMRawSample(int sampNum) const; |
| 331 |
void setSampleADPCMStartAddress(int sampNum, size_t addr); |
| 332 |
size_t getSampleADPCMStartAddress(int sampNum) const; |
| 333 |
void setSampleADPCMStopAddress(int sampNum, size_t addr); |
| 334 |
size_t getSampleADPCMStopAddress(int sampNum) const; |
| 335 |
std::multiset<int> getSampleADPCMUsers(int sampNum) const; |
| 336 |
std::vector<int> getSampleADPCMEntriedIndices() const; |
| 337 |
std::vector<int> getSampleADPCMValidIndices() const; |
| 338 |
void clearUnusedSamplesADPCM(); |
| 339 |
int findFirstAssignableSampleADPCM(int startIndex = 0) const; |
| 340 |
|
| 341 |
void setInstrumentADPCMEnvelopeEnabled(int instNum, bool enabled); |
| 342 |
bool getInstrumentADPCMEnvelopeEnabled(int instNum) const; |
| 343 |
void setInstrumentADPCMEnvelope(int instNum, int envNum); |
| 344 |
int getInstrumentADPCMEnvelope(int instNum); |
| 345 |
void addEnvelopeADPCMSequenceData(int envNum, int data); |
| 346 |
void removeEnvelopeADPCMSequenceData(int envNum); |
| 347 |
void setEnvelopeADPCMSequenceData(int envNum, int cnt, int data); |
| 348 |
std::vector<ADPCMEnvelopeUnit> getEnvelopeADPCMSequence(int envNum); |
| 349 |
void addEnvelopeADPCMLoop(int envNum, const InstrumentSequenceLoop& loop); |
| 350 |
void removeEnvelopeADPCMLoop(int envNum, int begin, int end); |
| 351 |
void changeEnvelopeADPCMLoop(int envNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 352 |
void clearEnvelopeADPCMLoops(int envNum); |
| 353 |
InstrumentSequenceLoopRoot getEnvelopeADPCMLoopRoot(int envNum) const; |
| 354 |
void setEnvelopeADPCMRelease(int envNum, const InstrumentSequenceRelease& release); |
| 355 |
InstrumentSequenceRelease getEnvelopeADPCMRelease(int envNum) const; |
| 356 |
ADPCMEnvelopeIter getEnvelopeADPCMIterator(int envNum) const; |
| 357 |
std::multiset<int> getEnvelopeADPCMUsers(int envNum) const; |
| 358 |
std::vector<int> getEnvelopeADPCMEntriedIndices() const; |
| 359 |
int findFirstAssignableEnvelopeADPCM() const; |
| 360 |
|
| 361 |
void setInstrumentADPCMArpeggioEnabled(int instNum, bool enabled); |
| 362 |
bool getInstrumentADPCMArpeggioEnabled(int instNum) const; |
| 363 |
void setInstrumentADPCMArpeggio(int instNum, int arpNum); |
| 364 |
int getInstrumentADPCMArpeggio(int instNum); |
| 365 |
void setArpeggioADPCMType(int arpNum, SequenceType type); |
| 366 |
SequenceType getArpeggioADPCMType(int arpNum) const; |
| 367 |
void addArpeggioADPCMSequenceData(int arpNum, int data); |
| 368 |
void removeArpeggioADPCMSequenceData(int arpNum); |
| 369 |
void setArpeggioADPCMSequenceData(int arpNum, int cnt, int data); |
| 370 |
std::vector<ArpeggioUnit> getArpeggioADPCMSequence(int arpNum); |
| 371 |
void addArpeggioADPCMLoop(int arpNum, const InstrumentSequenceLoop& loop); |
| 372 |
void removeArpeggioADPCMLoop(int arpNum, int begin, int end); |
| 373 |
void changeArpeggioADPCMLoop(int arpNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 374 |
void clearArpeggioADPCMLoops(int arpNum); |
| 375 |
InstrumentSequenceLoopRoot getArpeggioADPCMLoopRoot(int arpNum) const; |
| 376 |
void setArpeggioADPCMRelease(int arpNum, const InstrumentSequenceRelease& release); |
| 377 |
InstrumentSequenceRelease getArpeggioADPCMRelease(int arpNum) const; |
| 378 |
ArpeggioIter getArpeggioADPCMIterator(int arpNum) const; |
| 379 |
std::multiset<int> getArpeggioADPCMUsers(int arpNum) const; |
| 380 |
std::vector<int> getArpeggioADPCMEntriedIndices() const; |
| 381 |
int findFirstAssignableArpeggioADPCM() const; |
| 382 |
|
| 383 |
void setInstrumentADPCMPitchEnabled(int instNum, bool enabled); |
| 384 |
bool getInstrumentADPCMPitchEnabled(int instNum) const; |
| 385 |
void setInstrumentADPCMPitch(int instNum, int ptNum); |
| 386 |
int getInstrumentADPCMPitch(int instNum); |
| 387 |
void setPitchADPCMType(int ptNum, SequenceType type); |
| 388 |
SequenceType getPitchADPCMType(int ptNum) const; |
| 389 |
void addPitchADPCMSequenceData(int ptNum, int data); |
| 390 |
void removePitchADPCMSequenceData(int ptNum); |
| 391 |
void setPitchADPCMSequenceData(int ptNum, int cnt, int data); |
| 392 |
std::vector<PitchUnit> getPitchADPCMSequence(int ptNum); |
| 393 |
void addPitchADPCMLoop(int ptNum, const InstrumentSequenceLoop& loop); |
| 394 |
void removePitchADPCMLoop(int ptNum, int begin, int end); |
| 395 |
void changePitchADPCMLoop(int ptNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 396 |
void clearPitchADPCMLoops(int ptNum); |
| 397 |
InstrumentSequenceLoopRoot getPitchADPCMLoopRoot(int ptNum) const; |
| 398 |
void setPitchADPCMRelease(int ptNum, const InstrumentSequenceRelease& release); |
| 399 |
InstrumentSequenceRelease getPitchADPCMRelease(int ptNum) const; |
| 400 |
PitchIter getPitchADPCMIterator(int ptNum) const; |
| 401 |
std::multiset<int> getPitchADPCMUsers(int ptNum) const; |
| 402 |
std::vector<int> getPitchADPCMEntriedIndices() const; |
| 403 |
int findFirstAssignablePitchADPCM() const; |
| 404 |
|
| 405 |
void setInstrumentADPCMPanEnabled(int instNum, bool enabled); |
| 406 |
bool getInstrumentADPCMPanEnabled(int instNum) const; |
| 407 |
void setInstrumentADPCMPan(int instNum, int panNum); |
| 408 |
int getInstrumentADPCMPan(int instNum); |
| 409 |
void addPanADPCMSequenceData(int panNum, int data); |
| 410 |
void removePanADPCMSequenceData(int panNum); |
| 411 |
void setPanADPCMSequenceData(int panNum, int cnt, int data); |
| 412 |
std::vector<PanUnit> getPanADPCMSequence(int panNum); |
| 413 |
void addPanADPCMLoop(int panNum, const InstrumentSequenceLoop& loop); |
| 414 |
void removePanADPCMLoop(int panNum, int begin, int end); |
| 415 |
void changePanADPCMLoop(int panNum, int prevBegin, int prevEnd, const InstrumentSequenceLoop& loop); |
| 416 |
void clearPanADPCMLoops(int panNum); |
| 417 |
InstrumentSequenceLoopRoot getPanADPCMLoopRoot(int panNum) const; |
| 418 |
void setPanADPCMRelease(int panNum, const InstrumentSequenceRelease& release); |
| 419 |
InstrumentSequenceRelease getPanADPCMRelease(int panNum) const; |
| 420 |
PanIter getPanADPCMIterator(int panNum) const; |
| 421 |
std::multiset<int> getPanADPCMUsers(int panNum) const; |
| 422 |
std::vector<int> getPanADPCMEntriedIndices() const; |
| 423 |
int findFirstAssignablePanADPCM() const; |
| 424 |
|
| 425 |
private: |
| 426 |
std::array<std::shared_ptr<SampleADPCM>, 128> sampADPCM_; |
| 427 |
std::array<std::shared_ptr<InstrumentSequenceProperty<ADPCMEnvelopeUnit>>, 128> envADPCM_; |
| 428 |
std::array<std::shared_ptr<InstrumentSequenceProperty<ArpeggioUnit>>, 128> arpADPCM_; |
| 429 |
std::array<std::shared_ptr<InstrumentSequenceProperty<PitchUnit>>, 128> ptADPCM_; |
| 430 |
std::array<std::shared_ptr<InstrumentSequenceProperty<PanUnit>>, 128> panADPCM_; |
| 431 |
|
| 432 |
bool equalPropertiesADPCM(std::shared_ptr<AbstractInstrument> a, std::shared_ptr<AbstractInstrument> b) const; |
| 433 |
|
| 434 |
//----- Drumkit methods ----- |
| 435 |
public: |
| 436 |
void setInstrumentDrumkitSamplesEnabled(int instNum, int key, bool enabled); |
| 437 |
bool getInstrumentDrumkitSamplesEnabled(int instNum, int key) const; |
| 438 |
void setInstrumentDrumkitSamples(int instNum, int key, int sampNum); |
| 439 |
int getInstrumentDrumkitSamples(int instNum, int key); |
| 440 |
|
| 441 |
void setInstrumentDrumkitPitch(int instNum, int key, int pitch); |
| 442 |
void setInstrumentDrumkitPan(int instNum, int key, int pan); |
| 443 |
|
| 444 |
private: |
| 445 |
bool equalPropertiesDrumkit(std::shared_ptr<AbstractInstrument> a, std::shared_ptr<AbstractInstrument> b) const; |
| 446 |
}; |