#pragma once #include "Jukebox.h" #include typedef std::pair TPPQRange; class CImperfector { public: CImperfector(TJBox_Float64 iSampleRate); private: void HandleDiffs(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount); private: std::uint8_t NoteFromCV(std::uint16_t iDefaultNote,TJBox_PropertyRef iNoteCVConnectedRef, TJBox_PropertyRef iNoteCVInputRef); private: TJBox_Float64 ComputeBatchLengthPPQ() const; private: std::pair ComputePPQRangesForCurrentBatch(TJBox_Float64 iBatchLengthPPQ) const; private: void ForwardNoteEvents(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount); private: bool IsPositionInCurrentBatch(std::int64_t iPosition, TPPQRange iCurrentBatchRange) const; private: void PlayRange(const TPPQRange& iRange); private: void StringizeAmount(TJBox_Float64 value, char* output); //xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx public: void RenderBatch(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount); private: TJBox_ObjectRef fTransportRef; private: TJBox_ObjectRef fCustomPropertiesRef; private: TJBox_ObjectRef fNoteStates; private: TJBox_ObjectRef fEnvironmenRef; private: TJBox_PropertyRef fstringizeAmountNoteCVInputRef; private: TJBox_PropertyRef fstringizeAmountNoteCVConnectedRef; private: TJBox_PropertyRef fstringizeSpeedNoteCVInputRef; private: TJBox_PropertyRef fstringizeSpeedNoteCVConnectedRef; private: bool fIsPlaying; private: bool fIsLooping; private: bool fIsBypassedByHost; private: bool fIsEnabled; private: TJBox_Float64 fSampleRate; private: TJBox_Float64 fTempo; private: std::uint8_t fStringizeAmountNote; private: std::uint8_t fStringizeSpeedNote; private: std::uint8_t fLastStringizeAmountNote; private: std::uint8_t fLastStringizeSpeedNote; private: std::int64_t fLastPosition; };