20 #include <pongasoft/logging/logging.h> 21 #include <pluginterfaces/vst/vsttypes.h> 22 #include <base/source/fstreamer.h> 31 using namespace Steinberg;
32 using namespace Steinberg::Vst;
47 virtual tresult readFromStream(IBStreamer &iStreamer,
ParamType &oValue)
const = 0;
48 virtual tresult writeToStream(
const ParamType &iValue, IBStreamer &oStreamer)
const = 0;
54 s.precision(iPrecision);
55 s.setf(std::ios::fixed);
56 writeToStream(iValue, s);
64 namespace IBStreamHelper {
67 inline tresult
readDouble(IBStreamer &iStreamer,
double &oValue)
70 if(!iStreamer.readDouble(value))
77 inline tresult
readFloat(IBStreamer &iStreamer,
float &oValue)
80 if(!iStreamer.readFloat(value))
87 template<
typename Int>
88 inline tresult
readFloatArray(IBStreamer &iStreamer,
float *oValue, Int iCount)
90 for(Int i = 0; i < iCount; i++)
92 if(!iStreamer.readFloat(oValue[i]))
100 inline tresult
readInt64(IBStreamer &iStreamer, int64 &oValue)
103 if(!iStreamer.readInt64(value))
110 inline tresult
readInt64u(IBStreamer &iStreamer, uint64 &oValue)
113 if(!iStreamer.readInt64u(value))
120 inline tresult
readInt32(IBStreamer &iStreamer, int32 &oValue)
123 if(!iStreamer.readInt32(value))
130 inline tresult
readBool(IBStreamer &iStreamer,
bool &oValue)
133 if(!iStreamer.readBool(value))
154 oStreamer.writeDouble(iValue);
177 oStreamer.writeDouble(iValue);
192 template<
int size = 128>
201 if(iStreamer.readRaw(static_cast<void*>(oValue), size) == size)
203 oValue[size - 1] = 0;
213 if(oStreamer.writeRaw(static_cast<void const *>(iValue), size) == size)
222 if(std::find(std::begin(iValue), std::end(iValue), 0) != std::end(iValue))
230 std::copy(std::begin(iValue), std::end(iValue), std::begin(str));
233 DLOG_F(WARNING,
"%s not properly null terminated!", str);
Definition: ParamSerializers.h:167
tresult readDouble(IBStreamer &iStreamer, double &oValue)
Definition: ParamSerializers.h:67
tresult readFloat(IBStreamer &iStreamer, float &oValue)
Definition: ParamSerializers.h:77
virtual void writeToStream(ParamType const &iValue, std::ostream &oStream) const
Definition: ParamSerializers.h:50
tresult readInt64u(IBStreamer &iStreamer, uint64 &oValue)
Definition: ParamSerializers.h:110
Definition: ParamSerializers.h:144
ParamValue ParamType
Definition: ParamSerializers.h:46
tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
Definition: ParamSerializers.h:152
tresult readInt32(IBStreamer &iStreamer, int32 &oValue)
Definition: ParamSerializers.h:120
void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
Definition: ParamSerializers.h:220
tresult readFloatArray(IBStreamer &iStreamer, float *oValue, Int iCount)
Definition: ParamSerializers.h:88
tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
Definition: ParamSerializers.h:211
Definition: ParamSerializers.h:193
void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
Definition: ParamSerializers.h:158
tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
Definition: ParamSerializers.h:199
tresult readBool(IBStreamer &iStreamer, bool &oValue)
Definition: ParamSerializers.h:130
char[size] ParamType
Definition: ParamSerializers.h:196
Definition: ParamSerializers.h:43
tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
Definition: ParamSerializers.h:170
tresult writeToStream(const ParamType &iValue, IBStreamer &oStreamer) const override
Definition: ParamSerializers.h:175
tresult readInt64(IBStreamer &iStreamer, int64 &oValue)
Definition: ParamSerializers.h:100
virtual std::string toString(ParamType const &iValue, int32 iPrecision) const
Definition: ParamSerializers.h:51
void writeToStream(ParamType const &iValue, std::ostream &oStream) const override
Definition: ParamSerializers.h:181
tresult readFromStream(IBStreamer &iStreamer, ParamType &oValue) const override
Definition: ParamSerializers.h:147