14#include "reaper_plugin.h"
15#include "video_processor.h"
17#define REAPERAPI_IMPLEMENT
18#include "reaper_plugin_functions.h"
20bool (*DoFxLastTweakParmCtxMenu2)(
void* pFXDSP,
void* pHWND,
int xpos,
int ypos,
const char* headerStr);
31 int errorCount = REAPERAPI_LoadAPI([
this](
const char* str) {
32 return (
void*) mHostCallback(NULL, 0xdeadbeef, 0xdeadf00d, 0, (
void*) str, 0.0);
35 LogToReaper(
"some errors when loading reaper api functions\n");
44 void *pFXDSP = (
void*)mHostCallback(&mAEffect, 0xdeadbeef, 0xdeadf00e, 4, NULL, 0.0f);
46 *(VstIntPtr *)&DoFxLastTweakParmCtxMenu2 = mHostCallback(NULL, 0xdeadbeef, 0xdeadf00d, 0, (
void*)
"DoFxLastTweakParmCtxMenu2", 0.0);
48 if(DoFxLastTweakParmCtxMenu2)
49 DoFxLastTweakParmCtxMenu2(pFXDSP, pView, xpos, ypos, NULL);
52 void SetTrackVolume(
double gain)
54 MediaTrack* tr = GetReaperTrack();
57 SetMediaTrackInfo_Value(tr,
"D_VOL", gain);
60 void GetTakeName(WDL_String& str)
62 const char* name = ::GetTakeName(GetReaperTake());
67 void SetTakeName(
const char* name)
69 MediaItem_Take* tk = GetReaperTake();
72 GetSetMediaItemTakeInfo_String(tk,
"P_NAME",
const_cast<char*
>(name),
true);
77 LogToReaper(
"Plugin is not loaded into a Reaper take\n");
84 if (GetSetMediaTrackInfo_String(GetReaperTrack(),
"P_NAME", buf,
false) ==
true)
90 void SetTrackName(
const char* name)
92 GetSetMediaTrackInfo_String(GetReaperTrack(),
"P_NAME",
const_cast<char*
>(name),
true);
96 MediaTrack* GetReaperTrack()
98 return (MediaTrack*)mHostCallback(&mAEffect, 0xdeadbeef, 0xdeadf00e, 1, 0, 0.0);
101 MediaItem_Take* GetReaperTake()
103 return (MediaItem_Take*) mHostCallback(&mAEffect, 0xdeadbeef, 0xdeadf00e, 2, 0, 0.0);
108 MediaTrack* pTrack = GetReaperTrack();
113 void LogToReaper(
const char* str)
115 if(ShowConsoleMsg !=
nullptr)
119 void InformHostOfAddedParams(
int index,
int numAddedParams)
121 int listadj[2] = {index, numAddedParams};
122 mAEffect.numParams = NParams();
123 mHostCallback(&mAEffect, audioMasterVendorSpecific, 0xdeadbeef, audioMasterAutomate, listadj, 0.0);
126 void InformHostOfRemovedParams(
int index,
int numRemovedParams)
128 int listadj[2] = {index, -numRemovedParams};
129 mAEffect.numParams = NParams();
130 mHostCallback(&mAEffect, audioMasterVendorSpecific, 0xdeadbeef, audioMasterAutomate, listadj, 0.0);
133 void InitializeVideo(
void* staticProcessVideoFrame,
void* staticGetVideoParam)
135 void* pCtx = (
void*) mHostCallback(&mAEffect, 0xdeadbeef, 0xdeadf00e, 4, NULL, 0.0f);
139 IREAPERVideoProcessor *(*video_CreateVideoProcessor)(
void *fxctx,
int version);
140 *(
void**)&video_CreateVideoProcessor = (
void *) mHostCallback(&mAEffect, 0xdeadbeef, 0xdeadf00d, 0, (
void *)
"video_CreateVideoProcessor", 0.0f);
141 if (video_CreateVideoProcessor)
143 mVideoProc = video_CreateVideoProcessor(pCtx, IREAPERVideoProcessor::REAPER_VIDEO_PROCESSOR_VERSION);
146 mVideoProc->userdata =
this;
147 mVideoProc->process_frame = (IVideoFrame* (*)(IREAPERVideoProcessor*,
const double*,
int,
double,
double,
int)) staticProcessVideoFrame;
148 mVideoProc->get_parameter_value = (bool (*)(IREAPERVideoProcessor*, int,
double *)) staticGetVideoParam;
163 IREAPERVideoProcessor* mVideoProc =
nullptr;
Reaper specific VST2.4 API base class for an IPlug plug-in.
void CreateParameterPopup(void *pView, int xpos, int ypos)
Pop up Reaper's "Last touched FX" dialog, in order to set envelopes etc for the last touched paramete...
void GetTrackColor(int &r, int &g, int &b) override
Get the color of the track that the plug-in is inserted on.
void GetTrackName(WDL_String &str) override
Get the name of the track that the plug-in is inserted on.
VST2.4 API base class for an IPlug plug-in.