Audacity 3.2.0
Public Types | Public Member Functions | Public Attributes | List of all members
VSTMessage Struct Reference

#include <VSTWrapper.h>

Inheritance diagram for VSTMessage:
[legend]
Collaboration diagram for VSTMessage:
[legend]

Public Types

using ParamVector = std::vector< std::optional< double > >
 

Public Member Functions

 VSTMessage (std::vector< char > chunk, ParamVector params)
 
 VSTMessage (int id, double value, size_t numParams)
 
 ~VSTMessage () override
 
std::unique_ptr< Message > Clone () const override
 
void Assign (Message &&src) override
 
void Merge (Message &&src) override
 
- Public Member Functions inherited from EffectSettingsAccess::Message
virtual ~Message ()
 
virtual std::unique_ptr< MessageClone () const =0
 
virtual void Assign (Message &&src)=0
 Update one Message object from another, which is then left "empty". More...
 
virtual void Merge (Message &&src)=0
 Combine one Message object with another, which is then left "empty". More...
 

Public Attributes

std::vector< char > mChunk
 
ParamVector mParamsVec
 

Detailed Description

Definition at line 298 of file VSTWrapper.h.

Member Typedef Documentation

◆ ParamVector

using VSTMessage::ParamVector = std::vector<std::optional<double> >

Definition at line 300 of file VSTWrapper.h.

Constructor & Destructor Documentation

◆ VSTMessage() [1/2]

VSTMessage::VSTMessage ( std::vector< char >  chunk,
ParamVector  params 
)
inlineexplicit

Definition at line 303 of file VSTWrapper.h.

304 : mChunk(std::move(chunk)),
305 mParamsVec(std::move(params))
306 {
307 }
EffectDistortionSettings params
ParamVector mParamsVec
Definition: VSTWrapper.h:325
std::vector< char > mChunk
Definition: VSTWrapper.h:324

◆ VSTMessage() [2/2]

VSTMessage::VSTMessage ( int  id,
double  value,
size_t  numParams 
)
inlineexplicit

Definition at line 310 of file VSTWrapper.h.

311 {
312 mParamsVec.resize(numParams, std::nullopt);
313 if (id < numParams)
314 mParamsVec[id] = value;
315 }
int id

References id, and mParamsVec.

◆ ~VSTMessage()

VSTMessage::~VSTMessage ( )
overridedefault

Member Function Documentation

◆ Assign()

void VSTMessage::Assign ( Message &&  src)
override

Definition at line 252 of file VSTWrapper.cpp.

253{
254 VSTMessage& vstSrc = static_cast<VSTMessage&>(src);
255
256 mChunk = vstSrc.mChunk;
257 vstSrc.mChunk.resize(0); // capacity will be preserved though
258
259 assert(mParamsVec.size() == vstSrc.mParamsVec.size());
260
261 for (size_t i = 0; i < mParamsVec.size(); i++)
262 {
263 mParamsVec[i] = vstSrc.mParamsVec[i];
264
265 // consume the source value
266 vstSrc.mParamsVec[i] = std::nullopt;
267 }
268}

References VSTWrapper::mChunk, mChunk, and mParamsVec.

◆ Clone()

auto VSTMessage::Clone ( ) const
overridevirtual

Implements EffectSettingsAccess::Message.

Definition at line 243 of file VSTWrapper.cpp.

244{
245 auto result = std::make_unique<VSTMessage>(*this);
246 // Make sure of the chunk capacity
247 result->mChunk.reserve(this->mChunk.capacity());
248
249 return result;
250}

References VSTWrapper::mChunk.

◆ Merge()

void VSTMessage::Merge ( Message &&  src)
override

Definition at line 270 of file VSTWrapper.cpp.

271{
272 VSTMessage& vstSrc = static_cast<VSTMessage&>(src);
273
274 bool chunkWasAssigned = false;
275
276 if ( ! vstSrc.mChunk.empty() )
277 {
278 mChunk = vstSrc.mChunk;
279 chunkWasAssigned = true;
280 }
281
282 vstSrc.mChunk.resize(0); // capacity will be preserved though
283
284 assert(mParamsVec.size() == vstSrc.mParamsVec.size());
285
286 for (size_t i = 0; i < mParamsVec.size(); i++)
287 {
288 if (chunkWasAssigned)
289 {
290 mParamsVec[i] = vstSrc.mParamsVec[i];
291 }
292 else
293 {
294 // if src val is nullopt, do not copy it to dest
295 if (vstSrc.mParamsVec[i] != std::nullopt)
296 {
297 mParamsVec[i] = vstSrc.mParamsVec[i];
298 }
299 }
300
301 // consume the source value
302 vstSrc.mParamsVec[i] = std::nullopt;
303 }
304
305}

References VSTWrapper::mChunk, mChunk, and mParamsVec.

Member Data Documentation

◆ mChunk

std::vector<char> VSTMessage::mChunk

Definition at line 324 of file VSTWrapper.h.

Referenced by Assign(), Merge(), and VSTInstance::RealtimeProcessStart().

◆ mParamsVec

ParamVector VSTMessage::mParamsVec

Definition at line 325 of file VSTWrapper.h.

Referenced by Assign(), Merge(), and VSTMessage().


The documentation for this struct was generated from the following files: