51 |
} |
} |
52 |
|
|
53 |
|
|
54 |
T increment() { |
T& increment() { |
55 |
if (iSize >= iCapacity) throw Exception("Array out of bounds"); |
if (iSize >= iCapacity) throw Exception("Array out of bounds"); |
56 |
return pData[iSize++]; |
return pData[iSize++]; |
57 |
} |
} |
373 |
bool isSmoothingOut() { return currentTimeStep < timeSteps; } |
bool isSmoothingOut() { return currentTimeStep < timeSteps; } |
374 |
}; |
}; |
375 |
|
|
376 |
|
|
377 |
|
const int MaxCCs = 10; |
378 |
|
|
379 |
/** |
/** |
380 |
* Continuous controller signal unit. |
* Continuous controller signal unit. |
381 |
* The level of this unit corresponds to the controllers changes |
* The level of this unit corresponds to the controllers changes |
426 |
|
|
427 |
public: |
public: |
428 |
|
|
429 |
CCSignalUnit(SignalUnitRack* rack, Listener* l = NULL): SignalUnit(rack), Ctrls(128) { |
CCSignalUnit(SignalUnitRack* rack, Listener* l = NULL): SignalUnit(rack), Ctrls(MaxCCs) { |
430 |
pListener = l; |
pListener = l; |
431 |
hasSmoothCtrls = isSmoothingOut = false; |
hasSmoothCtrls = isSmoothingOut = false; |
432 |
} |
} |
433 |
|
|
434 |
CCSignalUnit(const CCSignalUnit& Unit): SignalUnit(Unit.pRack), Ctrls(128) { Copy(Unit); } |
CCSignalUnit(const CCSignalUnit& Unit): SignalUnit(Unit.pRack), Ctrls(MaxCCs) { Copy(Unit); } |
435 |
void operator=(const CCSignalUnit& Unit) { Copy(Unit); } |
void operator=(const CCSignalUnit& Unit) { Copy(Unit); } |
436 |
|
|
437 |
void Copy(const CCSignalUnit& Unit) { |
void Copy(const CCSignalUnit& Unit) { |
443 |
} |
} |
444 |
|
|
445 |
void AddCC(uint8_t Controller, float Influence, short int Curve = -1, Smoother* pSmoother = NULL) { |
void AddCC(uint8_t Controller, float Influence, short int Curve = -1, Smoother* pSmoother = NULL) { |
446 |
|
if(Ctrls.size() >= Ctrls.capacity()) { |
447 |
|
std::cerr << "Maximum number of CC reached" << std::endl; |
448 |
|
return; |
449 |
|
} |
450 |
Ctrls.add(CC(Controller, Influence, Curve, pSmoother)); |
Ctrls.add(CC(Controller, Influence, Curve, pSmoother)); |
451 |
if (pSmoother != NULL) hasSmoothCtrls = true; |
if (pSmoother != NULL) hasSmoothCtrls = true; |
452 |
} |
} |
453 |
|
|
454 |
void RemoveAllCCs() { |
virtual void RemoveAllCCs() { Ctrls.clear(); } |
|
Ctrls.clear(); |
|
|
} |
|
455 |
|
|
456 |
int GetCCCount() { return Ctrls.size(); } |
int GetCCCount() { return Ctrls.size(); } |
457 |
|
|