20 #include <pluginterfaces/base/ftypes.h> 21 #include <pluginterfaces/vst/ivstmessage.h> 24 #include <public.sdk/source/vst/vstpresetfile.h> 33 using namespace Steinberg;
34 using namespace Steinberg::Vst;
46 explicit Message(IMessage *message) : fMessage(message) {}
50 return static_cast<MessageID>(getInt(
ATTR_MSG_ID, -1));
55 fMessage->getAttributes()->setInt(
ATTR_MSG_ID, messageID);
58 inline int64
getInt(IAttributeList::AttrID
id, int64 defaultValue)
const 61 if(fMessage->getAttributes()->getInt(
id, value) != kResultOk)
66 inline void setInt(IAttributeList::AttrID
id, int64 value)
68 fMessage->getAttributes()->setInt(
id, value);
71 inline double getFloat(IAttributeList::AttrID
id,
double defaultValue)
const 74 if(fMessage->getAttributes()->getFloat(
id, value) != kResultOk)
79 inline void setFloat(IAttributeList::AttrID
id,
double value)
81 fMessage->getAttributes()->setFloat(
id, value);
89 inline tresult
setBinary(IAttributeList::AttrID
id,
const T *iData, uint32 iSize)
91 return fMessage->getAttributes()->setBinary(
id, iData, iSize *
sizeof(T));
101 inline int32 getBinary(IAttributeList::AttrID
id, T *iData, uint32 iSize)
const;
108 tresult setSerializableValue(IAttributeList::AttrID
id,
IParamSerializer<T> const &iSerializer, T
const &iValue);
115 tresult getSerializableValue(IAttributeList::AttrID
id,
IParamSerializer<T> const &iSerializer, T &oValue)
const;
130 if(fMessage->getAttributes()->getBinary(
id, data, size) != kResultOk)
133 uint32 oSize = size /
sizeof(T);
134 oSize = std::min(iSize, oSize);
136 memcpy(iData, data, oSize *
sizeof(T));
163 IBStreamer streamer{&stream};
168 auto const &buffer = stream.getBuffer();
169 return setBinary(
id, buffer.int8Ptr(), buffer.getFillSize());
183 tresult res = fMessage->getAttributes()->getBinary(
id, data, size);
189 Buffer buffer(data, size);
192 stream.seek(IBStream::kIBSeekSet, 0,
nullptr);
194 IBStreamer streamer{&stream};
int64 getInt(IAttributeList::AttrID id, int64 defaultValue) const
Definition: Messaging.h:58
int32 getBinary(IAttributeList::AttrID id, T *iData, uint32 iSize) const
Definition: Messaging.h:125
IMessage * fMessage
Definition: Messaging.h:118
void setInt(IAttributeList::AttrID id, int64 value)
Definition: Messaging.h:66
Definition: Messaging.h:43
void setMessageID(MessageID messageID)
Definition: Messaging.h:53
tresult getSerializableValue(IAttributeList::AttrID id, IParamSerializer< T > const &iSerializer, T &oValue) const
Definition: Messaging.h:178
MessageID getMessageID() const
Definition: Messaging.h:48
virtual tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const =0
Message(IMessage *message)
Definition: Messaging.h:46
void setFloat(IAttributeList::AttrID id, double value)
Definition: Messaging.h:79
BufferStream()
Definition: Messaging.h:147
Definition: Messaging.h:144
BufferStream(Buffer &&iFrom)
Definition: Messaging.h:148
Definition: ParamSerializers.h:43
tresult setSerializableValue(IAttributeList::AttrID id, IParamSerializer< T > const &iSerializer, T const &iValue)
Definition: Messaging.h:159
tresult setBinary(IAttributeList::AttrID id, const T *iData, uint32 iSize)
Definition: Messaging.h:89
static const auto ATTR_MSG_ID
Definition: Messaging.h:36
double getFloat(IAttributeList::AttrID id, double defaultValue) const
Definition: Messaging.h:71
int MessageID
Definition: Messaging.h:38
virtual tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const =0
Buffer const & getBuffer() const
Definition: Messaging.h:152