mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Move AEffect updating to a function
This commit is contained in:
+1
-17
@@ -313,23 +313,7 @@ auto passthrough_event(AEffect* plugin, F callback) {
|
||||
// return value, we will update values on the native VST
|
||||
// plugin's `AEffect` object. This is triggered by the
|
||||
// `audioMasterIOChanged` callback from the hosted VST plugin.
|
||||
|
||||
// These are the same fields written by bitsery in the
|
||||
// initialization of `PluginBridge`. I can't think of a way to
|
||||
// reuse the serializer without first having to serialize
|
||||
// `updated_plugin` first though.
|
||||
plugin->magic = updated_plugin.magic;
|
||||
plugin->numPrograms = updated_plugin.numPrograms;
|
||||
plugin->numParams = updated_plugin.numParams;
|
||||
plugin->numInputs = updated_plugin.numInputs;
|
||||
plugin->numOutputs = updated_plugin.numOutputs;
|
||||
plugin->flags = updated_plugin.flags;
|
||||
plugin->initialDelay = updated_plugin.initialDelay;
|
||||
plugin->empty3a = updated_plugin.empty3a;
|
||||
plugin->empty3b = updated_plugin.empty3b;
|
||||
plugin->unkown_float = updated_plugin.unkown_float;
|
||||
plugin->uniqueID = updated_plugin.uniqueID;
|
||||
plugin->version = updated_plugin.version;
|
||||
update_aeffect(*plugin, updated_plugin);
|
||||
|
||||
return nullptr;
|
||||
},
|
||||
|
||||
@@ -91,3 +91,20 @@ std::vector<uint8_t>& DynamicSpeakerArrangement::as_raw_data() {
|
||||
|
||||
return speaker_arrangement_buffer;
|
||||
}
|
||||
|
||||
AEffect& update_aeffect(AEffect& plugin, const AEffect& updated_plugin) {
|
||||
plugin.magic = updated_plugin.magic;
|
||||
plugin.numPrograms = updated_plugin.numPrograms;
|
||||
plugin.numParams = updated_plugin.numParams;
|
||||
plugin.numInputs = updated_plugin.numInputs;
|
||||
plugin.numOutputs = updated_plugin.numOutputs;
|
||||
plugin.flags = updated_plugin.flags;
|
||||
plugin.initialDelay = updated_plugin.initialDelay;
|
||||
plugin.empty3a = updated_plugin.empty3a;
|
||||
plugin.empty3b = updated_plugin.empty3b;
|
||||
plugin.unkown_float = updated_plugin.unkown_float;
|
||||
plugin.uniqueID = updated_plugin.uniqueID;
|
||||
plugin.version = updated_plugin.version;
|
||||
|
||||
return plugin;
|
||||
}
|
||||
|
||||
@@ -85,10 +85,21 @@ struct overload : Ts... {
|
||||
template <class... Ts>
|
||||
overload(Ts...) -> overload<Ts...>;
|
||||
|
||||
/**
|
||||
* Update an `AEffect` object, copying values from `updated_plugin` to `plugin`.
|
||||
* This will copy all flags and regular values, leaving all pointers in `plugin`
|
||||
* untouched. This should be updating the same values as the serialization
|
||||
* function right below this.
|
||||
*/
|
||||
AEffect& update_aeffect(AEffect& plugin, const AEffect& updated_plugin);
|
||||
|
||||
/**
|
||||
* The serialization function for `AEffect` structs. This will s serialize all
|
||||
* of the values but it will not touch any of the pointer fields. That way you
|
||||
* can deserialize to an existing `AEffect` instance.
|
||||
* can deserialize to an existing `AEffect` instance. Since we can't always
|
||||
* deserialize directly into an existing `AEffect`, there is also another
|
||||
* function called `update_aeffect()` that copies values from one `AEffect` to
|
||||
* another. Both of these functions should be updating the same values.
|
||||
*/
|
||||
template <typename S>
|
||||
void serialize(S& s, AEffect& plugin) {
|
||||
|
||||
Reference in New Issue
Block a user