mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Add structs for the CLAP note name extension
This commit is contained in:
@@ -28,6 +28,7 @@
|
|||||||
#include "clap/ext/gui.h"
|
#include "clap/ext/gui.h"
|
||||||
#include "clap/ext/latency.h"
|
#include "clap/ext/latency.h"
|
||||||
#include "clap/ext/log.h"
|
#include "clap/ext/log.h"
|
||||||
|
#include "clap/ext/note-name.h"
|
||||||
#include "clap/ext/note-ports.h"
|
#include "clap/ext/note-ports.h"
|
||||||
#include "clap/ext/params.h"
|
#include "clap/ext/params.h"
|
||||||
#include "clap/ext/render.h"
|
#include "clap/ext/render.h"
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// yabridge: a Wine plugin bridge
|
||||||
|
// Copyright (C) 2020-2022 Robbert van der Helm
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#include "note-name.h"
|
||||||
|
|
||||||
|
#include "../../../utils.h"
|
||||||
|
|
||||||
|
namespace clap {
|
||||||
|
namespace ext {
|
||||||
|
namespace note_name {
|
||||||
|
|
||||||
|
NoteName::NoteName(const clap_note_name_t& original)
|
||||||
|
: name(original.name),
|
||||||
|
port(original.port),
|
||||||
|
key(original.key),
|
||||||
|
channel(original.channel) {}
|
||||||
|
|
||||||
|
void NoteName::reconstruct(clap_note_name_t& note_name) const {
|
||||||
|
note_name = clap_note_name_t{};
|
||||||
|
strlcpy_buffer<sizeof(note_name.name)>(note_name.name, name);
|
||||||
|
note_name.port = port;
|
||||||
|
note_name.key = key;
|
||||||
|
note_name.channel = channel;
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace note_name
|
||||||
|
} // namespace ext
|
||||||
|
} // namespace clap
|
||||||
@@ -0,0 +1,136 @@
|
|||||||
|
// yabridge: a Wine plugin bridge
|
||||||
|
// Copyright (C) 2020-2022 Robbert van der Helm
|
||||||
|
//
|
||||||
|
// This program is free software: you can redistribute it and/or modify
|
||||||
|
// it under the terms of the GNU General Public License as published by
|
||||||
|
// the Free Software Foundation, either version 3 of the License, or
|
||||||
|
// (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
// GNU General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <clap/ext/note-name.h>
|
||||||
|
|
||||||
|
#include "../../../bitsery/ext/in-place-optional.h"
|
||||||
|
#include "../../common.h"
|
||||||
|
|
||||||
|
// Serialization messages for `clap/ext/note-name.h`
|
||||||
|
|
||||||
|
namespace clap {
|
||||||
|
namespace ext {
|
||||||
|
namespace note_name {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A serializable version of `clap_note_name_t` that owns all of the data it
|
||||||
|
* references.
|
||||||
|
*/
|
||||||
|
struct NoteName {
|
||||||
|
/**
|
||||||
|
* Parse a native `clap_note_name_t` struct so it can be serialized and sent
|
||||||
|
* to the Wine plugin host.
|
||||||
|
*/
|
||||||
|
NoteName(const clap_note_name_t& original);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor for bitsery.
|
||||||
|
*/
|
||||||
|
NoteName() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Write the stored information to a host provided struct.
|
||||||
|
*/
|
||||||
|
void reconstruct(clap_note_name_t& note_name) const;
|
||||||
|
|
||||||
|
std::string name;
|
||||||
|
int16_t port;
|
||||||
|
int16_t key;
|
||||||
|
int16_t channel;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.text1b(name, 4096);
|
||||||
|
s.value2b(port);
|
||||||
|
s.value2b(key);
|
||||||
|
s.value2b(channel);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
namespace plugin {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message struct for `clap_plugin_note_name::count()`.
|
||||||
|
*/
|
||||||
|
struct Count {
|
||||||
|
using Response = PrimitiveResponse<uint32_t>;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The response to the `clap::ext::note_name::plugin::Get` message defined
|
||||||
|
* below.
|
||||||
|
*/
|
||||||
|
struct GetResponse {
|
||||||
|
std::optional<NoteName> result;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.ext(result, bitsery::ext::InPlaceOptional());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message struct for `clap_plugin_note_name::get()`.
|
||||||
|
*/
|
||||||
|
struct Get {
|
||||||
|
using Response = GetResponse;
|
||||||
|
|
||||||
|
native_size_t instance_id;
|
||||||
|
uint32_t index;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(instance_id);
|
||||||
|
s.value4b(index);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace plugin
|
||||||
|
|
||||||
|
namespace host {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Message struct for `clap_host_note_name::changed()`.
|
||||||
|
*/
|
||||||
|
struct Changed {
|
||||||
|
using Response = Ack;
|
||||||
|
|
||||||
|
native_size_t owner_instance_id;
|
||||||
|
|
||||||
|
template <typename S>
|
||||||
|
void serialize(S& s) {
|
||||||
|
s.value8b(owner_instance_id);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace host
|
||||||
|
|
||||||
|
} // namespace note_name
|
||||||
|
} // namespace ext
|
||||||
|
} // namespace clap
|
||||||
@@ -79,6 +79,7 @@ if with_clap
|
|||||||
'../common/process.cpp',
|
'../common/process.cpp',
|
||||||
'../common/serialization/clap/ext/audio-ports.cpp',
|
'../common/serialization/clap/ext/audio-ports.cpp',
|
||||||
'../common/serialization/clap/ext/audio-ports-config.cpp',
|
'../common/serialization/clap/ext/audio-ports-config.cpp',
|
||||||
|
'../common/serialization/clap/ext/note-name.cpp',
|
||||||
'../common/serialization/clap/ext/note-ports.cpp',
|
'../common/serialization/clap/ext/note-ports.cpp',
|
||||||
'../common/serialization/clap/ext/params.cpp',
|
'../common/serialization/clap/ext/params.cpp',
|
||||||
'../common/serialization/clap/events.cpp',
|
'../common/serialization/clap/events.cpp',
|
||||||
|
|||||||
@@ -82,6 +82,7 @@ if with_clap
|
|||||||
'../common/logging/clap.cpp',
|
'../common/logging/clap.cpp',
|
||||||
'../common/serialization/clap/ext/audio-ports.cpp',
|
'../common/serialization/clap/ext/audio-ports.cpp',
|
||||||
'../common/serialization/clap/ext/audio-ports-config.cpp',
|
'../common/serialization/clap/ext/audio-ports-config.cpp',
|
||||||
|
'../common/serialization/clap/ext/note-name.cpp',
|
||||||
'../common/serialization/clap/ext/note-ports.cpp',
|
'../common/serialization/clap/ext/note-ports.cpp',
|
||||||
'../common/serialization/clap/ext/params.cpp',
|
'../common/serialization/clap/ext/params.cpp',
|
||||||
'../common/serialization/clap/events.cpp',
|
'../common/serialization/clap/events.cpp',
|
||||||
|
|||||||
Reference in New Issue
Block a user