clap

CLAP Audio Plugin API
Log | Files | Refs | README | LICENSE

commit 493ce6b74b1692162c47a7e5010377b3766c2e5f
parent 0d7fcf69887244c3d08058104510281b0a32ba7e
Author: Alexandre BIQUE <bique.alexandre@gmail.com>
Date:   Wed, 15 Sep 2021 12:51:52 +0200

Send the transport info to the gui

Diffstat:
Mexamples/plugins/abstract-gui.hh | 2++
Mexamples/plugins/core-plugin.cc | 10++++++++++
Mexamples/plugins/core-plugin.hh | 4++++
Mexamples/plugins/remote-gui.cc | 6++++++
4 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/examples/plugins/abstract-gui.hh b/examples/plugins/abstract-gui.hh @@ -26,6 +26,8 @@ namespace clap { protected: CorePlugin &_plugin; + + bool _isTransportSubscribed = false; }; } // namespace clap \ No newline at end of file diff --git a/examples/plugins/core-plugin.cc b/examples/plugins/core-plugin.cc @@ -194,6 +194,16 @@ namespace clap { process->out_events->push_back(process->out_events, &ev); } + + if (!_hasTransportCopy) { + if (process->transport) { + _hasTransport = true; + memcpy(&_transportCopy, &process->transport, sizeof(_transportCopy)); + } else + _hasTransport = false; + + _hasTransportCopy = true; + } } uint32_t CorePlugin::processEvents(const clap_process *process, diff --git a/examples/plugins/core-plugin.hh b/examples/plugins/core-plugin.hh @@ -187,5 +187,9 @@ namespace clap { Parameters _parameters; static const constexpr uint32_t _paramSmoothingDuration = 64; + + bool _hasTransportCopy = false; + bool _hasTransport = false; + clap_event_transport _transportCopy; }; } // namespace clap \ No newline at end of file diff --git a/examples/plugins/remote-gui.cc b/examples/plugins/remote-gui.cc @@ -208,6 +208,12 @@ namespace clap { messages::ParameterValueRequest rq{paramId, value.value, value.mod}; _channel->sendRequestAsync(rq); }); + + if (_isTransportSubscribed && _plugin._hasTransportCopy) { + messages::UpdateTransportRequest rq{_plugin._hasTransport, _plugin._hasTransportCopy}; + _channel->sendRequestAsync(rq); + _plugin._hasTransportCopy = false; + } } } // namespace clap \ No newline at end of file