Implement the CLAP log extension

This commit is contained in:
Robbert van der Helm
2022-10-09 00:21:29 +02:00
parent 2766f2ab09
commit 6cb12aad73
10 changed files with 114 additions and 22 deletions
+1
View File
@@ -199,6 +199,7 @@ void serialize(S& s, ClapMainThreadCallbackRequest& payload) {
*/
using ClapAudioThreadCallbackRequest =
std::variant<WantsConfiguration,
clap::ext::log::host::Log,
clap::ext::params::host::RequestFlush,
clap::ext::tail::host::Changed>;
+19 -19
View File
@@ -15,25 +15,25 @@ Yabridge currently tracks CLAP 1.1.1. The implementation status for CLAP's core
| `clap.plugin-factory` | :heavy_check_mark: |
| `clap.plugin-invalidation-factory/draft0` | :x: Not supported yet |
| extension | status |
| ------------------------- | ---------------------------------------------------- |
| `clap.audio-ports` | :heavy_check_mark: |
| `clap.audio-ports-config` | :x: Not supported yet |
| `clap.event-registry` | :x: Not needed for any of the supported extensions |
| `clap.gui` | :heavy_check_mark: Currently only does embedded GUIs |
| `clap.latency` | :heavy_check_mark: |
| `clap.log` | :x: Not supported yet |
| `clap.note-name` | :x: Not supported yet |
| `clap.note-ports` | :heavy_check_mark: |
| `clap.params` | :heavy_check_mark: |
| `clap.posix-fd-support` | :x: Not supported yet |
| `clap.render` | :x: Not supported yet |
| `clap.state` | :heavy_check_mark: |
| `clap.tail` | :heavy_check_mark: |
| `clap.thread-check` | :heavy_check_mark: |
| `clap.thread-pool` | :x: Not supported yet |
| `clap.timer-support` | :x: Not supported yet |
| `clap.voice-info` | :x: Not supported yet |
| extension | status |
| ------------------------- | ------------------------------------------------------------ |
| `clap.audio-ports` | :heavy_check_mark: |
| `clap.audio-ports-config` | :x: Not supported yet |
| `clap.event-registry` | :x: Not needed for any of the supported extensions |
| `clap.gui` | :heavy_check_mark: Currently only does embedded GUIs |
| `clap.latency` | :heavy_check_mark: |
| `clap.log` | :heavy_check_mark: Always supported with or without bridging |
| `clap.note-name` | :x: Not supported yet |
| `clap.note-ports` | :heavy_check_mark: |
| `clap.params` | :heavy_check_mark: |
| `clap.posix-fd-support` | :x: Not supported yet |
| `clap.render` | :x: Not supported yet |
| `clap.state` | :heavy_check_mark: |
| `clap.tail` | :heavy_check_mark: |
| `clap.thread-check` | :heavy_check_mark: No bridging involved |
| `clap.thread-pool` | :x: Not supported yet |
| `clap.timer-support` | :x: Not supported yet |
| `clap.voice-info` | :x: Not supported yet |
| draft extension | status |
| -------------------------------- | --------------------- |
+1 -1
View File
@@ -45,7 +45,7 @@ struct Log {
void serialize(S& s) {
s.value8b(owner_instance_id);
s.value4b(severity);
s.text(msg, 1 << 16);
s.text1b(msg, 1 << 16);
}
};
+3 -1
View File
@@ -19,6 +19,7 @@
#include <clap/ext/audio-ports.h>
#include <clap/ext/gui.h>
#include <clap/ext/latency.h>
#include <clap/ext/log.h>
#include <clap/ext/note-ports.h>
#include <clap/ext/params.h>
#include <clap/ext/state.h>
@@ -34,11 +35,12 @@ Host::Host(const clap_host_t& original)
url(original.url ? std::optional(original.url) : std::nullopt),
version((assert(original.version), original.version)) {}
std::array<std::pair<bool, const char*>, 7> SupportedHostExtensions::list()
std::array<std::pair<bool, const char*>, 8> SupportedHostExtensions::list()
const noexcept {
return {std::pair(supports_audio_ports, CLAP_EXT_AUDIO_PORTS),
std::pair(supports_gui, CLAP_EXT_GUI),
std::pair(supports_latency, CLAP_EXT_LATENCY),
std::pair(supports_log, CLAP_EXT_LOG),
std::pair(supports_note_ports, CLAP_EXT_NOTE_PORTS),
std::pair(supports_params, CLAP_EXT_PARAMS),
std::pair(supports_state, CLAP_EXT_STATE),
+3 -1
View File
@@ -84,6 +84,7 @@ struct SupportedHostExtensions {
bool supports_audio_ports = false;
bool supports_gui = false;
bool supports_latency = false;
bool supports_log = false;
bool supports_note_ports = false;
bool supports_params = false;
bool supports_state = false;
@@ -93,13 +94,14 @@ struct SupportedHostExtensions {
* Get a list of `<bool, extension_name>` tuples for the supported
* extensions. Used during logging.
*/
std::array<std::pair<bool, const char*>, 7> list() const noexcept;
std::array<std::pair<bool, const char*>, 8> list() const noexcept;
template <typename S>
void serialize(S& s) {
s.value1b(supports_audio_ports);
s.value1b(supports_gui);
s.value1b(supports_latency);
s.value1b(supports_log);
s.value1b(supports_note_ports);
s.value1b(supports_params);
s.value1b(supports_state);