mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-14 20:40:03 +02:00
Only initialize VST2 audio buffers on activation
Ardour apparently always calls `effMainsChanged()` with a value argument of 0 when unloading the plugin, regardless of whether it has actually initialized audio processing before that point.
This commit is contained in:
@@ -470,7 +470,11 @@ void Vst2Bridge::run() {
|
||||
// the same buffers. We cannot use `Vst2Bridge::dispatch_wrapper()`
|
||||
// for this because we need to directly return payload data that
|
||||
// won't be visible to the plugin at all.
|
||||
if (event.opcode == effMainsChanged) {
|
||||
// NOTE: Ardour will call `effMainsChanged()` with a value of 1
|
||||
// unconditionally when unloading a plugin, even when audio
|
||||
// playback has never been initialized (and `effSetBlockSize`
|
||||
// has never been called)
|
||||
if (event.opcode == effMainsChanged && event.value == 1) {
|
||||
// Returning another result this way is a bit ugly, but sadly
|
||||
// optimizations have never made code nicer to read
|
||||
return Vst2EventResult{.return_value = result.return_value,
|
||||
|
||||
Reference in New Issue
Block a user