21 #include "wdlstring.h" 37 ParamTuple(
int idx = kNoParameter,
double value = 0.)
46 SysExData(
int offset = 0,
int size = 0,
const void* pData = 0)
50 assert(size < MAX_SYSEX_SIZE);
53 memcpy(mData, pData, size);
55 memset(mData, 0, MAX_SYSEX_SIZE);
60 uint8_t mData[MAX_SYSEX_SIZE];
73 static inline int GetBytes(
const uint8_t* pSrc,
int srcSize,
void* pDst,
int nBytesToCopy,
int startPos)
75 int endPos = startPos + nBytesToCopy;
76 if (startPos >= 0 && endPos <= srcSize)
78 memcpy(pDst, pSrc + startPos, nBytesToCopy);
90 static inline int GetStr(
const uint8_t* pSrc,
int srcSize, WDL_String& str,
int startPos)
93 int strStartPos = GetBytes(pSrc, srcSize, &len,
sizeof(len), startPos);
96 int strEndPos = strStartPos + len;
97 if (strEndPos <= srcSize)
100 str.Set((
char*) (pSrc + strStartPos), len);
122 int magic = IPLUG_VERSION_MAGIC;
124 int ver = IPLUG_VERSION;
134 int magic = 0, ver = 0;
135 int magicpos = chunk.
Get(&magic, position);
137 if (magicpos > position && magic == IPLUG_VERSION_MAGIC)
138 position = chunk.
Get(&ver, magicpos);
147 inline int PutBytes(
const void* pSrc,
int nBytesToCopy)
149 int n = mBytes.GetSize();
150 mBytes.Resize(n + nBytesToCopy);
151 memcpy(mBytes.Get() + n, pSrc, nBytesToCopy);
152 return mBytes.GetSize();
160 inline int GetBytes(
void* pDst,
int nBytesToCopy,
int startPos)
const 170 inline int Put(
const T* pVal)
172 return PutBytes(pVal,
sizeof(T));
181 inline int Get(T* pDst,
int startPos)
const 183 return GetBytes(pDst,
sizeof(T), startPos);
191 int slen = (int) strlen(str);
193 return PutBytes(str, slen);
200 inline int GetStr(WDL_String& str,
int startPos)
const 223 return mBytes.GetSize();
231 int n = mBytes.GetSize();
232 mBytes.Resize(newSize);
235 memset(mBytes.Get() + n, 0, (newSize - n));
259 return (otherChunk.
Size() == Size() && !memcmp(otherChunk.mBytes.Get(), mBytes.Get(), Size()));
263 WDL_TypedBuf<uint8_t> mBytes;
270 IByteStream(
const void *pData,
int dataSize) : mBytes(reinterpret_cast<const uint8_t *>(pData)), mSize(dataSize) {}
278 inline int GetBytes(
void* pDst,
int nBytesToCopy,
int startPos)
const 289 inline int Get(T* pDst,
int startPos)
const 291 return GetBytes(pDst,
sizeof(T), startPos);
298 inline int GetStr(WDL_String& str,
int startPos)
const 315 return (otherStream.
Size() == Size() && !memcmp(otherStream.mBytes, mBytes, Size()));
326 const uint8_t* mBytes;
346 mPos = mChunk.GetBytes(pBuf, nBytesToCopy, mPos);
357 mPos = mChunk.Get(pDst, mPos);
366 mPos = mChunk.GetStr(str, mPos);
394 const char* channelIOStr;
395 const char* pluginName;
396 const char* productName;
403 bool plugDoesMidiOut;
415 const char* bundleID;
419 const char* channelIOStr,
420 const char* pluginName,
421 const char* productName,
428 bool plugDoesMidiOut,
440 const char* bundleID)
444 , channelIOStr(channelIOStr)
445 , pluginName(pluginName)
446 , productName(productName)
448 , vendorVersion(vendorVersion)
452 , plugDoesMidiIn(plugDoesMidiIn)
453 , plugDoesMidiOut(plugDoesMidiOut)
454 , plugDoesMPE(plugDoesMPE)
455 , plugDoesChunks(plugDoesChunks)
457 , plugHasUI(plugHasUI)
458 , plugWidth(plugWidth)
459 , plugHeight(plugHeight)
460 , plugMinWidth(plugMinWidth)
461 , plugMaxWidth(plugMaxWidth)
462 , plugMinHeight(plugMinHeight)
463 , plugMaxHeight(plugMaxHeight)
464 , plugHostResize(plugHostResize)
470 template<
class TIN = PLUG_SAMPLE_SRC,
class TOUT = PLUG_SAMPLE_DST>
473 bool mConnected =
false;
474 TOUT** mData =
nullptr;
475 TIN* mIncomingData =
nullptr;
476 WDL_TypedBuf<TOUT> mScratchBuf;
485 : mDirection(direction)
490 int NChans()
const {
return mNChans; }
492 ERoute GetDirection()
const {
return mDirection; }
502 WDL_PtrList<IBusInfo> mBusInfo[2];
506 mBusInfo[0].Empty(
true);
507 mBusInfo[1].Empty(
true);
516 mBusInfo[direction].Add(
new IBusInfo(direction, NChans));
525 assert(index >= 0 && index < mBusInfo[direction].GetSize());
526 return mBusInfo[direction].Get(index);
537 if(index >= 0 && index < mBusInfo[direction].GetSize())
538 NChans = mBusInfo[direction].Get(index)->NChans();
548 return mBusInfo[direction].GetSize();
558 for(
int i = 0; i < mBusInfo[direction].GetSize(); i++)
559 total += mBusInfo[direction].Get(i)->NChans();
570 for(
auto i = 0; i < mBusInfo[direction].GetSize(); i++)
572 if(mBusInfo[direction].Get(i)->NChans() < 0)
583 double mTempo = DEFAULT_TEMPO;
584 double mSamplePos = -1.0;
585 double mPPQPos = -1.0;
586 double mLastBar = -1.0;
587 double mCycleStart = -1.0;
588 double mCycleEnd = -1.0;
591 int mDenominator = 4;
593 bool mTransportIsRunning =
false;
594 bool mTransportLoopEnabled =
false;
600 bool mInitialized =
false;
601 char mName[MAX_PRESET_NAME_LEN];
607 sprintf(mName,
"%s", UNUSED_PRESET_NAME);
615 char utf8[5] = { 0 };
624 IKeyPress(
const char* _utf8,
int vk,
bool s =
false,
bool c =
false,
bool a =
false)
631 void DBGPrint()
const { DBGMSG(
"VK: %i\n", VK); }
int Get(T *pDst, int startPos) const
Get arbitary typed data from the stream.
Utility functions and macros.
int GetStr(WDL_String &str)
Retrieve a string from the managed IByteChunk and put it in str .
int GetTotalNChannels(ERoute direction) const
Get the total number of channels across all direction buses for this IOConfig.
Helper class to maintain a read position whilst extracting data from an IByteChunk.
int Size() const
Returns the size of the stream.
void Clear()
Clears the chunk (resizes to 0)
int PutStr(const char *str)
Put a string into the IByteChunk.
int Get(T *pDst, int startPos) const
Get arbitary typed data from the IByteChunk.
static int GetIPlugVerFromChunk(const IByteChunk &chunk, int &position)
Helper method to retrieve the IPlug version number from the beginning of the byte chunk...
void Seek(int pos)
Set the current position in the managed IByteChunk.
An IOConfig is used to store bus info for each input/output configuration defined in the channel io s...
Manages a non-owned block of memory, for receiving arbitrary message byte streams.
const IBusInfo * GetBusInfo(ERoute direction, int index) const
int Put(const T *pVal)
Copies arbitary typed data into the IByteChunk.
Manages a block of memory, for plug-in settings store/recall.
bool IsEqual(IByteChunk &otherChunk) const
Compares the size & values of the data of another chunk with this one.
static int GetBytes(const uint8_t *pSrc, int srcSize, void *pDst, int nBytesToCopy, int startPos)
Copy raw bytes from a byte array, returning the new position for subsequent calls.
IPlug Constant definitions, Types, magic numbers.
bool IsEqual(IByteStream &otherStream) const
Compares the size & values of the data of another stream with this one.
A struct used for specifying baked-in factory presets.
int NBuses(ERoute direction) const
void AddBusInfo(ERoute direction, int NChans)
ERoute
Used to identify whether a bus/channel connection is an input or an output.
int Size() const
Returns the current size of the chunk.
int GetStr(WDL_String &str, int startPos) const
Get a string from the stream.
int Resize(int newSize)
Resizes the chunk.
Used to manage information about a bus such as whether it's an input or output, channel count...
Used to manage scratch buffers for each channel of I/O, which may involve converting from single to d...
IKeyPress(const char *_utf8, int vk, bool s=false, bool c=false, bool a=false)
static void InitChunkWithIPlugVer(IByteChunk &chunk)
This method is used in order to place the IPlug version number in the chunk when serialising data...
In certain cases we need to queue parameter changes for transferral between threads.
bool ContainsWildcard(ERoute direction) const
int Tell() const
Return the current position in the managed IByteChunk.
int Get(T *pDst)
Copy arbitary typed data out of the managed IByteChunk at the current position and update the positio...
int GetBytes(void *pDst, int nBytesToCopy, int startPos) const
Copy raw bytes from the stream, returning the new position for subsequent calls.
int GetStr(WDL_String &str, int startPos) const
Get a string from the IByteChunk.
MIDI and sysex structs/utilites.
uint8_t * GetData()
Gets a ptr to the chunk data.
int PutChunk(const IByteChunk *pRHS)
Put another IByteChunk into this one.
This structure is used when queueing Sysex messages.
const uint8_t * GetData() const
Gets a const ptr to the chunk data.
int PutBytes(const void *pSrc, int nBytesToCopy)
Copies data into the chunk, placing it at the end, resizing if nessecary.
int GetBytes(void *pDst, int nBytesToCopy, int startPos) const
Copy raw bytes from the IByteChunk, returning the new position for subsequent calls.
const uint8_t * GetData()
Gets a const ptr to the stream data.
Encapsulates information about the host transport state.
A helper class for IByteChunk and IByteStream that avoids code duplication.
static int GetStr(const uint8_t *pSrc, int srcSize, WDL_String &str, int startPos)
Get a string from a byte array, to a WDL_String, returning the new position for subsequent calls...
Used for key press info, such as ASCII representation, virtual key (mapped to win32 codes) and modifi...
int NChansOnBusSAFE(ERoute direction, int index) const
int GetBytes(void *pBuf, int nBytesToCopy)
Copy nBytesToCopy bytes from the managed IByteChunk into pBuf .