1
1

Imperfector.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #pragma once
  2. #include "Jukebox.h"
  3. #include <utility>
  4. typedef std::pair<std::int64_t, std::int64_t> TPPQRange;
  5. class CImperfector
  6. {
  7. public: CImperfector(TJBox_Float64 iSampleRate);
  8. private: void HandleDiffs(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount);
  9. private: std::uint8_t NoteFromCV(std::uint16_t iDefaultNote,TJBox_PropertyRef iNoteCVConnectedRef, TJBox_PropertyRef iNoteCVInputRef);
  10. private: TJBox_Float64 ComputeBatchLengthPPQ() const;
  11. private: std::pair<TPPQRange, TPPQRange> ComputePPQRangesForCurrentBatch(TJBox_Float64 iBatchLengthPPQ) const;
  12. private: void ForwardNoteEvents(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount);
  13. private: bool IsPositionInCurrentBatch(std::int64_t iPosition, TPPQRange iCurrentBatchRange) const;
  14. private: void PlayRange(const TPPQRange& iRange);
  15. private: void StringizeAmount(TJBox_Float64 value, char* output); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
  16. public: void RenderBatch(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount);
  17. private: TJBox_ObjectRef fTransportRef;
  18. private: TJBox_ObjectRef fCustomPropertiesRef;
  19. private: TJBox_ObjectRef fNoteStates;
  20. private: TJBox_ObjectRef fEnvironmenRef;
  21. private: TJBox_PropertyRef fstringizeAmountNoteCVInputRef;
  22. private: TJBox_PropertyRef fstringizeAmountNoteCVConnectedRef;
  23. private: TJBox_PropertyRef fstringizeSpeedNoteCVInputRef;
  24. private: TJBox_PropertyRef fstringizeSpeedNoteCVConnectedRef;
  25. private: bool fIsPlaying;
  26. private: bool fIsLooping;
  27. private: bool fIsBypassedByHost;
  28. private: bool fIsEnabled;
  29. private: TJBox_Float64 fSampleRate;
  30. private: TJBox_Float64 fTempo;
  31. private: std::uint8_t fStringizeAmountNote;
  32. private: std::uint8_t fStringizeSpeedNote;
  33. private: std::uint8_t fLastStringizeAmountNote;
  34. private: std::uint8_t fLastStringizeSpeedNote;
  35. private: std::int64_t fLastPosition;
  36. };