mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add a way to write a VectorStream back
This commit is contained in:
@@ -175,6 +175,22 @@ tresult PLUGIN_API VectorStream::queryInterface(Steinberg::FIDString _iid,
|
|||||||
return Steinberg::kNoInterface;
|
return Steinberg::kNoInterface;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tresult VectorStream::write_back(Steinberg::IBStream* stream) {
|
||||||
|
if (!stream) {
|
||||||
|
return Steinberg::kInvalidArgument;
|
||||||
|
}
|
||||||
|
|
||||||
|
int32 num_bytes_written;
|
||||||
|
assert(stream->seek(0, kIBSeekSet) == Steinberg::kResultOk);
|
||||||
|
assert(stream->write(buffer.data(), buffer.size(), &num_bytes_written) ==
|
||||||
|
Steinberg::kResultOk);
|
||||||
|
|
||||||
|
assert(num_bytes_written == 0 ||
|
||||||
|
static_cast<size_t>(num_bytes_written) == buffer.size());
|
||||||
|
|
||||||
|
return Steinberg::kResultOk;
|
||||||
|
}
|
||||||
|
|
||||||
size_t VectorStream::size() const {
|
size_t VectorStream::size() const {
|
||||||
return buffer.size();
|
return buffer.size();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,8 @@ class VectorStream : public Steinberg::IBStream,
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Read an existing stream.
|
* Read an existing stream.
|
||||||
|
*
|
||||||
|
* @throw std::runtime_error If we couldn't read from the stream.
|
||||||
*/
|
*/
|
||||||
VectorStream(Steinberg::IBStream* stream);
|
VectorStream(Steinberg::IBStream* stream);
|
||||||
|
|
||||||
@@ -134,6 +136,12 @@ class VectorStream : public Steinberg::IBStream,
|
|||||||
|
|
||||||
DECLARE_FUNKNOWN_METHODS
|
DECLARE_FUNKNOWN_METHODS
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the vector buffer back to an IBStream. After writing the seek
|
||||||
|
* position will be left at the end of the stream.
|
||||||
|
*/
|
||||||
|
tresult write_back(Steinberg::IBStream* stream);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the buffer's, used in the logging messages.
|
* Return the buffer's, used in the logging messages.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user