Write back preset meta data set by the plugin

The docs don't mention that this is a thing you should support, but
`IStreamAttributes` doesn't make much sense without this.
This commit is contained in:
Robbert van der Helm
2021-01-10 17:24:38 +01:00
parent 8971a65825
commit c514233922
4 changed files with 79 additions and 29 deletions
@@ -29,6 +29,28 @@ IMPLEMENT_FUNKNOWN_METHODS(YaAttributeList,
Steinberg::Vst::IAttributeList::iid)
#pragma GCC diagnostic pop
tresult YaAttributeList::write_back(
Steinberg::Vst::IAttributeList* stream) const {
if (!stream) {
return Steinberg::kInvalidArgument;
}
for (const auto& [key, value] : attrs_int) {
stream->setInt(key.c_str(), value);
}
for (const auto& [key, value] : attrs_float) {
stream->setFloat(key.c_str(), value);
}
for (const auto& [key, value] : attrs_string) {
stream->setString(key.c_str(), u16string_to_tchar_pointer(value));
}
for (const auto& [key, value] : attrs_binary) {
stream->setBinary(key.c_str(), value.data(), value.size());
}
return Steinberg::kResultOk;
}
tresult PLUGIN_API YaAttributeList::setInt(AttrID id, int64 value) {
attrs_int[id] = value;
return Steinberg::kResultOk;