#pragma once #ifndef IMPERFECTORSTATE_H #define IMPERFECTORSTATE_H #include "Jukebox.h" #include /* include guards: In basic sample they uses this to check if this guard is define, if not, it`s starts define it */ class CImperfector { public: explicit CImperfector(); // No destructor since this class is allocated by JBox_Export_CreateNativeObject, // which means that the destructor would never be called anyway (though any memory we allocated will be automatically deallocated) // public: ~CVerySimpleSampler(); /** * @brief Checks incoming diffs to see if they're note on:s/note offs (i.e. MIDI notes) and if so, add voices to the voice pool * also checks any changes of the sample parameters */ private: void HandleDiffs(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount); private: TJBox_Int64 TagToInt(const TJBox_Tag iTag) const; private: TJBox_Bool TagToBool(const TJBox_Tag iTag) const; private: TJBox_Float64 TagToFloat(const TJBox_Tag iTag) const; public: void FlashNoteOnLamp(); public: void HandleNoteOnLampTurnOff(); public: void ResetIfRequested(); /** * @brief Main starting point for rendering audio * @details One of the first thing you'll stumble upon as a rack extension developer is if properties should be * fetched using "diffs" or by use of Jukebox SDK functions such as JBox_LoadMOMProperty. You have both * options and they have their pros and cons. In this example most properties are fetched using * JBox_LoadMOMProperty, but note diffs are fetched through iPropertyDiffs. In order to get these diffs * you have to set them up in realtime_controller.lua/rt_input_setup/notify . **/ public: void RenderBatch(const TJBox_PropertyDiff iPropertyDiffs[], TJBox_UInt32 iDiffCount); // State created in CreateNativeObject, references to different kind of properties in host private: TJBox_ObjectRef fEnvironmentRef; private: TJBox_ObjectRef fDeviceHostRef; private: TJBox_ObjectRef fTransportRef; private: TJBox_ObjectRef fNoteStates; private: TJBox_ObjectRef fMotherBoardCustomPropertiesRef; // VerySimpleSampler specific property references private: TJBox_ObjectRef fAudioOutLeftObjectRef; private: TJBox_ObjectRef fAudioOutRightObjectRef; private: TJBox_PropertyRef fNoteOnPropertyRef; private: TJBox_PropertyRef fSampleDataStringPropertyRef; // State only valid during a RenderBatch call private: TJBox_Float64 fSampleRate; // State to be used between calls (remembering last values) private: TJBox_Float64 fLastRequestResetCounter; private: TJBox_Float64 fSecondsBeforeNoteOnTurnOff; // // References to the native objects containing samples //private: NSUtil::StaticVector fSampleNativeObjectRefs; // // The current sample parameters for each zone //private: NSUtil::StaticVector fSampleZoneParameters; // // References to each sample parameter for each zone //private: NSUtil::StaticVector fSampleZoneObjectRefs; // // Our main pool of voices that render audio data //private: CVoicePool fVoicePool; private: bool fSampleDisplayNeedsUpdate; private: std::size_t fLastSampleZoneIndex; }; #endif