13#include "pluginterfaces/base/ibstream.h"
16#include "IPlugVST3_Parameter.h"
17#include "IPlugVST3_ControllerBase.h"
25 static bool GetState(T* pPlug, Steinberg::IBStream* pState)
32 if (pPlug->SerializeState(chunk))
43 Steinberg::int32 toSaveBypass = pPlug->GetBypassed() ? 1 : 0;
44 pState->write(&toSaveBypass,
sizeof (Steinberg::int32));
50 static bool SetState(T* pPlug, Steinberg::IBStream* pState)
56 const int bytesPerBlock = 128;
57 char buffer[bytesPerBlock];
61 Steinberg::int32 bytesRead = 0;
62 auto status = pState->read(buffer, (Steinberg::int32) bytesPerBlock, &bytesRead);
64 if (bytesRead <= 0 || (status != Steinberg::kResultTrue && pPlug->GetHost() != kHostWaveLab))
69 int pos = pPlug->UnserializeState(chunk,0);
71 Steinberg::int32 savedBypass = 0;
73 pState->seek(pos,Steinberg::IBStream::IStreamSeekMode::kIBSeekSet);
74 if (pState->read (&savedBypass, sizeof (Steinberg::int32)) != Steinberg::kResultOk) {
81 pController->UpdateParams(pPlug, savedBypass);
83 pPlug->OnRestoreState();
90static void IPlugVST3GetHost(
IPlugAPIBase* pPlug, Steinberg::FUnknown* context)
92 Steinberg::Vst::String128 tmpStringBuf;
93 char hostNameCString[128];
94 Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication>pApp(context);
96 if ((pPlug->
GetHost() == kHostUninit) && pApp)
98 pApp->getName(tmpStringBuf);
99 Steinberg::UString(tmpStringBuf, 128).toAscii(hostNameCString, 128);
100 pPlug->
SetHost(hostNameCString, 0);
Manages a block of memory, for plug-in settings store/recall.
int PutBytes(const void *pSrc, int nBytesToCopy)
Copies data into the chunk, placing it at the end, resizing if necessary.
uint8_t * GetData()
Gets a ptr to the chunk data.
int Size() const
Returns the current size of the chunk.
The base class of an IPlug plug-in, which interacts with the different plug-in APIs.
void SetHost(const char *host, int version)
Called to set the name of the current host, if known (calls on to HostSpecificInit() and OnHostIdenti...
Shared VST3 controller code.
Shared VST3 State management code.