mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Read preset meta data in the same way as contexts
This commit is contained in:
@@ -16,6 +16,8 @@
|
||||
|
||||
#include "attribute-list.h"
|
||||
|
||||
#include <pluginterfaces/vst/vstpresetkeys.h>
|
||||
|
||||
#include "pluginterfaces/vst/ivstchannelcontextinfo.h"
|
||||
|
||||
/**
|
||||
@@ -47,6 +49,31 @@ const static char* channel_context_integer_keys[] = {
|
||||
const static char* channel_context_binary_keys[] = {
|
||||
Steinberg::Vst::ChannelContext::kChannelImageKey};
|
||||
|
||||
/**
|
||||
* These are the meta data keys used for `IStreamAttributes`. We need to keep
|
||||
* track of this because `IAttributeList` has no way to just iterate over the
|
||||
* stored keys. We'll read these from the host if the host supports this
|
||||
* interface, and if the plugin writes an attribute with one of these keys we'll
|
||||
* write the value back to the host.
|
||||
*
|
||||
* TODO: There's also `Steinberg::Vst::PresetAttributes::kFilePathStringType`
|
||||
* This would require translating between Windows and Unix style paths,
|
||||
* which we can't easily do outside of Wine. If this ends up being
|
||||
* important, then we'll have to shell out to `winepath` which is not
|
||||
* ideal. On the Wine side we can just use the `wine_get_dos_file_name`
|
||||
* and `wine_get_unix_file_name` functions instead. Requesting this should
|
||||
* also use a 1024 character buffer.
|
||||
*/
|
||||
const static char* stream_meta_data_string_keys[] = {
|
||||
Steinberg::Vst::PresetAttributes::kPlugInName,
|
||||
Steinberg::Vst::PresetAttributes::kPlugInCategory,
|
||||
Steinberg::Vst::PresetAttributes::kInstrument,
|
||||
Steinberg::Vst::PresetAttributes::kStyle,
|
||||
Steinberg::Vst::PresetAttributes::kCharacter,
|
||||
Steinberg::Vst::PresetAttributes::kStateType,
|
||||
Steinberg::Vst::PresetAttributes::kName,
|
||||
Steinberg::Vst::PresetAttributes::kFileName};
|
||||
|
||||
YaAttributeList::YaAttributeList(){FUNKNOWN_CTOR}
|
||||
|
||||
YaAttributeList::~YaAttributeList() {
|
||||
@@ -115,6 +142,23 @@ YaAttributeList YaAttributeList::read_channel_context(
|
||||
return attributes;
|
||||
}
|
||||
|
||||
YaAttributeList YaAttributeList::read_stream_attributes(
|
||||
Steinberg::Vst::IAttributeList* stream_attributes) {
|
||||
YaAttributeList attributes{};
|
||||
// Copy over all predefined preset meta data. `IAttributeList` does not
|
||||
// offer any interface to enumerate the stored keys.
|
||||
Steinberg::Vst::String128 vst_string{0};
|
||||
for (const auto& key : stream_meta_data_string_keys) {
|
||||
vst_string[0] = 0;
|
||||
if (stream_attributes->getString(key, vst_string, sizeof(vst_string)) ==
|
||||
Steinberg::kResultOk) {
|
||||
attributes.setString(key, vst_string);
|
||||
}
|
||||
}
|
||||
|
||||
return attributes;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaAttributeList::setInt(AttrID id, int64 value) {
|
||||
attrs_int[id] = value;
|
||||
return Steinberg::kResultOk;
|
||||
|
||||
Reference in New Issue
Block a user