mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Fix the semantics of YaPhysicalUIMapList
We're supposed to take the list provided by the host, and modify the target note expression values.
This commit is contained in:
@@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
#include "physical-ui-map-list.h"
|
#include "physical-ui-map-list.h"
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
|
||||||
YaPhysicalUIMapList::YaPhysicalUIMapList() {}
|
YaPhysicalUIMapList::YaPhysicalUIMapList() {}
|
||||||
|
|
||||||
YaPhysicalUIMapList::YaPhysicalUIMapList(
|
YaPhysicalUIMapList::YaPhysicalUIMapList(
|
||||||
@@ -27,3 +29,14 @@ Steinberg::Vst::PhysicalUIMapList YaPhysicalUIMapList::get() {
|
|||||||
.count = static_cast<Steinberg::uint32>(maps.size()),
|
.count = static_cast<Steinberg::uint32>(maps.size()),
|
||||||
.map = maps.data()};
|
.map = maps.data()};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void YaPhysicalUIMapList::write_back(
|
||||||
|
Steinberg::Vst::PhysicalUIMapList& list) const {
|
||||||
|
assert(list.count == maps.size());
|
||||||
|
|
||||||
|
// Write the note expression IDs as updated by the plugin (if the plugin
|
||||||
|
// updated them) back to the original list we've read from
|
||||||
|
for (Steinberg::uint32 i = 0; i < list.count; i++) {
|
||||||
|
list.map[i].noteExpressionTypeID = maps[i].noteExpressionTypeID;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -22,7 +22,10 @@
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Serialization wrapper around `PhysicalUIMapList` that allows loading such a
|
* Serialization wrapper around `PhysicalUIMapList` that allows loading such a
|
||||||
* list and recreating one from a `YaPhysicalUIMapList` object.
|
* list and writing the changes made by the plugin back to the original list.
|
||||||
|
* The host provides a list with the `physicalUITypeID` field set for each
|
||||||
|
* mapping, and the plugin then sets the `noteExpressionTypeID` to one of its
|
||||||
|
* note expression of it can handle it.
|
||||||
*/
|
*/
|
||||||
class YaPhysicalUIMapList {
|
class YaPhysicalUIMapList {
|
||||||
public:
|
public:
|
||||||
@@ -35,12 +38,19 @@ class YaPhysicalUIMapList {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Reconstruct the original `PhysicalUIMapList` object passed to the
|
* Reconstruct the original `PhysicalUIMapList` object passed to the
|
||||||
* constructor and return it. This is used as part of
|
* constructor and return it. This is used to handle
|
||||||
* `YaProcessData::get()`. The returned object is valid as long as this
|
* `INoteExpressionPhysicalUIMapping::getPhysicalUIMapping()` on the Wine
|
||||||
* object is alive.
|
* plugin host side. The returned object is valid as long as this object is
|
||||||
|
* alive.
|
||||||
*/
|
*/
|
||||||
Steinberg::Vst::PhysicalUIMapList get();
|
Steinberg::Vst::PhysicalUIMapList get();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the `noteExpressionTypeID` values stored in `maps` back to the
|
||||||
|
* original physical UI mapping list we copied `maps` from.
|
||||||
|
*/
|
||||||
|
void write_back(Steinberg::Vst::PhysicalUIMapList& list) const;
|
||||||
|
|
||||||
template <typename S>
|
template <typename S>
|
||||||
void serialize(S& s) {
|
void serialize(S& s) {
|
||||||
s.container(maps, 1 << 31);
|
s.container(maps, 1 << 31);
|
||||||
|
|||||||
Reference in New Issue
Block a user