mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 12:10:09 +02:00
Use the small buffer optimization for VST3 SysEx
We apparently didn't do that yet. SysEx should be super rare (outside of octave switching on Arturia keyboards), but there's still no reason not to do it.
This commit is contained in:
@@ -33,6 +33,12 @@ Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
- The `editor_double_embed` option added in yabridge 1.4.0 has been removed as
|
||||
the `editor_coordinate_hack` option supersedes it.
|
||||
|
||||
### Changed
|
||||
|
||||
- VST3 Data (SysEx) events now use the same small buffer optimization we use for
|
||||
VST2 SysEx events. This avoids allocations when a VST3 plugin sends or
|
||||
receives a SysEx event.
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fixed _New Sonic Arts' Vice_ plugin freezing when loading the plugin. This
|
||||
|
||||
@@ -24,9 +24,12 @@ YaDataEvent::YaDataEvent(const Steinberg::Vst::DataEvent& event) noexcept
|
||||
: type(event.type), buffer(event.bytes, event.bytes + event.size) {}
|
||||
|
||||
Steinberg::Vst::DataEvent YaDataEvent::get() const noexcept {
|
||||
return Steinberg::Vst::DataEvent{.size = static_cast<uint32>(buffer.size()),
|
||||
.type = type,
|
||||
.bytes = buffer.data()};
|
||||
static_assert(sizeof(decltype(buffer)::value_type) == sizeof(uint8));
|
||||
|
||||
return Steinberg::Vst::DataEvent{
|
||||
.size = static_cast<uint32>(buffer.size()),
|
||||
.type = type,
|
||||
.bytes = reinterpret_cast<const uint8*>(buffer.data())};
|
||||
}
|
||||
|
||||
YaNoteExpressionTextEvent::YaNoteExpressionTextEvent() noexcept {}
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
/**
|
||||
* A wrapper around `DataEvent` for serialization purposes, as this event
|
||||
* contains a heap array.
|
||||
* contains a heap array. This would presumably be used for SysEx.
|
||||
*/
|
||||
struct YaDataEvent {
|
||||
YaDataEvent() noexcept;
|
||||
@@ -50,12 +50,18 @@ struct YaDataEvent {
|
||||
Steinberg::Vst::DataEvent get() const noexcept;
|
||||
|
||||
uint32 type;
|
||||
std::vector<uint8> buffer;
|
||||
|
||||
/**
|
||||
* We'll just abuse the standard library's Small String Optimization to
|
||||
* avoid allocations for small messages, just like we do for VST2 SysEx
|
||||
* events.
|
||||
*/
|
||||
std::string buffer;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value4b(type);
|
||||
s.container1b(buffer, 1 << 16);
|
||||
s.text1b(buffer, 1 << 16);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user