mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-06 19:40:10 +02:00
Change the naming scheme for class field members
I'm not a fan of Hungarian notation, but C++ kind of needs it with its implicit `this`. And of all the common options for this, I find suffixing members with an underscore the least offensive one.
This commit is contained in:
+21
-21
@@ -21,10 +21,10 @@
|
||||
#include "logging/common.h"
|
||||
|
||||
AudioShmBuffer::AudioShmBuffer(const Config& config)
|
||||
: config(config),
|
||||
shm(boost::interprocess::open_or_create,
|
||||
config.name.c_str(),
|
||||
boost::interprocess::read_write) {
|
||||
: config_(config),
|
||||
shm_(boost::interprocess::open_or_create,
|
||||
config.name.c_str(),
|
||||
boost::interprocess::read_write) {
|
||||
setup_mapping();
|
||||
}
|
||||
|
||||
@@ -32,35 +32,35 @@ AudioShmBuffer::~AudioShmBuffer() noexcept {
|
||||
// If either side drops this object then the buffer should always be
|
||||
// removed, so we'll do it on both sides to reduce the chance that we leak
|
||||
// shared memory
|
||||
if (!is_moved) {
|
||||
boost::interprocess::shared_memory_object::remove(config.name.c_str());
|
||||
if (!is_moved_) {
|
||||
boost::interprocess::shared_memory_object::remove(config_.name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
AudioShmBuffer::AudioShmBuffer(AudioShmBuffer&& o) noexcept
|
||||
: config(std::move(o.config)),
|
||||
shm(std::move(o.shm)),
|
||||
buffer(std::move(o.buffer)) {
|
||||
o.is_moved = true;
|
||||
: config_(std::move(o.config_)),
|
||||
shm_(std::move(o.shm_)),
|
||||
buffer_(std::move(o.buffer_)) {
|
||||
o.is_moved_ = true;
|
||||
}
|
||||
|
||||
AudioShmBuffer& AudioShmBuffer::operator=(AudioShmBuffer&& o) noexcept {
|
||||
config = std::move(o.config);
|
||||
shm = std::move(o.shm);
|
||||
buffer = std::move(o.buffer);
|
||||
o.is_moved = true;
|
||||
config_ = std::move(o.config_);
|
||||
shm_ = std::move(o.shm_);
|
||||
buffer_ = std::move(o.buffer_);
|
||||
o.is_moved_ = true;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void AudioShmBuffer::resize(const Config& new_config) {
|
||||
if (new_config.name != config.name) {
|
||||
if (new_config.name != config_.name) {
|
||||
throw std::invalid_argument("Expected buffer configuration for \"" +
|
||||
config.name + "\", got \"" +
|
||||
config_.name + "\", got \"" +
|
||||
new_config.name + "\"");
|
||||
}
|
||||
|
||||
config = new_config;
|
||||
config_ = new_config;
|
||||
setup_mapping();
|
||||
}
|
||||
|
||||
@@ -68,10 +68,10 @@ void AudioShmBuffer::setup_mapping() {
|
||||
try {
|
||||
// Apparently you get a `Resource temporarily unavailable` when calling
|
||||
// `ftruncate()` with a size of 0 on shared memory
|
||||
if (config.size > 0) {
|
||||
shm.truncate(config.size);
|
||||
buffer = boost::interprocess::mapped_region(
|
||||
shm, boost::interprocess::read_write, 0, config.size, nullptr,
|
||||
if (config_.size > 0) {
|
||||
shm_.truncate(config_.size);
|
||||
buffer_ = boost::interprocess::mapped_region(
|
||||
shm_, boost::interprocess::read_write, 0, config_.size, nullptr,
|
||||
MAP_LOCKED);
|
||||
}
|
||||
} catch (const boost::interprocess::interprocess_exception& error) {
|
||||
|
||||
+14
-14
@@ -135,11 +135,11 @@ class AudioShmBuffer {
|
||||
void resize(const Config& new_config);
|
||||
|
||||
inline size_t num_input_channels(const uint32_t bus) const {
|
||||
return config.input_offsets[bus].size();
|
||||
return config_.input_offsets[bus].size();
|
||||
}
|
||||
|
||||
inline size_t num_output_channels(const uint32_t bus) const {
|
||||
return config.output_offsets[bus].size();
|
||||
return config_.output_offsets[bus].size();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -149,15 +149,15 @@ class AudioShmBuffer {
|
||||
*/
|
||||
template <typename T>
|
||||
T* input_channel_ptr(const uint32_t bus, const uint32_t channel) noexcept {
|
||||
return reinterpret_cast<T*>(buffer.get_address()) +
|
||||
config.input_offsets[bus][channel];
|
||||
return reinterpret_cast<T*>(buffer_.get_address()) +
|
||||
config_.input_offsets[bus][channel];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T* input_channel_ptr(const uint32_t bus,
|
||||
const uint32_t channel) const noexcept {
|
||||
return reinterpret_cast<const T*>(buffer.get_address()) +
|
||||
config.input_offsets[bus][channel];
|
||||
return reinterpret_cast<const T*>(buffer_.get_address()) +
|
||||
config_.input_offsets[bus][channel];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,18 +167,18 @@ class AudioShmBuffer {
|
||||
*/
|
||||
template <typename T>
|
||||
T* output_channel_ptr(const uint32_t bus, const uint32_t channel) noexcept {
|
||||
return reinterpret_cast<T*>(buffer.get_address()) +
|
||||
config.output_offsets[bus][channel];
|
||||
return reinterpret_cast<T*>(buffer_.get_address()) +
|
||||
config_.output_offsets[bus][channel];
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
const T* output_channel_ptr(const uint32_t bus,
|
||||
const uint32_t channel) const noexcept {
|
||||
return reinterpret_cast<const T*>(buffer.get_address()) +
|
||||
config.output_offsets[bus][channel];
|
||||
return reinterpret_cast<const T*>(buffer_.get_address()) +
|
||||
config_.output_offsets[bus][channel];
|
||||
}
|
||||
|
||||
Config config;
|
||||
Config config_;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -186,8 +186,8 @@ class AudioShmBuffer {
|
||||
*/
|
||||
void setup_mapping();
|
||||
|
||||
boost::interprocess::shared_memory_object shm;
|
||||
boost::interprocess::mapped_region buffer;
|
||||
boost::interprocess::shared_memory_object shm_;
|
||||
boost::interprocess::mapped_region buffer_;
|
||||
|
||||
bool is_moved = false;
|
||||
bool is_moved_ = false;
|
||||
};
|
||||
|
||||
@@ -48,7 +48,7 @@ class MessageReference {
|
||||
* won't be touched.
|
||||
*/
|
||||
MessageReference(std::optional<T>& backing_object)
|
||||
: backing_object(backing_object){};
|
||||
: backing_object_(backing_object){};
|
||||
|
||||
template <typename Ser, typename Fnc>
|
||||
void serialize(Ser& ser,
|
||||
@@ -59,15 +59,15 @@ class MessageReference {
|
||||
|
||||
template <typename Des, typename Fnc>
|
||||
void deserialize(Des& des, ::MessageReference<T>& object_ref, Fnc&&) const {
|
||||
if (!backing_object) {
|
||||
backing_object.emplace();
|
||||
if (!backing_object_) {
|
||||
backing_object_.emplace();
|
||||
}
|
||||
|
||||
// Since we cannot directly deserialize into a reference, we'll
|
||||
// deserialize into this (persistent) backing object and then point the
|
||||
// reference to this object.
|
||||
des.object(*backing_object);
|
||||
object_ref = *backing_object;
|
||||
des.object(*backing_object_);
|
||||
object_ref = *backing_object_;
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -75,7 +75,7 @@ class MessageReference {
|
||||
* This contains the actual `T` we'll deserialize into so we can point the
|
||||
* reference to that object after deserializing.
|
||||
*/
|
||||
std::optional<T>& backing_object;
|
||||
std::optional<T>& backing_object_;
|
||||
};
|
||||
|
||||
} // namespace ext
|
||||
|
||||
@@ -288,7 +288,7 @@ class Sockets {
|
||||
* @see Sockets::connect
|
||||
*/
|
||||
Sockets(const boost::filesystem::path& endpoint_base_dir)
|
||||
: base_dir(endpoint_base_dir) {}
|
||||
: base_dir_(endpoint_base_dir) {}
|
||||
|
||||
/**
|
||||
* Shuts down and closes all sockets and then cleans up the directory
|
||||
@@ -306,14 +306,15 @@ class Sockets {
|
||||
// this should never be needed, but if it is, then I'm glad
|
||||
// we'll have it!
|
||||
const boost::filesystem::path temp_dir = get_temporary_directory();
|
||||
if (base_dir.string().starts_with(temp_dir.string())) {
|
||||
boost::filesystem::remove_all(base_dir);
|
||||
if (base_dir_.string().starts_with(temp_dir.string())) {
|
||||
boost::filesystem::remove_all(base_dir_);
|
||||
} else {
|
||||
Logger logger = Logger::create_exception_logger();
|
||||
|
||||
logger.log("");
|
||||
logger.log("WARNING: Unexpected socket base directory found,");
|
||||
logger.log(" not removing '" + base_dir.string() + "'");
|
||||
logger.log(" not removing '" + base_dir_.string() +
|
||||
"'");
|
||||
logger.log("");
|
||||
}
|
||||
} catch (const boost::filesystem::filesystem_error&) {
|
||||
@@ -350,7 +351,7 @@ class Sockets {
|
||||
* The base directory for our socket endpoints. All `*_endpoint` variables
|
||||
* below are files within this directory.
|
||||
*/
|
||||
const boost::filesystem::path base_dir;
|
||||
const boost::filesystem::path base_dir_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -373,11 +374,11 @@ class SocketHandler {
|
||||
SocketHandler(boost::asio::io_context& io_context,
|
||||
boost::asio::local::stream_protocol::endpoint endpoint,
|
||||
bool listen)
|
||||
: endpoint(endpoint), socket(io_context) {
|
||||
: endpoint_(endpoint), socket_(io_context) {
|
||||
if (listen) {
|
||||
boost::filesystem::create_directories(
|
||||
boost::filesystem::path(endpoint.path()).parent_path());
|
||||
acceptor.emplace(io_context, endpoint);
|
||||
acceptor_.emplace(io_context, endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -387,10 +388,10 @@ class SocketHandler {
|
||||
* side or connect to the sockets on the Wine side.
|
||||
*/
|
||||
void connect() {
|
||||
if (acceptor) {
|
||||
acceptor->accept(socket);
|
||||
if (acceptor_) {
|
||||
acceptor_->accept(socket_);
|
||||
} else {
|
||||
socket.connect(endpoint);
|
||||
socket_.connect(endpoint_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -401,9 +402,9 @@ class SocketHandler {
|
||||
void close() {
|
||||
// The shutdown can fail when the socket is already closed
|
||||
boost::system::error_code err;
|
||||
socket.shutdown(
|
||||
socket_.shutdown(
|
||||
boost::asio::local::stream_protocol::socket::shutdown_both, err);
|
||||
socket.close();
|
||||
socket_.close();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -427,7 +428,7 @@ class SocketHandler {
|
||||
*/
|
||||
template <typename T>
|
||||
inline void send(const T& object, SerializationBufferBase& buffer) {
|
||||
write_object(socket, object, buffer);
|
||||
write_object(socket_, object, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -437,7 +438,7 @@ class SocketHandler {
|
||||
*/
|
||||
template <typename T>
|
||||
inline void send(const T& object) {
|
||||
write_object(socket, object);
|
||||
write_object(socket_, object);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -471,7 +472,7 @@ class SocketHandler {
|
||||
*/
|
||||
template <typename T>
|
||||
inline T& receive_single(T& object, SerializationBufferBase& buffer) {
|
||||
return read_object<T>(socket, object, buffer);
|
||||
return read_object<T>(socket_, object, buffer);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -482,7 +483,7 @@ class SocketHandler {
|
||||
*/
|
||||
template <typename T>
|
||||
inline T receive_single() {
|
||||
return read_object<T>(socket);
|
||||
return read_object<T>(socket_);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -521,14 +522,14 @@ class SocketHandler {
|
||||
}
|
||||
|
||||
private:
|
||||
boost::asio::local::stream_protocol::endpoint endpoint;
|
||||
boost::asio::local::stream_protocol::socket socket;
|
||||
boost::asio::local::stream_protocol::endpoint endpoint_;
|
||||
boost::asio::local::stream_protocol::socket socket_;
|
||||
|
||||
/**
|
||||
* Will be used in `connect()` on the listening side to establish the
|
||||
* connection.
|
||||
*/
|
||||
std::optional<boost::asio::local::stream_protocol::acceptor> acceptor;
|
||||
std::optional<boost::asio::local::stream_protocol::acceptor> acceptor_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -574,11 +575,11 @@ class AdHocSocketHandler {
|
||||
AdHocSocketHandler(boost::asio::io_context& io_context,
|
||||
boost::asio::local::stream_protocol::endpoint endpoint,
|
||||
bool listen)
|
||||
: io_context(io_context), endpoint(endpoint), socket(io_context) {
|
||||
: io_context_(io_context), endpoint_(endpoint), socket_(io_context) {
|
||||
if (listen) {
|
||||
boost::filesystem::create_directories(
|
||||
boost::filesystem::path(endpoint.path()).parent_path());
|
||||
acceptor.emplace(io_context, endpoint);
|
||||
acceptor_.emplace(io_context, endpoint);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -589,17 +590,17 @@ class AdHocSocketHandler {
|
||||
* side or connect to the sockets on the Wine side
|
||||
*/
|
||||
void connect() {
|
||||
if (acceptor) {
|
||||
acceptor->accept(socket);
|
||||
if (acceptor_) {
|
||||
acceptor_->accept(socket_);
|
||||
|
||||
// As mentioned in `acceptor's` docstring, this acceptor will be
|
||||
// recreated in `receive_multi()` on another context, and
|
||||
// potentially on the other side of the connection in the case
|
||||
// where we're handling `vst_host_callback` VST2 events
|
||||
acceptor.reset();
|
||||
boost::filesystem::remove(endpoint.path());
|
||||
// where we're handling `vst_host_callback_` VST2 events
|
||||
acceptor_.reset();
|
||||
boost::filesystem::remove(endpoint_.path());
|
||||
} else {
|
||||
socket.connect(endpoint);
|
||||
socket_.connect(endpoint_);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -610,11 +611,11 @@ class AdHocSocketHandler {
|
||||
void close() {
|
||||
// The shutdown can fail when the socket is already closed
|
||||
boost::system::error_code err;
|
||||
socket.shutdown(
|
||||
socket_.shutdown(
|
||||
boost::asio::local::stream_protocol::socket::shutdown_both, err);
|
||||
socket.close();
|
||||
socket_.close();
|
||||
|
||||
while (currently_listening) {
|
||||
while (currently_listening_) {
|
||||
// If another thread is currently calling `receive_multi()`, we'll
|
||||
// spinlock until that function has exited. We would otherwise get a
|
||||
// use-after-free when this object is destroyed from another thread.
|
||||
@@ -650,25 +651,25 @@ class AdHocSocketHandler {
|
||||
// ad hoc socket spawning mechanism gets used. If some hosts
|
||||
// for instance consistently and repeatedly trigger this then
|
||||
// we might be able to do some optimizations there.
|
||||
std::unique_lock lock(write_mutex, std::try_to_lock);
|
||||
std::unique_lock lock(write_mutex_, std::try_to_lock);
|
||||
if (lock.owns_lock()) {
|
||||
// This was used to always block when sending the first message,
|
||||
// because the other side may not be listening for additional
|
||||
// connections yet
|
||||
if constexpr (returns_void) {
|
||||
callback(socket);
|
||||
sent_first_event = true;
|
||||
callback(socket_);
|
||||
sent_first_event_ = true;
|
||||
} else {
|
||||
auto result = callback(socket);
|
||||
sent_first_event = true;
|
||||
auto result = callback(socket_);
|
||||
sent_first_event_ = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
boost::asio::local::stream_protocol::socket secondary_socket(
|
||||
io_context);
|
||||
secondary_socket.connect(endpoint);
|
||||
io_context_);
|
||||
secondary_socket.connect(endpoint_);
|
||||
|
||||
return callback(secondary_socket);
|
||||
} catch (const boost::system::system_error&) {
|
||||
@@ -684,15 +685,15 @@ class AdHocSocketHandler {
|
||||
// `connect()`. If we get here at any other point then it
|
||||
// means that the plugin side is no longer listening on the
|
||||
// sockets, and we should thus just exit.
|
||||
if (!sent_first_event) {
|
||||
std::lock_guard lock(write_mutex);
|
||||
if (!sent_first_event_) {
|
||||
std::lock_guard lock(write_mutex_);
|
||||
|
||||
if constexpr (returns_void) {
|
||||
callback(socket);
|
||||
sent_first_event = true;
|
||||
callback(socket_);
|
||||
sent_first_event_ = true;
|
||||
} else {
|
||||
auto result = callback(socket);
|
||||
sent_first_event = true;
|
||||
auto result = callback(socket_);
|
||||
sent_first_event_ = true;
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -728,8 +729,8 @@ class AdHocSocketHandler {
|
||||
// We use this flag to have the `close()` function wait for the this
|
||||
// function to exit, to prevent use-after-frees when destroying this
|
||||
// object from another thread.
|
||||
assert(!currently_listening);
|
||||
currently_listening = true;
|
||||
assert(!currently_listening_);
|
||||
currently_listening_ = true;
|
||||
|
||||
// As described above we'll handle incoming requests for `socket` on
|
||||
// this thread. We'll also listen for incoming connections on `endpoint`
|
||||
@@ -741,7 +742,7 @@ class AdHocSocketHandler {
|
||||
|
||||
// The previous acceptor has already been shut down by
|
||||
// `AdHocSocketHandler::connect()`
|
||||
acceptor.emplace(secondary_context, endpoint);
|
||||
acceptor_.emplace(secondary_context, endpoint_);
|
||||
|
||||
// This works the exact same was as `active_plugins` and
|
||||
// `next_plugin_id` in `GroupBridge`
|
||||
@@ -749,7 +750,7 @@ class AdHocSocketHandler {
|
||||
std::atomic_size_t next_request_id{};
|
||||
std::mutex active_secondary_requests_mutex{};
|
||||
accept_requests(
|
||||
*acceptor, logger,
|
||||
*acceptor_, logger,
|
||||
[&](boost::asio::local::stream_protocol::socket secondary_socket) {
|
||||
const size_t request_id = next_request_id.fetch_add(1);
|
||||
|
||||
@@ -786,7 +787,7 @@ class AdHocSocketHandler {
|
||||
// socket shuts down
|
||||
while (true) {
|
||||
try {
|
||||
primary_callback(socket);
|
||||
primary_callback(socket_);
|
||||
} catch (const boost::system::system_error&) {
|
||||
// This happens when the sockets got closed because the plugin
|
||||
// is being shut down
|
||||
@@ -799,9 +800,9 @@ class AdHocSocketHandler {
|
||||
// from the IO context
|
||||
std::lock_guard lock(active_secondary_requests_mutex);
|
||||
secondary_context.stop();
|
||||
acceptor.reset();
|
||||
acceptor_.reset();
|
||||
|
||||
currently_listening = false;
|
||||
currently_listening_ = false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -861,22 +862,22 @@ class AdHocSocketHandler {
|
||||
* bound to this context. In `receive_multi()` we'll create a new IO context
|
||||
* since we want to do all listening there on a dedicated thread.
|
||||
*/
|
||||
boost::asio::io_context& io_context;
|
||||
boost::asio::io_context& io_context_;
|
||||
|
||||
boost::asio::local::stream_protocol::endpoint endpoint;
|
||||
boost::asio::local::stream_protocol::socket socket;
|
||||
boost::asio::local::stream_protocol::endpoint endpoint_;
|
||||
boost::asio::local::stream_protocol::socket socket_;
|
||||
|
||||
/**
|
||||
* This acceptor will be used once synchronously on the listening side
|
||||
* during `Sockets::connect()`. When `AdHocSocketHandler::receive_multi()`
|
||||
* is then called, we'll recreate the acceptor to asynchronously listen for
|
||||
* new incoming socket connections on `endpoint` using. This is important,
|
||||
* because on the case of `Vst2Sockets`'s' `vst_host_callback` the acceptor
|
||||
* because on the case of `Vst2Sockets`'s' `vst_host_callback_` the acceptor
|
||||
* is first accepts an initial socket on the plugin side (like all sockets),
|
||||
* but all additional incoming connections of course have to be listened for
|
||||
* on the plugin side.
|
||||
*/
|
||||
std::optional<boost::asio::local::stream_protocol::acceptor> acceptor;
|
||||
std::optional<boost::asio::local::stream_protocol::acceptor> acceptor_;
|
||||
|
||||
/**
|
||||
* After the socket gets closed, we do some cleanup at the end of
|
||||
@@ -886,13 +887,13 @@ class AdHocSocketHandler {
|
||||
* near instantly, we'll just do a spinlock here instead of using condition
|
||||
* variables.
|
||||
*/
|
||||
std::atomic_bool currently_listening = false;
|
||||
std::atomic_bool currently_listening_ = false;
|
||||
|
||||
/**
|
||||
* A mutex that locks the primary `socket`. If this is locked, then any new
|
||||
* events will be sent over a new socket instead.
|
||||
*/
|
||||
std::mutex write_mutex;
|
||||
std::mutex write_mutex_;
|
||||
|
||||
/**
|
||||
* Indicates whether or not the remove has processed an event we sent from
|
||||
@@ -901,5 +902,5 @@ class AdHocSocketHandler {
|
||||
* sockets, we want it to always wait for the sockets to come online, but
|
||||
* this fallback behaviour should only happen during initialization.
|
||||
*/
|
||||
std::atomic_bool sent_first_event = false;
|
||||
std::atomic_bool sent_first_event_ = false;
|
||||
};
|
||||
|
||||
@@ -225,8 +225,9 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
}
|
||||
|
||||
/**
|
||||
* Spawn a new thread to listen for extra connections to `endpoint`, and
|
||||
* then start a blocking loop that handles events from the primary `socket`.
|
||||
* Spawn a new thread to listen for extra connections to `endpoint_`, and
|
||||
* then start a blocking loop that handles events from the primary
|
||||
* `socket_`.
|
||||
*
|
||||
* The specified function will be used to create an `Vst2EventResult` from
|
||||
* an `Vst2Event`. This is almost always uses `passthrough_event()`, which
|
||||
@@ -273,7 +274,7 @@ class Vst2EventHandler : public AdHocSocketHandler<Thread> {
|
||||
};
|
||||
|
||||
this->receive_multi(
|
||||
logging ? std::optional(std::ref(logging->first.logger))
|
||||
logging ? std::optional(std::ref(logging->first.logger_))
|
||||
: std::nullopt,
|
||||
[&](boost::asio::local::stream_protocol::socket& socket) {
|
||||
process_event(socket, true);
|
||||
@@ -345,41 +346,42 @@ class Vst2Sockets final : public Sockets {
|
||||
const boost::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_dispatch(io_context,
|
||||
(base_dir / "host_vst_dispatch.sock").string(),
|
||||
listen),
|
||||
vst_host_callback(io_context,
|
||||
(base_dir / "vst_host_callback.sock").string(),
|
||||
listen),
|
||||
host_vst_parameters(io_context,
|
||||
(base_dir / "host_vst_parameters.sock").string(),
|
||||
listen),
|
||||
host_vst_process_replacing(
|
||||
host_vst_dispatch_(io_context,
|
||||
(base_dir_ / "host_vst_dispatch.sock").string(),
|
||||
listen),
|
||||
vst_host_callback_(io_context,
|
||||
(base_dir_ / "vst_host_callback_.sock").string(),
|
||||
listen),
|
||||
host_vst_parameters_(
|
||||
io_context,
|
||||
(base_dir / "host_vst_process_replacing.sock").string(),
|
||||
(base_dir_ / "host_vst_parameters.sock").string(),
|
||||
listen),
|
||||
host_vst_control(io_context,
|
||||
(base_dir / "host_vst_control.sock").string(),
|
||||
listen) {}
|
||||
host_vst_process_replacing_(
|
||||
io_context,
|
||||
(base_dir_ / "host_vst_process_replacing.sock").string(),
|
||||
listen),
|
||||
host_vst_control_(io_context,
|
||||
(base_dir_ / "host_vst_control_.sock").string(),
|
||||
listen) {}
|
||||
|
||||
~Vst2Sockets() noexcept override { close(); }
|
||||
|
||||
void connect() override {
|
||||
host_vst_dispatch.connect();
|
||||
vst_host_callback.connect();
|
||||
host_vst_parameters.connect();
|
||||
host_vst_process_replacing.connect();
|
||||
host_vst_control.connect();
|
||||
host_vst_dispatch_.connect();
|
||||
vst_host_callback_.connect();
|
||||
host_vst_parameters_.connect();
|
||||
host_vst_process_replacing_.connect();
|
||||
host_vst_control_.connect();
|
||||
}
|
||||
|
||||
void close() override {
|
||||
// Manually close all sockets so we break out of any blocking operations
|
||||
// that may still be active
|
||||
host_vst_dispatch.close();
|
||||
vst_host_callback.close();
|
||||
host_vst_parameters.close();
|
||||
host_vst_process_replacing.close();
|
||||
host_vst_control.close();
|
||||
host_vst_dispatch_.close();
|
||||
vst_host_callback_.close();
|
||||
host_vst_parameters_.close();
|
||||
host_vst_process_replacing_.close();
|
||||
host_vst_control_.close();
|
||||
}
|
||||
|
||||
// The naming convention for these sockets is `<from>_<to>_<event>`. For
|
||||
@@ -391,29 +393,29 @@ class Vst2Sockets final : public Sockets {
|
||||
* The socket that forwards all `dispatcher()` calls from the VST host to
|
||||
* the plugin.
|
||||
*/
|
||||
Vst2EventHandler<Thread> host_vst_dispatch;
|
||||
Vst2EventHandler<Thread> host_vst_dispatch_;
|
||||
/**
|
||||
* The socket that forwards all `audioMaster()` calls from the Windows VST
|
||||
* plugin to the host.
|
||||
*/
|
||||
Vst2EventHandler<Thread> vst_host_callback;
|
||||
Vst2EventHandler<Thread> vst_host_callback_;
|
||||
/**
|
||||
* Used for both `getParameter` and `setParameter` since they mostly
|
||||
* overlap.
|
||||
*/
|
||||
SocketHandler host_vst_parameters;
|
||||
SocketHandler host_vst_parameters_;
|
||||
/**
|
||||
* Used for processing audio usign the `process()`, `processReplacing()` and
|
||||
* `processDoubleReplacing()` functions.
|
||||
*/
|
||||
SocketHandler host_vst_process_replacing;
|
||||
SocketHandler host_vst_process_replacing_;
|
||||
/**
|
||||
* A control socket that sends data that is not suitable for the other
|
||||
* sockets. At the moment this is only used to, on startup, send the Windows
|
||||
* VST plugin's `AEffect` object to the native VST plugin, and to then send
|
||||
* the configuration (from `config`) back to the Wine host.
|
||||
* the configuration (from `config_`) back to the Wine host.
|
||||
*/
|
||||
SocketHandler host_vst_control;
|
||||
SocketHandler host_vst_control_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -264,10 +264,10 @@ class Vst3MessageHandler : public AdHocSocketHandler<Thread> {
|
||||
get_request_variant(request));
|
||||
};
|
||||
|
||||
this->receive_multi(logging
|
||||
? std::optional(std::ref(logging->first.logger))
|
||||
: std::nullopt,
|
||||
process_message);
|
||||
this->receive_multi(
|
||||
logging ? std::optional(std::ref(logging->first.logger_))
|
||||
: std::nullopt,
|
||||
process_message);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -314,31 +314,31 @@ class Vst3Sockets final : public Sockets {
|
||||
const boost::filesystem::path& endpoint_base_dir,
|
||||
bool listen)
|
||||
: Sockets(endpoint_base_dir),
|
||||
host_vst_control(io_context,
|
||||
(base_dir / "host_vst_control.sock").string(),
|
||||
listen),
|
||||
vst_host_callback(io_context,
|
||||
(base_dir / "vst_host_callback.sock").string(),
|
||||
host_vst_control_(io_context,
|
||||
(base_dir_ / "host_vst_control_.sock").string(),
|
||||
listen),
|
||||
io_context(io_context) {}
|
||||
vst_host_callback_(io_context,
|
||||
(base_dir_ / "vst_host_callback_.sock").string(),
|
||||
listen),
|
||||
io_context_(io_context) {}
|
||||
|
||||
// NOLINTNEXTLINE(clang-analyzer-optin.cplusplus.VirtualCall)
|
||||
~Vst3Sockets() noexcept override { close(); }
|
||||
|
||||
void connect() override {
|
||||
host_vst_control.connect();
|
||||
vst_host_callback.connect();
|
||||
host_vst_control_.connect();
|
||||
vst_host_callback_.connect();
|
||||
}
|
||||
|
||||
void close() override {
|
||||
// Manually close all sockets so we break out of any blocking operations
|
||||
// that may still be active
|
||||
host_vst_control.close();
|
||||
vst_host_callback.close();
|
||||
host_vst_control_.close();
|
||||
vst_host_callback_.close();
|
||||
|
||||
// This map should be empty at this point, but who knows
|
||||
std::lock_guard lock(audio_processor_sockets_mutex);
|
||||
for (auto& [instance_id, socket] : audio_processor_sockets) {
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
for (auto& [instance_id, socket] : audio_processor_sockets_) {
|
||||
socket.close();
|
||||
}
|
||||
}
|
||||
@@ -351,15 +351,15 @@ class Vst3Sockets final : public Sockets {
|
||||
* @param instance_id The object instance identifier of the socket.
|
||||
*/
|
||||
void add_audio_processor_and_connect(size_t instance_id) {
|
||||
std::lock_guard lock(audio_processor_sockets_mutex);
|
||||
audio_processor_sockets.try_emplace(
|
||||
instance_id, io_context,
|
||||
(base_dir / ("host_vst_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
audio_processor_sockets_.try_emplace(
|
||||
instance_id, io_context_,
|
||||
(base_dir_ / ("host_vst_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
.string(),
|
||||
false);
|
||||
|
||||
audio_processor_sockets.at(instance_id).connect();
|
||||
audio_processor_sockets_.at(instance_id).connect();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -385,28 +385,28 @@ class Vst3Sockets final : public Sockets {
|
||||
std::promise<void>& socket_listening_latch,
|
||||
F&& callback) {
|
||||
{
|
||||
std::lock_guard lock(audio_processor_sockets_mutex);
|
||||
audio_processor_sockets.try_emplace(
|
||||
instance_id, io_context,
|
||||
(base_dir / ("host_vst_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
audio_processor_sockets_.try_emplace(
|
||||
instance_id, io_context_,
|
||||
(base_dir_ / ("host_vst_audio_processor_" +
|
||||
std::to_string(instance_id) + ".sock"))
|
||||
.string(),
|
||||
true);
|
||||
}
|
||||
|
||||
socket_listening_latch.set_value();
|
||||
audio_processor_sockets.at(instance_id).connect();
|
||||
audio_processor_sockets_.at(instance_id).connect();
|
||||
|
||||
// This `true` indicates that we want to reuse our serialization and
|
||||
// receiving buffers for all calls. This slightly reduces the amount of
|
||||
// allocations in the audio processing loop.
|
||||
audio_processor_sockets.at(instance_id)
|
||||
audio_processor_sockets_.at(instance_id)
|
||||
.template receive_messages<true>(std::nullopt,
|
||||
std::forward<F>(callback));
|
||||
}
|
||||
|
||||
/**
|
||||
* If `instance_id` is in `audio_processor_sockets`, then close its socket
|
||||
* If `instance_id` is in `audio_processor_sockets_`, then close its socket
|
||||
* and remove it from the map. This is called from the destructor of
|
||||
* `Vst3PluginProxyImpl` on the plugin side and when handling
|
||||
* `Vst3PluginProxy::Destruct` on the Wine plugin host side.
|
||||
@@ -417,10 +417,10 @@ class Vst3Sockets final : public Sockets {
|
||||
* wasn't in the map.
|
||||
*/
|
||||
bool remove_audio_processor(size_t instance_id) {
|
||||
std::lock_guard lock(audio_processor_sockets_mutex);
|
||||
if (audio_processor_sockets.contains(instance_id)) {
|
||||
audio_processor_sockets.at(instance_id).close();
|
||||
audio_processor_sockets.erase(instance_id);
|
||||
std::lock_guard lock(audio_processor_sockets_mutex_);
|
||||
if (audio_processor_sockets_.contains(instance_id)) {
|
||||
audio_processor_sockets_.at(instance_id).close();
|
||||
audio_processor_sockets_.erase(instance_id);
|
||||
|
||||
return true;
|
||||
} else {
|
||||
@@ -485,14 +485,14 @@ class Vst3Sockets final : public Sockets {
|
||||
* This will be listened on by the Wine plugin host when it calls
|
||||
* `receive_multi()`.
|
||||
*/
|
||||
Vst3MessageHandler<Thread, ControlRequest> host_vst_control;
|
||||
Vst3MessageHandler<Thread, ControlRequest> host_vst_control_;
|
||||
|
||||
/**
|
||||
* For sending callbacks from the plugin back to the host. After we have a
|
||||
* better idea of what our communication model looks like we'll probably
|
||||
* want to provide an abstraction similar to `Vst2EventHandler`.
|
||||
*/
|
||||
Vst3MessageHandler<Thread, CallbackRequest> vst_host_callback;
|
||||
Vst3MessageHandler<Thread, CallbackRequest> vst_host_callback_;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -508,12 +508,12 @@ class Vst3Sockets final : public Sockets {
|
||||
std::optional<std::pair<Vst3Logger&, bool>> logging) {
|
||||
thread_local SerializationBuffer<256> audio_processor_buffer{};
|
||||
|
||||
return audio_processor_sockets.at(instance_id)
|
||||
return audio_processor_sockets_.at(instance_id)
|
||||
.receive_into(object, response_object, logging,
|
||||
audio_processor_buffer);
|
||||
}
|
||||
|
||||
boost::asio::io_context& io_context;
|
||||
boost::asio::io_context& io_context_;
|
||||
|
||||
/**
|
||||
* Every `IAudioProcessor` or `IComponent` instance (which likely implements
|
||||
@@ -528,6 +528,6 @@ class Vst3Sockets final : public Sockets {
|
||||
*/
|
||||
std::unordered_map<size_t,
|
||||
Vst3MessageHandler<Thread, AudioProcessorRequest>>
|
||||
audio_processor_sockets;
|
||||
std::mutex audio_processor_sockets_mutex;
|
||||
audio_processor_sockets_;
|
||||
std::mutex audio_processor_sockets_mutex_;
|
||||
};
|
||||
|
||||
@@ -51,11 +51,11 @@ Logger::Logger(std::shared_ptr<std::ostream> stream,
|
||||
bool editor_tracing,
|
||||
std::string prefix,
|
||||
bool prefix_timestamp)
|
||||
: verbosity(verbosity_level),
|
||||
editor_tracing(editor_tracing),
|
||||
stream(stream),
|
||||
prefix(prefix),
|
||||
prefix_timestamp(prefix_timestamp) {}
|
||||
: verbosity_(verbosity_level),
|
||||
editor_tracing_(editor_tracing),
|
||||
stream_(stream),
|
||||
prefix_(prefix),
|
||||
prefix_timestamp_(prefix_timestamp) {}
|
||||
|
||||
Logger Logger::create_from_environment(std::string prefix,
|
||||
std::shared_ptr<std::ostream> stream,
|
||||
@@ -126,7 +126,7 @@ Logger Logger::create_exception_logger() {
|
||||
void Logger::log(const std::string& message) {
|
||||
std::ostringstream formatted_message;
|
||||
|
||||
if (prefix_timestamp) {
|
||||
if (prefix_timestamp_) {
|
||||
const auto current_time = std::chrono::system_clock::now();
|
||||
const time_t timestamp =
|
||||
std::chrono::system_clock::to_time_t(current_time);
|
||||
@@ -140,12 +140,12 @@ void Logger::log(const std::string& message) {
|
||||
formatted_message << std::put_time(&tm, "%T") << " ";
|
||||
}
|
||||
|
||||
formatted_message << prefix;
|
||||
formatted_message << prefix_;
|
||||
formatted_message << message;
|
||||
// Flushing a stringstream doesn't do anything, but we need to put a
|
||||
// linefeed in this string stream rather writing it sprightly to the output
|
||||
// stream to prevent two messages from being put on the same row
|
||||
formatted_message << std::endl;
|
||||
|
||||
*stream << formatted_message.str() << std::flush;
|
||||
*stream_ << formatted_message.str() << std::flush;
|
||||
}
|
||||
|
||||
@@ -195,7 +195,7 @@ class Logger {
|
||||
*/
|
||||
template <invocable_returning<std::string> F>
|
||||
void log_trace(F&& fn) {
|
||||
if (verbosity >= Verbosity::all_events) [[unlikely]] {
|
||||
if (verbosity_ >= Verbosity::all_events) [[unlikely]] {
|
||||
log(fn());
|
||||
}
|
||||
}
|
||||
@@ -209,7 +209,7 @@ class Logger {
|
||||
*/
|
||||
template <invocable_returning<std::string> F>
|
||||
void log_editor_trace(F&& fn) {
|
||||
if (editor_tracing) [[unlikely]] {
|
||||
if (editor_tracing_) [[unlikely]] {
|
||||
log(fn());
|
||||
}
|
||||
}
|
||||
@@ -218,28 +218,28 @@ class Logger {
|
||||
* The verbosity level of this logger instance. Based on this certain
|
||||
* messages may or may not be shown.
|
||||
*/
|
||||
const Verbosity verbosity;
|
||||
const Verbosity verbosity_;
|
||||
|
||||
/**
|
||||
* If this is set to true, then we'll print debug traces for the plugin
|
||||
* editor.
|
||||
*/
|
||||
const bool editor_tracing;
|
||||
const bool editor_tracing_;
|
||||
|
||||
private:
|
||||
/**
|
||||
* The output stream to write the log messages to. Typically either STDERR
|
||||
* or a file stream.
|
||||
*/
|
||||
std::shared_ptr<std::ostream> stream;
|
||||
std::shared_ptr<std::ostream> stream_;
|
||||
|
||||
/**
|
||||
* A prefix that gets prepended before every message.
|
||||
*/
|
||||
const std::string prefix;
|
||||
const std::string prefix_;
|
||||
|
||||
/**
|
||||
* Whether the log messages should be prefixed with a time stamp.
|
||||
*/
|
||||
const bool prefix_timestamp;
|
||||
const bool prefix_timestamp_;
|
||||
};
|
||||
|
||||
+15
-15
@@ -18,7 +18,7 @@
|
||||
|
||||
#include <sstream>
|
||||
|
||||
Vst2Logger::Vst2Logger(Logger& generic_logger) : logger(generic_logger) {}
|
||||
Vst2Logger::Vst2Logger(Logger& generic_logger) : logger_(generic_logger) {}
|
||||
|
||||
std::optional<std::string> opcode_to_string(bool is_dispatch, int opcode) {
|
||||
if (is_dispatch) {
|
||||
@@ -333,7 +333,7 @@ std::optional<std::string> opcode_to_string(bool is_dispatch, int opcode) {
|
||||
}
|
||||
|
||||
void Vst2Logger::log_get_parameter(int index) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
std::ostringstream message;
|
||||
message << ">> getParameter() " << index;
|
||||
|
||||
@@ -342,7 +342,7 @@ void Vst2Logger::log_get_parameter(int index) {
|
||||
}
|
||||
|
||||
void Vst2Logger::log_get_parameter_response(float value) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
std::ostringstream message;
|
||||
message << " getParameter() :: " << value;
|
||||
|
||||
@@ -351,7 +351,7 @@ void Vst2Logger::log_get_parameter_response(float value) {
|
||||
}
|
||||
|
||||
void Vst2Logger::log_set_parameter(int index, float value) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
std::ostringstream message;
|
||||
message << ">> setParameter() " << index << " = " << value;
|
||||
|
||||
@@ -360,7 +360,7 @@ void Vst2Logger::log_set_parameter(int index, float value) {
|
||||
}
|
||||
|
||||
void Vst2Logger::log_set_parameter_response() {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
log(" setParameter() :: OK");
|
||||
}
|
||||
}
|
||||
@@ -373,7 +373,7 @@ void Vst2Logger::log_event(
|
||||
const Vst2Event::Payload& payload,
|
||||
float option,
|
||||
const std::optional<Vst2Event::Payload>& value_payload) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (should_filter_event(is_dispatch, opcode)) {
|
||||
return;
|
||||
}
|
||||
@@ -402,7 +402,7 @@ void Vst2Logger::log_event(
|
||||
overload{
|
||||
[](const auto&) {},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << "<" << speaker_arrangement.speakers.size()
|
||||
message << "<" << speaker_arrangement.speakers_.size()
|
||||
<< " input_speakers>, ";
|
||||
}},
|
||||
*value_payload);
|
||||
@@ -428,16 +428,16 @@ void Vst2Logger::log_event(
|
||||
},
|
||||
[&](const AEffect&) { message << "nullptr"; },
|
||||
[&](const DynamicVstEvents& events) {
|
||||
message << "<" << events.events.size() << " midi_events";
|
||||
if (!events.sysex_data.empty()) {
|
||||
message << ", including " << events.sysex_data.size()
|
||||
message << "<" << events.events_.size() << " midi_events";
|
||||
if (!events.sysex_data_.empty()) {
|
||||
message << ", including " << events.sysex_data_.size()
|
||||
<< " sysex_events>";
|
||||
} else {
|
||||
message << ">";
|
||||
}
|
||||
},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << "<" << speaker_arrangement.speakers.size()
|
||||
message << "<" << speaker_arrangement.speakers_.size()
|
||||
<< " output_speakers>";
|
||||
},
|
||||
[&](const VstIOProperties&) { message << "<io_properties>"; },
|
||||
@@ -469,7 +469,7 @@ void Vst2Logger::log_event_response(
|
||||
const Vst2EventResult::Payload& payload,
|
||||
const std::optional<Vst2EventResult::Payload>& value_payload,
|
||||
bool from_cache) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) [[unlikely]] {
|
||||
if (should_filter_event(is_dispatch, opcode)) {
|
||||
return;
|
||||
}
|
||||
@@ -490,7 +490,7 @@ void Vst2Logger::log_event_response(
|
||||
overload{
|
||||
[](const auto&) {},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << ", <" << speaker_arrangement.speakers.size()
|
||||
message << ", <" << speaker_arrangement.speakers_.size()
|
||||
<< " input_speakers>";
|
||||
}},
|
||||
*value_payload);
|
||||
@@ -518,7 +518,7 @@ void Vst2Logger::log_event_response(
|
||||
<< " bytes>";
|
||||
},
|
||||
[&](const DynamicSpeakerArrangement& speaker_arrangement) {
|
||||
message << ", <" << speaker_arrangement.speakers.size()
|
||||
message << ", <" << speaker_arrangement.speakers_.size()
|
||||
<< " output_speakers>";
|
||||
},
|
||||
[&](const VstIOProperties&) { message << ", <io_properties>"; },
|
||||
@@ -550,7 +550,7 @@ void Vst2Logger::log_event_response(
|
||||
|
||||
bool Vst2Logger::should_filter_event(bool is_dispatch,
|
||||
int opcode) const noexcept {
|
||||
if (logger.verbosity >= Logger::Verbosity::all_events) {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::all_events) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@ class Vst2Logger {
|
||||
/**
|
||||
* @see Logger::log
|
||||
*/
|
||||
inline void log(const std::string& message) { logger.log(message); }
|
||||
inline void log(const std::string& message) { logger_.log(message); }
|
||||
|
||||
// The following functions are for logging specific events, they are only
|
||||
// enabled for verbosity levels higher than 1 (i.e. `Verbosity::events`)
|
||||
@@ -75,13 +75,13 @@ class Vst2Logger {
|
||||
*/
|
||||
template <invocable_returning<std::string> F>
|
||||
inline void log_trace(F&& fn) {
|
||||
logger.log_trace(std::forward<F>(fn));
|
||||
logger_.log_trace(std::forward<F>(fn));
|
||||
}
|
||||
|
||||
/**
|
||||
* The underlying logger instance we're wrapping.
|
||||
*/
|
||||
Logger& logger;
|
||||
Logger& logger_;
|
||||
|
||||
private:
|
||||
/**
|
||||
|
||||
+23
-23
@@ -29,10 +29,10 @@
|
||||
std::string format_bstream(const YaBStream& stream) {
|
||||
std::ostringstream formatted;
|
||||
formatted << "<IBStream* ";
|
||||
if (stream.supports_stream_attributes && stream.attributes) {
|
||||
if (stream.supports_stream_attributes_ && stream.attributes_) {
|
||||
formatted << "with meta data [";
|
||||
for (bool first = true;
|
||||
const auto& key_type : stream.attributes->keys_and_types()) {
|
||||
const auto& key_type : stream.attributes_->keys_and_types()) {
|
||||
if (!first) {
|
||||
formatted << ", ";
|
||||
}
|
||||
@@ -42,27 +42,27 @@ std::string format_bstream(const YaBStream& stream) {
|
||||
}
|
||||
formatted << "] ";
|
||||
}
|
||||
if (stream.file_name) {
|
||||
formatted << "for \"" << VST3::StringConvert::convert(*stream.file_name)
|
||||
<< "\" ";
|
||||
if (stream.file_name_) {
|
||||
formatted << "for \""
|
||||
<< VST3::StringConvert::convert(*stream.file_name_) << "\" ";
|
||||
}
|
||||
formatted << "containing " << stream.size() << " bytes>";
|
||||
|
||||
return formatted.str();
|
||||
}
|
||||
|
||||
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger(generic_logger) {}
|
||||
Vst3Logger::Vst3Logger(Logger& generic_logger) : logger_(generic_logger) {}
|
||||
|
||||
void Vst3Logger::log_query_interface(
|
||||
const char* where,
|
||||
tresult result,
|
||||
const std::optional<Steinberg::FUID>& uid) {
|
||||
if (logger.verbosity >= Logger::Verbosity::all_events) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::all_events) [[unlikely]] {
|
||||
std::ostringstream message;
|
||||
std::string uid_string = uid ? format_uid(*uid) : "<unknown_pointer>";
|
||||
|
||||
if (result == Steinberg::kResultOk) {
|
||||
if (logger.verbosity >= Logger::Verbosity::most_events) {
|
||||
if (logger_.verbosity_ >= Logger::Verbosity::most_events) {
|
||||
message << "[query interface] " << where << ": " << uid_string;
|
||||
log(message.str());
|
||||
}
|
||||
@@ -518,7 +518,7 @@ bool Vst3Logger::log_request(
|
||||
"busIndex = "
|
||||
<< request.bus_index << ", channel = " << request.channel
|
||||
<< ", list = ";
|
||||
for (bool first = true; const auto& mapping : request.list.maps) {
|
||||
for (bool first = true; const auto& mapping : request.list.maps_) {
|
||||
if (!first) {
|
||||
message << ", ";
|
||||
}
|
||||
@@ -1012,7 +1012,7 @@ bool Vst3Logger::log_request(
|
||||
std::ostringstream num_input_channels;
|
||||
num_input_channels << "[";
|
||||
for (bool is_first = true;
|
||||
const auto& buffers : request.data.inputs) {
|
||||
const auto& buffers : request.data.inputs_) {
|
||||
num_input_channels << (is_first ? "" : ", ")
|
||||
<< buffers.numChannels;
|
||||
if (buffers.silenceFlags > 0 &&
|
||||
@@ -1029,7 +1029,7 @@ bool Vst3Logger::log_request(
|
||||
std::ostringstream num_output_channels;
|
||||
num_output_channels << "[";
|
||||
for (bool is_first = true;
|
||||
const auto& buffers : request.data.outputs) {
|
||||
const auto& buffers : request.data.outputs_) {
|
||||
num_output_channels << (is_first ? "" : ", ")
|
||||
<< buffers.numChannels;
|
||||
if (buffers.silenceFlags > 0 &&
|
||||
@@ -1048,30 +1048,30 @@ bool Vst3Logger::log_request(
|
||||
"input_channels = "
|
||||
<< num_input_channels.str()
|
||||
<< ", output_channels = " << num_output_channels.str()
|
||||
<< ", num_samples = " << request.data.num_samples
|
||||
<< ", num_samples = " << request.data.num_samples_
|
||||
<< ", input_parameter_changes = <IParameterChanges* for "
|
||||
<< request.data.input_parameter_changes.num_parameters()
|
||||
<< request.data.input_parameter_changes_.num_parameters()
|
||||
<< " parameters>, output_parameter_changes = "
|
||||
<< (request.data.output_parameter_changes
|
||||
<< (request.data.output_parameter_changes_
|
||||
? "<IParameterChanges*>"
|
||||
: "nullptr")
|
||||
<< ", input_events = ";
|
||||
if (request.data.input_events) {
|
||||
if (request.data.input_events_) {
|
||||
message << "<IEventList* with "
|
||||
<< request.data.input_events->num_events()
|
||||
<< request.data.input_events_->num_events()
|
||||
<< " events>";
|
||||
} else {
|
||||
message << "<nullptr>";
|
||||
}
|
||||
message << ", output_events = "
|
||||
<< (request.data.output_events ? "<IEventList*>"
|
||||
: "<nullptr>")
|
||||
<< (request.data.output_events_ ? "<IEventList*>"
|
||||
: "<nullptr>")
|
||||
<< ", process_context = "
|
||||
<< (request.data.process_context ? "<ProcessContext*>"
|
||||
: "<nullptr>")
|
||||
<< ", process_mode = " << request.data.process_mode
|
||||
<< (request.data.process_context_ ? "<ProcessContext*>"
|
||||
: "<nullptr>")
|
||||
<< ", process_mode = " << request.data.process_mode_
|
||||
<< ", symbolic_sample_size = "
|
||||
<< request.data.symbolic_sample_size << ">)";
|
||||
<< request.data.symbolic_sample_size_ << ">)";
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1607,7 +1607,7 @@ void Vst3Logger::log_response(
|
||||
message << response.result.string();
|
||||
if (response.result == Steinberg::kResultOk) {
|
||||
message << ", [";
|
||||
for (bool first = true; const auto& mapping : response.list.maps) {
|
||||
for (bool first = true; const auto& mapping : response.list.maps_) {
|
||||
if (!first) {
|
||||
message << ", ";
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ class Vst3Logger {
|
||||
/**
|
||||
* @see Logger::log
|
||||
*/
|
||||
inline void log(const std::string& message) { logger.log(message); }
|
||||
inline void log(const std::string& message) { logger_.log(message); }
|
||||
|
||||
/**
|
||||
* Log calls to `FUnknown::queryInterface`. This will separately log about
|
||||
@@ -350,10 +350,10 @@ class Vst3Logger {
|
||||
*/
|
||||
template <invocable_returning<std::string> F>
|
||||
inline void log_trace(F&& fn) {
|
||||
logger.log_trace(std::forward<F>(fn));
|
||||
logger_.log_trace(std::forward<F>(fn));
|
||||
}
|
||||
|
||||
Logger& logger;
|
||||
Logger& logger_;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -367,7 +367,7 @@ class Vst3Logger {
|
||||
bool log_request_base(bool is_host_vst,
|
||||
Logger::Verbosity min_verbosity,
|
||||
F callback) {
|
||||
if (logger.verbosity >= min_verbosity) [[unlikely]] {
|
||||
if (logger_.verbosity_ >= min_verbosity) [[unlikely]] {
|
||||
std::ostringstream message;
|
||||
if (is_host_vst) {
|
||||
message << "[host -> vst] >> ";
|
||||
|
||||
@@ -86,8 +86,8 @@ class MutualRecursionHelper {
|
||||
std::shared_ptr<boost::asio::io_context> current_io_context =
|
||||
std::make_shared<boost::asio::io_context>();
|
||||
{
|
||||
std::unique_lock lock(mutual_recursion_contexts_mutex);
|
||||
mutual_recursion_contexts.push_back(current_io_context);
|
||||
std::unique_lock lock(mutual_recursion_contexts_mutex_);
|
||||
mutual_recursion_contexts_.push_back(current_io_context);
|
||||
}
|
||||
|
||||
// Instead of directly stopping the IO context, we'll reset this work
|
||||
@@ -106,11 +106,11 @@ class MutualRecursionHelper {
|
||||
// the other side). By resetting the work guard we do not cancel any
|
||||
// pending tasks, but `current_io_context->run()` will stop blocking
|
||||
// eventually.
|
||||
std::lock_guard lock(mutual_recursion_contexts_mutex);
|
||||
std::lock_guard lock(mutual_recursion_contexts_mutex_);
|
||||
work_guard.reset();
|
||||
mutual_recursion_contexts.erase(
|
||||
std::find(mutual_recursion_contexts.begin(),
|
||||
mutual_recursion_contexts.end(), current_io_context));
|
||||
mutual_recursion_contexts_.erase(std::find(
|
||||
mutual_recursion_contexts_.begin(),
|
||||
mutual_recursion_contexts_.end(), current_io_context));
|
||||
|
||||
response_promise.set_value(response);
|
||||
});
|
||||
@@ -158,8 +158,9 @@ class MutualRecursionHelper {
|
||||
std::optional<std::invoke_result_t<F>> maybe_handle(F&& fn) {
|
||||
using Result = std::invoke_result_t<F>;
|
||||
|
||||
std::unique_lock mutual_recursion_lock(mutual_recursion_contexts_mutex);
|
||||
if (mutual_recursion_contexts.empty()) {
|
||||
std::unique_lock mutual_recursion_lock(
|
||||
mutual_recursion_contexts_mutex_);
|
||||
if (mutual_recursion_contexts_.empty()) {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -167,7 +168,7 @@ class MutualRecursionHelper {
|
||||
// pretend that we're not doing any async things here
|
||||
std::packaged_task<Result()> do_call(std::forward<F>(fn));
|
||||
std::future<Result> do_call_response = do_call.get_future();
|
||||
boost::asio::dispatch(*mutual_recursion_contexts.back(),
|
||||
boost::asio::dispatch(*mutual_recursion_contexts_.back(),
|
||||
std::move(do_call));
|
||||
mutual_recursion_lock.unlock();
|
||||
|
||||
@@ -186,6 +187,6 @@ class MutualRecursionHelper {
|
||||
* recursion going on.
|
||||
*/
|
||||
std::vector<std::shared_ptr<boost::asio::io_context>>
|
||||
mutual_recursion_contexts;
|
||||
std::mutex mutual_recursion_contexts_mutex;
|
||||
mutual_recursion_contexts_;
|
||||
std::mutex mutual_recursion_contexts_mutex_;
|
||||
};
|
||||
|
||||
@@ -31,7 +31,7 @@ enum class LibArchitecture { dll_32, dll_64 };
|
||||
|
||||
/**
|
||||
* A tag to differentiate between different plugin types.
|
||||
* `plugin_tyep_to_string()` and `plugin_type_from_string()` can be used to
|
||||
* `plugin_type_to_string()` and `plugin_type_from_string()` can be used to
|
||||
* convert these values to and from strings. The string form is used as a
|
||||
* command line argument for the individual Wine host applications, and the enum
|
||||
* form is passed directly in `HostRequest`.
|
||||
|
||||
@@ -115,12 +115,12 @@ class MessageReference {
|
||||
* `0x1337420` so it's at least obvious where it's coming from if we get a
|
||||
* segfault caused by a read to that address.
|
||||
*/
|
||||
MessageReference() noexcept : object(reinterpret_cast<T*>(0x1337420)) {}
|
||||
MessageReference() noexcept : object_(reinterpret_cast<T*>(0x1337420)) {}
|
||||
|
||||
/**
|
||||
* Store a reference in this object.
|
||||
*/
|
||||
MessageReference(T& object) noexcept : object(&object) {}
|
||||
MessageReference(T& object) noexcept : object_(&object) {}
|
||||
|
||||
using Response = typename T::Response;
|
||||
|
||||
@@ -128,12 +128,12 @@ class MessageReference {
|
||||
* Get the reference to the object. This is the same interface as
|
||||
* `std::reference_wrapper<T>`.
|
||||
*/
|
||||
T& get() const noexcept { return *object; }
|
||||
constexpr operator T&() const noexcept { return *object; }
|
||||
T& get() const noexcept { return *object_; }
|
||||
constexpr operator T&() const noexcept { return *object_; }
|
||||
|
||||
// You cannot serialize a reference directly, use the Bitsery extension
|
||||
// mentioned above instead
|
||||
|
||||
private:
|
||||
T* object;
|
||||
T* object_;
|
||||
};
|
||||
|
||||
@@ -37,17 +37,17 @@ AEffect& update_aeffect(AEffect& plugin,
|
||||
DynamicVstEvents::DynamicVstEvents() noexcept {}
|
||||
|
||||
DynamicVstEvents::DynamicVstEvents(const VstEvents& c_events)
|
||||
: events(c_events.numEvents) {
|
||||
: events_(c_events.numEvents) {
|
||||
// Copy from the C-style array into a vector for serialization
|
||||
for (int i = 0; i < c_events.numEvents; i++) {
|
||||
events[i] = *c_events.events[i];
|
||||
events_[i] = *c_events.events[i];
|
||||
|
||||
// If we encounter a SysEx event, also store the payload data in an
|
||||
// associative list (so we can potentially still avoid allocations)
|
||||
const auto sysex_event =
|
||||
reinterpret_cast<VstMidiSysExEvent*>(c_events.events[i]);
|
||||
if (sysex_event->type == kVstSysExType) {
|
||||
sysex_data.emplace_back(
|
||||
sysex_data_.emplace_back(
|
||||
i, std::string(sysex_event->sysexDump, sysex_event->byteSize));
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,9 @@ VstEvents& DynamicVstEvents::as_c_events() {
|
||||
// `VstEvents` struct by hand on the heap since it's actually a dynamically
|
||||
// sized object. If we encountered any SysEx events, then we'll need to
|
||||
// update the pointers in `events` to point to the correct data location.
|
||||
for (const auto& [event_idx, data] : sysex_data) {
|
||||
for (const auto& [event_idx, data] : sysex_data_) {
|
||||
auto& sysex_event =
|
||||
reinterpret_cast<VstMidiSysExEvent&>(events[event_idx]);
|
||||
reinterpret_cast<VstMidiSysExEvent&>(events_[event_idx]);
|
||||
sysex_event.sysexDump = const_cast<char*>(data.data());
|
||||
}
|
||||
|
||||
@@ -72,16 +72,16 @@ VstEvents& DynamicVstEvents::as_c_events() {
|
||||
static_assert(std::extent_v<decltype(VstEvents::events)> == 1);
|
||||
const size_t buffer_size =
|
||||
sizeof(VstEvents) +
|
||||
((events.size() - 1) *
|
||||
((events_.size() - 1) *
|
||||
sizeof(VstEvent*)); // NOLINT(bugprone-sizeof-expression)
|
||||
vst_events_buffer.resize(buffer_size);
|
||||
vst_events_buffer_.resize(buffer_size);
|
||||
|
||||
// Now we can populate the VLA with pointers to the objects in the `events`
|
||||
// vector
|
||||
VstEvents* vst_events =
|
||||
reinterpret_cast<VstEvents*>(vst_events_buffer.data());
|
||||
vst_events->numEvents = static_cast<int>(events.size());
|
||||
std::transform(events.begin(), events.end(), vst_events->events,
|
||||
reinterpret_cast<VstEvents*>(vst_events_buffer_.data());
|
||||
vst_events->numEvents = static_cast<int>(events_.size());
|
||||
std::transform(events_.begin(), events_.end(), vst_events->events,
|
||||
[](VstEvent& event) -> VstEvent* { return &event; });
|
||||
|
||||
return *vst_events;
|
||||
@@ -91,10 +91,10 @@ DynamicSpeakerArrangement::DynamicSpeakerArrangement() noexcept {}
|
||||
|
||||
DynamicSpeakerArrangement::DynamicSpeakerArrangement(
|
||||
const VstSpeakerArrangement& speaker_arrangement)
|
||||
: flags(speaker_arrangement.flags),
|
||||
speakers(speaker_arrangement.num_speakers) {
|
||||
: flags_(speaker_arrangement.flags),
|
||||
speakers_(speaker_arrangement.num_speakers) {
|
||||
// Copy from the C-style array into a vector for serialization
|
||||
speakers.assign(
|
||||
speakers_.assign(
|
||||
&speaker_arrangement.speakers[0],
|
||||
&speaker_arrangement.speakers[speaker_arrangement.num_speakers]);
|
||||
}
|
||||
@@ -106,17 +106,18 @@ VstSpeakerArrangement& DynamicSpeakerArrangement::as_c_speaker_arrangement() {
|
||||
static_assert(std::extent_v<decltype(VstSpeakerArrangement::speakers)> ==
|
||||
2);
|
||||
const size_t buffer_size = sizeof(VstSpeakerArrangement) +
|
||||
((speakers.size() - 2) * sizeof(VstSpeaker));
|
||||
speaker_arrangement_buffer.resize(buffer_size);
|
||||
((speakers_.size() - 2) * sizeof(VstSpeaker));
|
||||
speaker_arrangement_buffer_.resize(buffer_size);
|
||||
|
||||
// Now we'll just copy over the elements from our vector to the VLA in this
|
||||
// struct
|
||||
VstSpeakerArrangement* speaker_arrangement =
|
||||
reinterpret_cast<VstSpeakerArrangement*>(
|
||||
speaker_arrangement_buffer.data());
|
||||
speaker_arrangement->flags = flags;
|
||||
speaker_arrangement->num_speakers = static_cast<int>(speakers.size());
|
||||
std::copy(speakers.begin(), speakers.end(), speaker_arrangement->speakers);
|
||||
speaker_arrangement_buffer_.data());
|
||||
speaker_arrangement->flags = flags_;
|
||||
speaker_arrangement->num_speakers = static_cast<int>(speakers_.size());
|
||||
std::copy(speakers_.begin(), speakers_.end(),
|
||||
speaker_arrangement->speakers);
|
||||
|
||||
return *speaker_arrangement;
|
||||
}
|
||||
@@ -125,5 +126,5 @@ std::vector<uint8_t>& DynamicSpeakerArrangement::as_raw_data() {
|
||||
// This will populate the buffer for us with the struct data
|
||||
as_c_speaker_arrangement();
|
||||
|
||||
return speaker_arrangement_buffer;
|
||||
return speaker_arrangement_buffer_;
|
||||
}
|
||||
|
||||
@@ -120,9 +120,10 @@ class alignas(16) DynamicVstEvents {
|
||||
* host can call `effProcessEvents()` multiple times, but in practice this
|
||||
* of course doesn't happen. In case the host or plugin sent SysEx data, we
|
||||
* will need to update the `dumpBytes` field to point to the data stored in
|
||||
* the `sysex_data` field before dumping everything to `vst_events_buffer`.
|
||||
* the `sysex_data_` field before dumping everything to
|
||||
* `vst_events_buffer_`.
|
||||
*/
|
||||
boost::container::small_vector<VstEvent, 64> events;
|
||||
boost::container::small_vector<VstEvent, 64> events_;
|
||||
|
||||
/**
|
||||
* If the host or a plugin sends SysEx data, then we will store that data
|
||||
@@ -133,13 +134,13 @@ class alignas(16) DynamicVstEvents {
|
||||
* Boost.Container, so this will have to do.
|
||||
*/
|
||||
boost::container::small_vector<std::pair<native_size_t, std::string>, 8>
|
||||
sysex_data;
|
||||
sysex_data_;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container(events, max_midi_events,
|
||||
s.container(events_, max_midi_events,
|
||||
[](S& s, VstEvent& event) { s.container1b(event.dump); });
|
||||
s.container(sysex_data, max_midi_events,
|
||||
s.container(sysex_data_, max_midi_events,
|
||||
[](S& s, std::pair<native_size_t, std::string>& pair) {
|
||||
s.value8b(pair.first);
|
||||
s.text1b(pair.second, max_buffer_size);
|
||||
@@ -165,7 +166,7 @@ class alignas(16) DynamicVstEvents {
|
||||
sizeof(VstEvents) +
|
||||
((64 - 1) *
|
||||
sizeof(VstEvent*))> // NOLINT(bugprone-sizeof-expression)
|
||||
vst_events_buffer;
|
||||
vst_events_buffer_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -204,19 +205,19 @@ class alignas(16) DynamicSpeakerArrangement {
|
||||
/**
|
||||
* The flags field from `VstSpeakerArrangement`
|
||||
*/
|
||||
int flags;
|
||||
int flags_;
|
||||
|
||||
/**
|
||||
* Information about the speakers in a particular input or output
|
||||
* configuration.
|
||||
*/
|
||||
std::vector<VstSpeaker> speakers;
|
||||
std::vector<VstSpeaker> speakers_;
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value4b(flags);
|
||||
s.value4b(flags_);
|
||||
s.container(
|
||||
speakers, max_audio_channels,
|
||||
speakers_, max_audio_channels,
|
||||
[](S& s, VstSpeaker& speaker) { s.container1b(speaker.data); });
|
||||
}
|
||||
|
||||
@@ -230,7 +231,7 @@ class alignas(16) DynamicSpeakerArrangement {
|
||||
* We build this object in a byte sized vector to make allocating enough
|
||||
* heap space easy and safe.
|
||||
*/
|
||||
std::vector<uint8_t> speaker_arrangement_buffer;
|
||||
std::vector<uint8_t> speaker_arrangement_buffer_;
|
||||
};
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,16 +91,16 @@ IMPLEMENT_FUNKNOWN_METHODS(YaAttributeList,
|
||||
|
||||
std::vector<std::string> YaAttributeList::keys_and_types() const {
|
||||
std::vector<std::string> result{};
|
||||
for (const auto& [key, value] : attrs_int) {
|
||||
for (const auto& [key, value] : attrs_int_) {
|
||||
result.push_back("\"" + key + "\" (int)");
|
||||
}
|
||||
for (const auto& [key, value] : attrs_float) {
|
||||
for (const auto& [key, value] : attrs_float_) {
|
||||
result.push_back("\"" + key + "\" (float)");
|
||||
}
|
||||
for (const auto& [key, value] : attrs_string) {
|
||||
for (const auto& [key, value] : attrs_string_) {
|
||||
result.push_back("\"" + key + "\" (string)");
|
||||
}
|
||||
for (const auto& [key, value] : attrs_binary) {
|
||||
for (const auto& [key, value] : attrs_binary_) {
|
||||
result.push_back("\"" + key + "\" (binary)");
|
||||
}
|
||||
|
||||
@@ -113,16 +113,16 @@ tresult YaAttributeList::write_back(
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
for (const auto& [key, value] : attrs_int) {
|
||||
for (const auto& [key, value] : attrs_int_) {
|
||||
stream->setInt(key.c_str(), value);
|
||||
}
|
||||
for (const auto& [key, value] : attrs_float) {
|
||||
for (const auto& [key, value] : attrs_float_) {
|
||||
stream->setFloat(key.c_str(), value);
|
||||
}
|
||||
for (const auto& [key, value] : attrs_string) {
|
||||
for (const auto& [key, value] : attrs_string_) {
|
||||
stream->setString(key.c_str(), u16string_to_tchar_pointer(value));
|
||||
}
|
||||
for (const auto& [key, value] : attrs_binary) {
|
||||
for (const auto& [key, value] : attrs_binary_) {
|
||||
stream->setBinary(key.c_str(), value.data(), value.size());
|
||||
}
|
||||
|
||||
@@ -180,12 +180,12 @@ YaAttributeList YaAttributeList::read_stream_attributes(
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaAttributeList::setInt(AttrID id, int64 value) {
|
||||
attrs_int[id] = value;
|
||||
attrs_int_[id] = value;
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaAttributeList::getInt(AttrID id, int64& value) {
|
||||
if (const auto it = attrs_int.find(id); it != attrs_int.end()) {
|
||||
if (const auto it = attrs_int_.find(id); it != attrs_int_.end()) {
|
||||
value = it->second;
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
@@ -194,12 +194,12 @@ tresult PLUGIN_API YaAttributeList::getInt(AttrID id, int64& value) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaAttributeList::setFloat(AttrID id, double value) {
|
||||
attrs_float[id] = value;
|
||||
attrs_float_[id] = value;
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaAttributeList::getFloat(AttrID id, double& value) {
|
||||
if (const auto it = attrs_float.find(id); it != attrs_float.end()) {
|
||||
if (const auto it = attrs_float_.find(id); it != attrs_float_.end()) {
|
||||
value = it->second;
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
@@ -213,7 +213,7 @@ YaAttributeList::setString(AttrID id, const Steinberg::Vst::TChar* string) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
attrs_string[id] = tchar_pointer_to_u16string(string);
|
||||
attrs_string_[id] = tchar_pointer_to_u16string(string);
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
@@ -224,7 +224,7 @@ tresult PLUGIN_API YaAttributeList::getString(AttrID id,
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
if (const auto it = attrs_string.find(id); it != attrs_string.end()) {
|
||||
if (const auto it = attrs_string_.find(id); it != attrs_string_.end()) {
|
||||
// We may only copy `sizeInBytes / 2` UTF-16 characters to `string`,
|
||||
// We'll also have to make sure it's null terminated, so we'll reserve
|
||||
// another byte for that.
|
||||
@@ -249,13 +249,13 @@ tresult PLUGIN_API YaAttributeList::setBinary(AttrID id,
|
||||
}
|
||||
|
||||
const uint8_t* data_bytes = static_cast<const uint8_t*>(data);
|
||||
attrs_binary[id].assign(data_bytes, data_bytes + sizeInBytes);
|
||||
attrs_binary_[id].assign(data_bytes, data_bytes + sizeInBytes);
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
tresult PLUGIN_API YaAttributeList::getBinary(AttrID id,
|
||||
const void*& data,
|
||||
uint32& sizeInBytes) {
|
||||
if (const auto it = attrs_binary.find(id); it != attrs_binary.end()) {
|
||||
if (const auto it = attrs_binary_.find(id); it != attrs_binary_.end()) {
|
||||
data = it->second.data();
|
||||
sizeInBytes = it->second.size();
|
||||
return Steinberg::kResultOk;
|
||||
|
||||
@@ -92,22 +92,22 @@ class YaAttributeList : public Steinberg::Vst::IAttributeList {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.ext(attrs_int, bitsery::ext::StdMap{1 << 20},
|
||||
s.ext(attrs_int_, bitsery::ext::StdMap{1 << 20},
|
||||
[](S& s, std::string& key, int64& value) {
|
||||
s.text1b(key, 1024);
|
||||
s.value8b(value);
|
||||
});
|
||||
s.ext(attrs_float, bitsery::ext::StdMap{1 << 20},
|
||||
s.ext(attrs_float_, bitsery::ext::StdMap{1 << 20},
|
||||
[](S& s, std::string& key, double& value) {
|
||||
s.text1b(key, 1024);
|
||||
s.value8b(value);
|
||||
});
|
||||
s.ext(attrs_string, bitsery::ext::StdMap{1 << 20},
|
||||
s.ext(attrs_string_, bitsery::ext::StdMap{1 << 20},
|
||||
[](S& s, std::string& key, std::u16string& value) {
|
||||
s.text1b(key, 1024);
|
||||
s.text2b(value, 1 << 20);
|
||||
});
|
||||
s.ext(attrs_binary, bitsery::ext::StdMap{1 << 20},
|
||||
s.ext(attrs_binary_, bitsery::ext::StdMap{1 << 20},
|
||||
[](S& s, std::string& key, std::vector<uint8_t>& value) {
|
||||
s.text1b(key, 1024);
|
||||
s.container1b(value, 1 << 20);
|
||||
@@ -115,10 +115,10 @@ class YaAttributeList : public Steinberg::Vst::IAttributeList {
|
||||
}
|
||||
|
||||
private:
|
||||
std::unordered_map<std::string, int64> attrs_int;
|
||||
std::unordered_map<std::string, double> attrs_float;
|
||||
std::unordered_map<std::string, std::u16string> attrs_string;
|
||||
std::unordered_map<std::string, std::vector<uint8_t>> attrs_binary;
|
||||
std::unordered_map<std::string, int64> attrs_int_;
|
||||
std::unordered_map<std::string, double> attrs_float_;
|
||||
std::unordered_map<std::string, std::u16string> attrs_string_;
|
||||
std::unordered_map<std::string, std::vector<uint8_t>> attrs_binary_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -68,60 +68,60 @@ const Steinberg::Vst::TChar* u16string_to_tchar_pointer(
|
||||
|
||||
WineUID::WineUID() noexcept {}
|
||||
WineUID::WineUID(const Steinberg::TUID& tuid) noexcept
|
||||
: uid(std::to_array(tuid)) {}
|
||||
: uid_(std::to_array(tuid)) {}
|
||||
|
||||
ArrayUID WineUID::get_native_uid() const noexcept {
|
||||
// We need to shuffle the first 8 bytes around to convert between the
|
||||
// COM-compatible and non COM-compatible formats described by the
|
||||
// `INLINE_UID` macro. See that macro as a reference for the transformations
|
||||
// we're applying here.
|
||||
ArrayUID converted_uid = uid;
|
||||
ArrayUID converted_uid = uid_;
|
||||
|
||||
converted_uid[0] = uid[3];
|
||||
converted_uid[1] = uid[2];
|
||||
converted_uid[2] = uid[1];
|
||||
converted_uid[3] = uid[0];
|
||||
converted_uid[0] = uid_[3];
|
||||
converted_uid[1] = uid_[2];
|
||||
converted_uid[2] = uid_[1];
|
||||
converted_uid[3] = uid_[0];
|
||||
|
||||
converted_uid[4] = uid[5];
|
||||
converted_uid[5] = uid[4];
|
||||
converted_uid[6] = uid[7];
|
||||
converted_uid[7] = uid[6];
|
||||
converted_uid[4] = uid_[5];
|
||||
converted_uid[5] = uid_[4];
|
||||
converted_uid[6] = uid_[7];
|
||||
converted_uid[7] = uid_[6];
|
||||
|
||||
return converted_uid;
|
||||
}
|
||||
|
||||
NativeUID::NativeUID() noexcept {}
|
||||
NativeUID::NativeUID(const Steinberg::TUID& tuid) noexcept
|
||||
: uid(std::to_array(tuid)) {}
|
||||
: uid_(std::to_array(tuid)) {}
|
||||
|
||||
ArrayUID NativeUID::get_wine_uid() const noexcept {
|
||||
// This transformation is actually the same as the one in
|
||||
// `WineUID::get_native_uid()`, but we'll spell it out here in full for
|
||||
// understandability's sake.
|
||||
ArrayUID converted_uid = uid;
|
||||
ArrayUID converted_uid = uid_;
|
||||
|
||||
converted_uid[0] = uid[3];
|
||||
converted_uid[1] = uid[2];
|
||||
converted_uid[2] = uid[1];
|
||||
converted_uid[3] = uid[0];
|
||||
converted_uid[0] = uid_[3];
|
||||
converted_uid[1] = uid_[2];
|
||||
converted_uid[2] = uid_[1];
|
||||
converted_uid[3] = uid_[0];
|
||||
|
||||
converted_uid[4] = uid[5];
|
||||
converted_uid[5] = uid[4];
|
||||
converted_uid[6] = uid[7];
|
||||
converted_uid[7] = uid[6];
|
||||
converted_uid[4] = uid_[5];
|
||||
converted_uid[5] = uid_[4];
|
||||
converted_uid[6] = uid_[7];
|
||||
converted_uid[7] = uid_[6];
|
||||
|
||||
return converted_uid;
|
||||
}
|
||||
|
||||
UniversalTResult::UniversalTResult() noexcept
|
||||
: universal_result(Value::kResultFalse) {}
|
||||
: universal_result_(Value::kResultFalse) {}
|
||||
|
||||
UniversalTResult::UniversalTResult(tresult native_result) noexcept
|
||||
: universal_result(to_universal_result(native_result)) {}
|
||||
: universal_result_(to_universal_result(native_result)) {}
|
||||
|
||||
UniversalTResult::operator tresult() const noexcept {
|
||||
static_assert(Steinberg::kResultOk == Steinberg::kResultTrue);
|
||||
switch (universal_result) {
|
||||
switch (universal_result_) {
|
||||
case Value::kNoInterface:
|
||||
return Steinberg::kNoInterface;
|
||||
break;
|
||||
@@ -155,7 +155,7 @@ UniversalTResult::operator tresult() const noexcept {
|
||||
|
||||
std::string UniversalTResult::string() const {
|
||||
static_assert(Steinberg::kResultOk == Steinberg::kResultTrue);
|
||||
switch (universal_result) {
|
||||
switch (universal_result_) {
|
||||
case Value::kNoInterface:
|
||||
return "kNoInterface";
|
||||
break;
|
||||
|
||||
@@ -98,11 +98,11 @@ class WineUID {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container1b(uid);
|
||||
s.container1b(uid_);
|
||||
}
|
||||
|
||||
protected:
|
||||
ArrayUID uid;
|
||||
ArrayUID uid_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -131,15 +131,15 @@ class NativeUID {
|
||||
/**
|
||||
* Get a reference to the proper native UID.
|
||||
*/
|
||||
inline const ArrayUID& native_uid() const noexcept { return uid; };
|
||||
inline const ArrayUID& native_uid() const noexcept { return uid_; };
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container1b(uid);
|
||||
s.container1b(uid_);
|
||||
}
|
||||
|
||||
protected:
|
||||
ArrayUID uid;
|
||||
ArrayUID uid_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -151,17 +151,17 @@ template <typename T>
|
||||
class PrimitiveWrapper {
|
||||
public:
|
||||
PrimitiveWrapper() noexcept {}
|
||||
PrimitiveWrapper(T value) noexcept : value(value) {}
|
||||
PrimitiveWrapper(T value) noexcept : value_(value) {}
|
||||
|
||||
operator T() const noexcept { return value; }
|
||||
operator T() const noexcept { return value_; }
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.template value<sizeof(T)>(value);
|
||||
s.template value<sizeof(T)>(value_);
|
||||
}
|
||||
|
||||
private:
|
||||
T value;
|
||||
T value_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -195,7 +195,7 @@ class UniversalTResult {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value4b(universal_result);
|
||||
s.value4b(universal_result_);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -218,5 +218,5 @@ class UniversalTResult {
|
||||
|
||||
static Value to_universal_result(tresult native_result) noexcept;
|
||||
|
||||
Value universal_result;
|
||||
Value universal_result_;
|
||||
};
|
||||
|
||||
@@ -44,10 +44,10 @@ YaBStream::YaBStream(Steinberg::IBStream* stream) {
|
||||
|
||||
if (size > 0) {
|
||||
int32 num_bytes_read = 0;
|
||||
buffer.resize(size);
|
||||
buffer_.resize(size);
|
||||
stream->seek(old_position,
|
||||
Steinberg::IBStream::IStreamSeekMode::kIBSeekSet);
|
||||
stream->read(buffer.data(), static_cast<int32>(size),
|
||||
stream->read(buffer_.data(), static_cast<int32>(size),
|
||||
&num_bytes_read);
|
||||
assert(num_bytes_read == 0 || num_bytes_read == size);
|
||||
}
|
||||
@@ -62,20 +62,20 @@ YaBStream::YaBStream(Steinberg::IBStream* stream) {
|
||||
// based meta data
|
||||
if (Steinberg::FUnknownPtr<Steinberg::Vst::IStreamAttributes>
|
||||
stream_attributes = stream) {
|
||||
supports_stream_attributes = true;
|
||||
supports_stream_attributes_ = true;
|
||||
|
||||
Steinberg::Vst::String128 vst_string{0};
|
||||
if (stream_attributes->getFileName(vst_string) ==
|
||||
Steinberg::kResultOk) {
|
||||
file_name.emplace(tchar_pointer_to_u16string(vst_string));
|
||||
file_name_.emplace(tchar_pointer_to_u16string(vst_string));
|
||||
}
|
||||
|
||||
if (Steinberg::IPtr<Steinberg::Vst::IAttributeList>
|
||||
stream_attributes_list = stream_attributes->getAttributes()) {
|
||||
attributes.emplace(YaAttributeList::read_stream_attributes(
|
||||
attributes_.emplace(YaAttributeList::read_stream_attributes(
|
||||
stream_attributes_list));
|
||||
} else {
|
||||
attributes.emplace();
|
||||
attributes_.emplace();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -97,7 +97,7 @@ tresult PLUGIN_API YaBStream::queryInterface(Steinberg::FIDString _iid,
|
||||
Steinberg::ISizeableStream)
|
||||
|
||||
// TODO: We don't have any logging for this
|
||||
if (supports_stream_attributes) {
|
||||
if (supports_stream_attributes_) {
|
||||
QUERY_INTERFACE(_iid, obj, Steinberg::Vst::IStreamAttributes::iid,
|
||||
Steinberg::Vst::IStreamAttributes)
|
||||
}
|
||||
@@ -114,24 +114,24 @@ tresult YaBStream::write_back(Steinberg::IBStream* stream) const {
|
||||
// A `stream->seek(0, kIBSeekSet)` breaks restoring states in Bitwig. Not
|
||||
// sure if Bitwig is prepending a header or if this is expected behaviour.
|
||||
int32 num_bytes_written = 0;
|
||||
if (stream->write(const_cast<uint8_t*>(buffer.data()),
|
||||
static_cast<int32>(buffer.size()),
|
||||
if (stream->write(const_cast<uint8_t*>(buffer_.data()),
|
||||
static_cast<int32>(buffer_.size()),
|
||||
&num_bytes_written) == Steinberg::kResultOk) {
|
||||
// Some implementations will return `kResultFalse` when writing 0 bytes
|
||||
assert(num_bytes_written == 0 ||
|
||||
static_cast<size_t>(num_bytes_written) == buffer.size());
|
||||
static_cast<size_t>(num_bytes_written) == buffer_.size());
|
||||
}
|
||||
|
||||
// Write back any attributes written by the plugin if the host supports
|
||||
// preset meta data
|
||||
if (Steinberg::FUnknownPtr<Steinberg::Vst::IStreamAttributes>
|
||||
stream_attributes = stream;
|
||||
stream_attributes && attributes) {
|
||||
stream_attributes && attributes_) {
|
||||
if (Steinberg::IPtr<Steinberg::Vst::IAttributeList>
|
||||
stream_attributes_list = stream_attributes->getAttributes()) {
|
||||
// XXX: If the host somehow preset some attributes, then we're also
|
||||
// writing those back. This should not cause any issues though.
|
||||
attributes->write_back(stream_attributes_list);
|
||||
attributes_->write_back(stream_attributes_list);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ tresult YaBStream::write_back(Steinberg::IBStream* stream) const {
|
||||
}
|
||||
|
||||
size_t YaBStream::size() const noexcept {
|
||||
return buffer.size();
|
||||
return buffer_.size();
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaBStream::read(void* buffer,
|
||||
@@ -151,12 +151,12 @@ tresult PLUGIN_API YaBStream::read(void* buffer,
|
||||
|
||||
const int64_t bytes_to_read =
|
||||
std::min(static_cast<int64_t>(numBytes),
|
||||
static_cast<int64_t>(this->buffer.size()) - seek_position);
|
||||
static_cast<int64_t>(buffer_.size()) - seek_position_);
|
||||
|
||||
if (bytes_to_read > 0) {
|
||||
std::copy_n(&this->buffer[seek_position], bytes_to_read,
|
||||
std::copy_n(&buffer_[seek_position_], bytes_to_read,
|
||||
reinterpret_cast<uint8_t*>(buffer));
|
||||
seek_position += bytes_to_read;
|
||||
seek_position_ += bytes_to_read;
|
||||
}
|
||||
|
||||
if (numBytesRead) {
|
||||
@@ -173,14 +173,14 @@ tresult PLUGIN_API YaBStream::write(void* buffer,
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
if (seek_position + numBytes > static_cast<int64_t>(this->buffer.size())) {
|
||||
this->buffer.resize(seek_position + numBytes);
|
||||
if (seek_position_ + numBytes > static_cast<int64_t>(buffer_.size())) {
|
||||
buffer_.resize(seek_position_ + numBytes);
|
||||
}
|
||||
|
||||
std::copy_n(reinterpret_cast<uint8_t*>(buffer), numBytes,
|
||||
&this->buffer[seek_position]);
|
||||
&buffer_[seek_position_]);
|
||||
|
||||
seek_position += numBytes;
|
||||
seek_position_ += numBytes;
|
||||
if (numBytesWritten) {
|
||||
*numBytesWritten = numBytes;
|
||||
}
|
||||
@@ -192,23 +192,23 @@ tresult PLUGIN_API YaBStream::write(void* buffer,
|
||||
tresult PLUGIN_API YaBStream::seek(int64 pos, int32 mode, int64* result) {
|
||||
switch (mode) {
|
||||
case kIBSeekSet:
|
||||
seek_position = pos;
|
||||
seek_position_ = pos;
|
||||
break;
|
||||
case kIBSeekCur:
|
||||
seek_position += pos;
|
||||
seek_position_ += pos;
|
||||
break;
|
||||
case kIBSeekEnd:
|
||||
seek_position = static_cast<int64_t>(buffer.size()) + pos;
|
||||
seek_position_ = static_cast<int64_t>(buffer_.size()) + pos;
|
||||
break;
|
||||
default:
|
||||
return Steinberg::kInvalidArgument;
|
||||
break;
|
||||
}
|
||||
|
||||
seek_position = std::clamp(seek_position, static_cast<int64_t>(0),
|
||||
static_cast<int64_t>(buffer.size()));
|
||||
seek_position_ = std::clamp(seek_position_, static_cast<int64_t>(0),
|
||||
static_cast<int64_t>(buffer_.size()));
|
||||
if (result) {
|
||||
*result = static_cast<int64>(seek_position);
|
||||
*result = static_cast<int64>(seek_position_);
|
||||
}
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
@@ -216,7 +216,7 @@ tresult PLUGIN_API YaBStream::seek(int64 pos, int32 mode, int64* result) {
|
||||
|
||||
tresult PLUGIN_API YaBStream::tell(int64* pos) {
|
||||
if (pos) {
|
||||
*pos = seek_position;
|
||||
*pos = seek_position_;
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kInvalidArgument;
|
||||
@@ -224,19 +224,19 @@ tresult PLUGIN_API YaBStream::tell(int64* pos) {
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaBStream::getStreamSize(int64& size) {
|
||||
size = static_cast<int64>(buffer.size());
|
||||
size = static_cast<int64>(buffer_.size());
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaBStream::setStreamSize(int64 size) {
|
||||
buffer.resize(size);
|
||||
buffer_.resize(size);
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaBStream::getFileName(Steinberg::Vst::String128 name) {
|
||||
if (name && file_name) {
|
||||
std::copy(file_name->begin(), file_name->end(), name);
|
||||
name[file_name->size()] = 0;
|
||||
if (name && file_name_) {
|
||||
std::copy(file_name_->begin(), file_name_->end(), name);
|
||||
name[file_name_->size()] = 0;
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
@@ -245,8 +245,8 @@ tresult PLUGIN_API YaBStream::getFileName(Steinberg::Vst::String128 name) {
|
||||
}
|
||||
|
||||
Steinberg::Vst::IAttributeList* PLUGIN_API YaBStream::getAttributes() {
|
||||
if (attributes) {
|
||||
return &*attributes;
|
||||
if (attributes_) {
|
||||
return &*attributes_;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -90,37 +90,37 @@ class YaBStream : public Steinberg::IBStream,
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container1b(buffer, max_vector_stream_size);
|
||||
s.container1b(buffer_, max_vector_stream_size);
|
||||
// The seek position should always be initialized at 0
|
||||
|
||||
s.value1b(supports_stream_attributes);
|
||||
s.ext(file_name, bitsery::ext::InPlaceOptional{},
|
||||
s.value1b(supports_stream_attributes_);
|
||||
s.ext(file_name_, bitsery::ext::InPlaceOptional{},
|
||||
[](S& s, std::u16string& name) {
|
||||
s.text2b(name, std::extent_v<Steinberg::Vst::String128>);
|
||||
});
|
||||
s.ext(attributes, bitsery::ext::InPlaceOptional{});
|
||||
s.ext(attributes_, bitsery::ext::InPlaceOptional{});
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this stream supports `IStreamAttributes`. This will be true if we
|
||||
* copied a stream provided by the host that also supported meta data.
|
||||
*/
|
||||
bool supports_stream_attributes = false;
|
||||
bool supports_stream_attributes_ = false;
|
||||
|
||||
/**
|
||||
* The stream's name, if this stream supports stream attributes.
|
||||
*/
|
||||
std::optional<std::u16string> file_name;
|
||||
std::optional<std::u16string> file_name_;
|
||||
|
||||
/**
|
||||
* The stream's meta data if we've copied from a stream that supports meta
|
||||
* data.
|
||||
*/
|
||||
std::optional<YaAttributeList> attributes;
|
||||
std::optional<YaAttributeList> attributes_;
|
||||
|
||||
private:
|
||||
std::vector<uint8_t> buffer;
|
||||
int64_t seek_position = 0;
|
||||
std::vector<uint8_t> buffer_;
|
||||
int64_t seek_position_ = 0;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -40,7 +40,7 @@ Vst3ComponentHandlerProxy::Vst3ComponentHandlerProxy(
|
||||
YaProgress(std::move(args.progress_args)),
|
||||
YaUnitHandler(std::move(args.unit_handler_args)),
|
||||
YaUnitHandler2(std::move(args.unit_handler_2_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3ComponentHandlerProxy::~Vst3ComponentHandlerProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -114,11 +114,11 @@ class Vst3ComponentHandlerProxy : public YaComponentHandler,
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaComponentHandler2::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler2>(object)) {}
|
||||
|
||||
YaComponentHandler2::YaComponentHandler2(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaComponentHandler2 : public Steinberg::Vst::IComponentHandler2 {
|
||||
*/
|
||||
YaComponentHandler2(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IComponentHandler2::setDirty(state)`
|
||||
@@ -138,7 +138,7 @@ class YaComponentHandler2 : public Steinberg::Vst::IComponentHandler2 {
|
||||
virtual tresult PLUGIN_API finishGroupEdit() override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaComponentHandler3::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IComponentHandler3>(object)) {}
|
||||
|
||||
YaComponentHandler3::YaComponentHandler3(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -61,7 +61,7 @@ class YaComponentHandler3 : public Steinberg::Vst::IComponentHandler3 {
|
||||
*/
|
||||
YaComponentHandler3(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* The arguments needed to create a proxy object for the context menu
|
||||
@@ -110,7 +110,7 @@ class YaComponentHandler3 : public Steinberg::Vst::IComponentHandler3 {
|
||||
const Steinberg::Vst::ParamID* paramID) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
+1
-1
@@ -25,4 +25,4 @@ YaComponentHandlerBusActivation::ConstructArgs::ConstructArgs(
|
||||
|
||||
YaComponentHandlerBusActivation::YaComponentHandlerBusActivation(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -62,7 +62,7 @@ class YaComponentHandlerBusActivation
|
||||
*/
|
||||
YaComponentHandlerBusActivation(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -96,7 +96,7 @@ class YaComponentHandlerBusActivation
|
||||
TBool state) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaProgress::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IProgress>(object)) {}
|
||||
|
||||
YaProgress::YaProgress(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaProgress : public Steinberg::Vst::IProgress {
|
||||
*/
|
||||
YaProgress(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* The response code and returned ID for a call to `IProgress::start(type,
|
||||
@@ -154,7 +154,7 @@ class YaProgress : public Steinberg::Vst::IProgress {
|
||||
virtual tresult PLUGIN_API finish(ID id) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaUnitHandler2::ConstructArgs::ConstructArgs(
|
||||
}
|
||||
|
||||
YaUnitHandler2::YaUnitHandler2(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaUnitHandler2 : public Steinberg::Vst::IUnitHandler2 {
|
||||
*/
|
||||
YaUnitHandler2(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -80,7 +80,7 @@ class YaUnitHandler2 : public Steinberg::Vst::IUnitHandler2 {
|
||||
virtual tresult PLUGIN_API notifyUnitByBusChange() override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaUnitHandler::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IUnitHandler>(object)) {}
|
||||
|
||||
YaUnitHandler::YaUnitHandler(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaUnitHandler : public Steinberg::Vst::IUnitHandler {
|
||||
*/
|
||||
YaUnitHandler(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -109,7 +109,7 @@ class YaUnitHandler : public Steinberg::Vst::IUnitHandler {
|
||||
int32 programIndex) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
Vst3ConnectionPointProxy::Vst3ConnectionPointProxy(
|
||||
ConstructArgs&& args) noexcept
|
||||
: YaConnectionPoint(std::move(args.connection_point_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3ConnectionPointProxy::~Vst3ConnectionPointProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -64,11 +64,11 @@ class Vst3ConnectionPointProxy : public YaConnectionPoint {
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -28,7 +28,7 @@ Vst3ContextMenuProxy::ConstructArgs::ConstructArgs(
|
||||
|
||||
Vst3ContextMenuProxy::Vst3ContextMenuProxy(ConstructArgs&& args) noexcept
|
||||
: YaContextMenu(std::move(args.context_menu_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3ContextMenuProxy::~Vst3ContextMenuProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -123,18 +123,18 @@ class Vst3ContextMenuProxy : public YaContextMenu {
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique ID for this context menu.
|
||||
*/
|
||||
inline size_t context_menu_id() const noexcept {
|
||||
return arguments.context_menu_id;
|
||||
return arguments_.context_menu_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -27,7 +27,7 @@ YaContextMenuTarget::ConstructArgs::ConstructArgs(
|
||||
tag(tag) {}
|
||||
|
||||
YaContextMenuTarget::YaContextMenuTarget(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
: arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
YaContextMenuTarget::~YaContextMenuTarget() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -79,18 +79,18 @@ class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the unique ID for the context menu this target belongs to.
|
||||
*/
|
||||
inline size_t context_menu_id() const { return arguments.context_menu_id; }
|
||||
inline size_t context_menu_id() const { return arguments_.context_menu_id; }
|
||||
|
||||
/**
|
||||
* Get the tag of the menu item this target was passed to.
|
||||
*/
|
||||
inline int32 target_tag() const { return arguments.tag; }
|
||||
inline int32 target_tag() const { return arguments_.tag; }
|
||||
|
||||
/*
|
||||
* Message to pass through a call to
|
||||
@@ -122,7 +122,7 @@ class YaContextMenuTarget : public Steinberg::Vst::IContextMenuTarget {
|
||||
virtual tresult PLUGIN_API executeMenuItem(int32 tag) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaContextMenu::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IContextMenu>(object)) {}
|
||||
|
||||
YaContextMenu::YaContextMenu(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -61,7 +61,7 @@ class YaContextMenu : public Steinberg::Vst::IContextMenu {
|
||||
*/
|
||||
YaContextMenu(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IContextMenu::getItemCount()` to the
|
||||
@@ -179,7 +179,7 @@ class YaContextMenu : public Steinberg::Vst::IContextMenu {
|
||||
Steinberg::UCoord y) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -183,31 +183,31 @@ YaEventList::YaEventList() noexcept {
|
||||
}
|
||||
|
||||
void YaEventList::clear() noexcept {
|
||||
events.clear();
|
||||
events_.clear();
|
||||
}
|
||||
|
||||
void YaEventList::repopulate(Steinberg::Vst::IEventList& event_list) {
|
||||
// Copy over all events. Everything gets converted to `YaEvent`s. We sadly
|
||||
// can't construct these in place because we don't know the event type yet.
|
||||
events.clear();
|
||||
events.reserve(event_list.getEventCount());
|
||||
events_.clear();
|
||||
events_.reserve(event_list.getEventCount());
|
||||
for (int i = 0; i < event_list.getEventCount(); i++) {
|
||||
// We're skipping the `kResultOk` assertions here
|
||||
Steinberg::Vst::Event event;
|
||||
event_list.getEvent(i, event);
|
||||
events.emplace_back(event);
|
||||
events_.emplace_back(event);
|
||||
}
|
||||
}
|
||||
|
||||
YaEventList::~YaEventList() noexcept {FUNKNOWN_DTOR}
|
||||
|
||||
size_t YaEventList::num_events() const noexcept {
|
||||
return events.size();
|
||||
return events_.size();
|
||||
}
|
||||
|
||||
void YaEventList::write_back_outputs(
|
||||
Steinberg::Vst::IEventList& output_events) const {
|
||||
for (auto& event : events) {
|
||||
for (auto& event : events_) {
|
||||
Steinberg::Vst::Event reconstructed_event = event.get();
|
||||
output_events.addEvent(reconstructed_event);
|
||||
}
|
||||
@@ -221,25 +221,25 @@ IMPLEMENT_FUNKNOWN_METHODS(YaEventList,
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
int32 PLUGIN_API YaEventList::getEventCount() {
|
||||
return static_cast<int32>(events.size());
|
||||
return static_cast<int32>(events_.size());
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaEventList::getEvent(int32 index,
|
||||
Steinberg::Vst::Event& e /*out*/) {
|
||||
if (index < 0 || index >= static_cast<int32>(events.size())) {
|
||||
if (index < 0 || index >= static_cast<int32>(events_.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
// Reconstructing an event is cheap, but some events may contain pointers to
|
||||
// heap data stored within the `events` vector so this event will still have
|
||||
// the same lifetime as this class
|
||||
e = events[index].get();
|
||||
e = events_[index].get();
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaEventList::addEvent(Steinberg::Vst::Event& e /*in*/) {
|
||||
events.push_back(e);
|
||||
events_.push_back(e);
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
@@ -266,11 +266,11 @@ class YaEventList : public Steinberg::Vst::IEventList {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container(events, 1 << 16);
|
||||
s.container(events_, 1 << 16);
|
||||
}
|
||||
|
||||
private:
|
||||
boost::container::small_vector<YaEvent, 64> events;
|
||||
boost::container::small_vector<YaEvent, 64> events_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -28,7 +28,7 @@ Vst3HostContextProxy::ConstructArgs::ConstructArgs(
|
||||
Vst3HostContextProxy::Vst3HostContextProxy(ConstructArgs&& args) noexcept
|
||||
: YaHostApplication(std::move(args.host_application_args)),
|
||||
YaPlugInterfaceSupport(std::move(args.plug_interface_support_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3HostContextProxy::~Vst3HostContextProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -98,11 +98,11 @@ class Vst3HostContextProxy : public YaHostApplication,
|
||||
* global host context passed to the module's plugin factory.
|
||||
*/
|
||||
inline std::optional<size_t> owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaHostApplication::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IHostApplication>(object)) {}
|
||||
|
||||
YaHostApplication::YaHostApplication(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -63,7 +63,7 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
||||
*/
|
||||
YaHostApplication(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* The response code and resulting value for a call to
|
||||
@@ -114,7 +114,7 @@ class YaHostApplication : public Steinberg::Vst::IHostApplication {
|
||||
void** obj) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,6 +23,5 @@ YaPlugInterfaceSupport::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IPlugInterfaceSupport>(
|
||||
object)) {}
|
||||
|
||||
YaPlugInterfaceSupport::YaPlugInterfaceSupport(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
YaPlugInterfaceSupport::YaPlugInterfaceSupport(ConstructArgs&& args) noexcept
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaPlugInterfaceSupport : public Steinberg::Vst::IPlugInterfaceSupport {
|
||||
*/
|
||||
YaPlugInterfaceSupport(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -96,7 +96,7 @@ class YaPlugInterfaceSupport : public Steinberg::Vst::IPlugInterfaceSupport {
|
||||
isPlugInterfaceSupported(const Steinberg::TUID _iid) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
YaMessagePtr::YaMessagePtr() noexcept {FUNKNOWN_CTOR}
|
||||
|
||||
YaMessagePtr::YaMessagePtr(IMessage& message)
|
||||
: message_id(message.getMessageID()
|
||||
? std::make_optional<std::string>(message.getMessageID())
|
||||
: std::nullopt),
|
||||
original_message_ptr(static_cast<native_size_t>(
|
||||
: message_id_(message.getMessageID()
|
||||
? std::make_optional<std::string>(message.getMessageID())
|
||||
: std::nullopt),
|
||||
original_message_ptr_(static_cast<native_size_t>(
|
||||
reinterpret_cast<size_t>(&message))){FUNKNOWN_CTOR}
|
||||
|
||||
YaMessagePtr::~YaMessagePtr() noexcept {
|
||||
@@ -39,12 +39,12 @@ IMPLEMENT_FUNKNOWN_METHODS(YaMessagePtr,
|
||||
Steinberg::Vst::IMessage* YaMessagePtr::get_original() const noexcept {
|
||||
// See the docstrings on `YaMessage` and `YaMessagePtr`
|
||||
return reinterpret_cast<IMessage*>(
|
||||
static_cast<size_t>(original_message_ptr));
|
||||
static_cast<size_t>(original_message_ptr_));
|
||||
}
|
||||
|
||||
Steinberg::FIDString PLUGIN_API YaMessagePtr::getMessageID() {
|
||||
if (message_id) {
|
||||
return message_id->c_str();
|
||||
if (message_id_) {
|
||||
return message_id_->c_str();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -52,14 +52,14 @@ Steinberg::FIDString PLUGIN_API YaMessagePtr::getMessageID() {
|
||||
|
||||
void PLUGIN_API YaMessagePtr::setMessageID(Steinberg::FIDString id /*in*/) {
|
||||
if (id) {
|
||||
message_id = id;
|
||||
message_id_ = id;
|
||||
} else {
|
||||
message_id.reset();
|
||||
message_id_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Steinberg::Vst::IAttributeList* PLUGIN_API YaMessagePtr::getAttributes() {
|
||||
return &attribute_list;
|
||||
return &attribute_list_;
|
||||
}
|
||||
|
||||
YaMessage::YaMessage() noexcept {FUNKNOWN_CTOR}
|
||||
@@ -76,8 +76,8 @@ IMPLEMENT_FUNKNOWN_METHODS(YaMessage,
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
Steinberg::FIDString PLUGIN_API YaMessage::getMessageID() {
|
||||
if (message_id) {
|
||||
return message_id->c_str();
|
||||
if (message_id_) {
|
||||
return message_id_->c_str();
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -85,12 +85,12 @@ Steinberg::FIDString PLUGIN_API YaMessage::getMessageID() {
|
||||
|
||||
void PLUGIN_API YaMessage::setMessageID(Steinberg::FIDString id /*in*/) {
|
||||
if (id) {
|
||||
message_id = id;
|
||||
message_id_ = id;
|
||||
} else {
|
||||
message_id.reset();
|
||||
message_id_.reset();
|
||||
}
|
||||
}
|
||||
|
||||
Steinberg::Vst::IAttributeList* PLUGIN_API YaMessage::getAttributes() {
|
||||
return &attribute_list;
|
||||
return &attribute_list_;
|
||||
}
|
||||
|
||||
@@ -72,9 +72,9 @@ class YaMessagePtr : public Steinberg::Vst::IMessage {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.ext(message_id, bitsery::ext::InPlaceOptional{},
|
||||
s.ext(message_id_, bitsery::ext::InPlaceOptional{},
|
||||
[](S& s, std::string& id) { s.text1b(id, 1024); });
|
||||
s.value8b(original_message_ptr);
|
||||
s.value8b(original_message_ptr_);
|
||||
}
|
||||
|
||||
private:
|
||||
@@ -82,19 +82,19 @@ class YaMessagePtr : public Steinberg::Vst::IMessage {
|
||||
* The implementation that comes with the SDK returns a null pointer when
|
||||
* the ID has not yet been set, so we'll do the same thing.
|
||||
*/
|
||||
std::optional<std::string> message_id;
|
||||
std::optional<std::string> message_id_;
|
||||
|
||||
/**
|
||||
* The pointer to the message passed during the constructor, as a 64-bit
|
||||
* unsigned integer. This way we can retrieve the original object after a
|
||||
* round trip.
|
||||
*/
|
||||
native_size_t original_message_ptr = 0;
|
||||
native_size_t original_message_ptr_ = 0;
|
||||
|
||||
/**
|
||||
* An empty attribute list, in case the host checks this for some reason.
|
||||
*/
|
||||
YaAttributeList attribute_list;
|
||||
YaAttributeList attribute_list_;
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -138,7 +138,7 @@ class YaMessage : public Steinberg::Vst::IMessage {
|
||||
* The implementation that comes with the SDK returns a null pointer when
|
||||
* the ID has not yet been set, so we'll do the same thing.
|
||||
*/
|
||||
std::optional<std::string> message_id;
|
||||
std::optional<std::string> message_id_;
|
||||
|
||||
YaAttributeList attribute_list;
|
||||
YaAttributeList attribute_list_;
|
||||
};
|
||||
|
||||
@@ -24,20 +24,20 @@ YaParamValueQueue::~YaParamValueQueue() noexcept {
|
||||
|
||||
void YaParamValueQueue::clear_for_parameter(
|
||||
Steinberg::Vst::ParamID parameter_id) noexcept {
|
||||
this->parameter_id = parameter_id;
|
||||
queue.clear();
|
||||
parameter_id_ = parameter_id;
|
||||
queue_.clear();
|
||||
}
|
||||
|
||||
void YaParamValueQueue::repopulate(
|
||||
Steinberg::Vst::IParamValueQueue& original_queue) {
|
||||
parameter_id = original_queue.getParameterId();
|
||||
parameter_id_ = original_queue.getParameterId();
|
||||
|
||||
// Copy over all points to our vector
|
||||
queue.resize(original_queue.getPointCount());
|
||||
queue_.resize(original_queue.getPointCount());
|
||||
for (int i = 0; i < original_queue.getPointCount(); i++) {
|
||||
// We're skipping the assertions here and just assume that the function
|
||||
// returns `kResultOk`
|
||||
original_queue.getPoint(i, queue[i].first, queue[i].second);
|
||||
original_queue.getPoint(i, queue_[i].first, queue_[i].second);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,27 +52,27 @@ void YaParamValueQueue::write_back_outputs(
|
||||
Steinberg::Vst::IParamValueQueue& output_queue) const {
|
||||
// We don't need this value
|
||||
int32 index;
|
||||
for (const auto& [sample_offset, value] : queue) {
|
||||
for (const auto& [sample_offset, value] : queue_) {
|
||||
// We don't check for `kResultOk` here
|
||||
output_queue.addPoint(sample_offset, value, index);
|
||||
}
|
||||
}
|
||||
|
||||
Steinberg::Vst::ParamID PLUGIN_API YaParamValueQueue::getParameterId() {
|
||||
return parameter_id;
|
||||
return parameter_id_;
|
||||
}
|
||||
|
||||
int32 PLUGIN_API YaParamValueQueue::getPointCount() {
|
||||
return static_cast<int32>(queue.size());
|
||||
return static_cast<int32>(queue_.size());
|
||||
}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaParamValueQueue::getPoint(int32 index,
|
||||
int32& sampleOffset /*out*/,
|
||||
Steinberg::Vst::ParamValue& value /*out*/) {
|
||||
if (index < static_cast<int32>(queue.size())) {
|
||||
sampleOffset = queue[index].first;
|
||||
value = queue[index].second;
|
||||
if (index < static_cast<int32>(queue_.size())) {
|
||||
sampleOffset = queue_[index].first;
|
||||
value = queue_[index].second;
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
@@ -82,8 +82,8 @@ YaParamValueQueue::getPoint(int32 index,
|
||||
tresult PLUGIN_API YaParamValueQueue::addPoint(int32 sampleOffset,
|
||||
Steinberg::Vst::ParamValue value,
|
||||
int32& index /*out*/) {
|
||||
index = static_cast<int32>(queue.size());
|
||||
queue.push_back({sampleOffset, value});
|
||||
index = static_cast<int32>(queue_.size());
|
||||
queue_.push_back({sampleOffset, value});
|
||||
|
||||
return Steinberg::kResultOk;
|
||||
}
|
||||
|
||||
@@ -80,9 +80,9 @@ class alignas(16) YaParamValueQueue : public Steinberg::Vst::IParamValueQueue {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.value4b(parameter_id);
|
||||
s.value4b(parameter_id_);
|
||||
// TODO: Does bitsery have a built in way to serialize pairs?
|
||||
s.container(queue, 1 << 16, [](S& s, std::pair<int32, double>& pair) {
|
||||
s.container(queue_, 1 << 16, [](S& s, std::pair<int32, double>& pair) {
|
||||
s.value4b(pair.first);
|
||||
s.value8b(pair.second);
|
||||
});
|
||||
@@ -91,7 +91,7 @@ class alignas(16) YaParamValueQueue : public Steinberg::Vst::IParamValueQueue {
|
||||
/**
|
||||
* For `IParamValueQueue::getParameterId`.
|
||||
*/
|
||||
Steinberg::Vst::ParamID parameter_id;
|
||||
Steinberg::Vst::ParamID parameter_id_;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ class alignas(16) YaParamValueQueue : public Steinberg::Vst::IParamValueQueue {
|
||||
*/
|
||||
boost::container::small_vector<std::pair<int32, Steinberg::Vst::ParamValue>,
|
||||
16>
|
||||
queue;
|
||||
queue_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,15 +23,15 @@ YaParameterChanges::~YaParameterChanges() noexcept {
|
||||
}
|
||||
|
||||
void YaParameterChanges::clear() noexcept {
|
||||
queues.clear();
|
||||
queues_.clear();
|
||||
}
|
||||
|
||||
void YaParameterChanges::repopulate(
|
||||
Steinberg::Vst::IParameterChanges& original_queues) {
|
||||
// Copy over all parameter changne queues
|
||||
queues.resize(original_queues.getParameterCount());
|
||||
queues_.resize(original_queues.getParameterCount());
|
||||
for (int i = 0; i < original_queues.getParameterCount(); i++) {
|
||||
queues[i].repopulate(*original_queues.getParameterData(i));
|
||||
queues_[i].repopulate(*original_queues.getParameterData(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,16 +43,16 @@ IMPLEMENT_FUNKNOWN_METHODS(YaParameterChanges,
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
size_t YaParameterChanges::num_parameters() const {
|
||||
return queues.size();
|
||||
return queues_.size();
|
||||
}
|
||||
|
||||
void YaParameterChanges::write_back_outputs(
|
||||
Steinberg::Vst::IParameterChanges& output_queues) const {
|
||||
for (auto& queue : queues) {
|
||||
for (auto& queue : queues_) {
|
||||
// We don't need this, but the SDK requires us to need this
|
||||
int32 output_queue_index;
|
||||
if (Steinberg::Vst::IParamValueQueue* output_queue =
|
||||
output_queues.addParameterData(queue.parameter_id,
|
||||
output_queues.addParameterData(queue.parameter_id_,
|
||||
output_queue_index)) {
|
||||
queue.write_back_outputs(*output_queue);
|
||||
}
|
||||
@@ -60,13 +60,13 @@ void YaParameterChanges::write_back_outputs(
|
||||
}
|
||||
|
||||
int32 PLUGIN_API YaParameterChanges::getParameterCount() {
|
||||
return static_cast<int32>(queues.size());
|
||||
return static_cast<int32>(queues_.size());
|
||||
}
|
||||
|
||||
Steinberg::Vst::IParamValueQueue* PLUGIN_API
|
||||
YaParameterChanges::getParameterData(int32 index) {
|
||||
if (index < static_cast<int32>(queues.size())) {
|
||||
return &queues[index];
|
||||
if (index < static_cast<int32>(queues_.size())) {
|
||||
return &queues_[index];
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -75,12 +75,12 @@ YaParameterChanges::getParameterData(int32 index) {
|
||||
Steinberg::Vst::IParamValueQueue* PLUGIN_API
|
||||
YaParameterChanges::addParameterData(const Steinberg::Vst::ParamID& id,
|
||||
int32& index /*out*/) {
|
||||
index = static_cast<int32>(queues.size());
|
||||
index = static_cast<int32>(queues_.size());
|
||||
|
||||
// Tiny hack, resizing avoids calling the constructor the second time we
|
||||
// resize the vector to the same size
|
||||
queues.resize(queues.size() + 1);
|
||||
queues[index].clear_for_parameter(id);
|
||||
queues_.resize(queues_.size() + 1);
|
||||
queues_[index].clear_for_parameter(id);
|
||||
|
||||
return &queues[index];
|
||||
return &queues_[index];
|
||||
}
|
||||
|
||||
@@ -78,14 +78,14 @@ class YaParameterChanges : public Steinberg::Vst::IParameterChanges {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container(queues, 1 << 16);
|
||||
s.container(queues_, 1 << 16);
|
||||
}
|
||||
|
||||
private:
|
||||
/**
|
||||
* The parameter value changes queues.
|
||||
*/
|
||||
boost::container::small_vector<YaParamValueQueue, 16> queues;
|
||||
boost::container::small_vector<YaParamValueQueue, 16> queues_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -22,21 +22,21 @@ YaPhysicalUIMapList::YaPhysicalUIMapList() noexcept {}
|
||||
|
||||
YaPhysicalUIMapList::YaPhysicalUIMapList(
|
||||
const Steinberg::Vst::PhysicalUIMapList& list) noexcept
|
||||
: maps(list.map, list.map + list.count) {}
|
||||
: maps_(list.map, list.map + list.count) {}
|
||||
|
||||
Steinberg::Vst::PhysicalUIMapList YaPhysicalUIMapList::get() noexcept {
|
||||
return Steinberg::Vst::PhysicalUIMapList{
|
||||
.count = static_cast<Steinberg::uint32>(maps.size()),
|
||||
.map = maps.data()};
|
||||
.count = static_cast<Steinberg::uint32>(maps_.size()),
|
||||
.map = maps_.data()};
|
||||
}
|
||||
|
||||
void YaPhysicalUIMapList::write_back(
|
||||
Steinberg::Vst::PhysicalUIMapList& list) const {
|
||||
assert(list.count == maps.size());
|
||||
assert(list.count == maps_.size());
|
||||
|
||||
// Write the note expression IDs as updated by the plugin (if the plugin
|
||||
// updated them) back to the original list we've read from
|
||||
for (Steinberg::uint32 i = 0; i < list.count; i++) {
|
||||
list.map[i].noteExpressionTypeID = maps[i].noteExpressionTypeID;
|
||||
list.map[i].noteExpressionTypeID = maps_[i].noteExpressionTypeID;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,10 +53,10 @@ class YaPhysicalUIMapList {
|
||||
|
||||
template <typename S>
|
||||
void serialize(S& s) {
|
||||
s.container(maps, 1 << 31);
|
||||
s.container(maps_, 1 << 31);
|
||||
}
|
||||
|
||||
std::vector<Steinberg::Vst::PhysicalUIMap> maps;
|
||||
std::vector<Steinberg::Vst::PhysicalUIMap> maps_;
|
||||
};
|
||||
|
||||
namespace Steinberg {
|
||||
|
||||
@@ -25,7 +25,7 @@ Vst3PlugFrameProxy::ConstructArgs::ConstructArgs(
|
||||
|
||||
Vst3PlugFrameProxy::Vst3PlugFrameProxy(ConstructArgs&& args) noexcept
|
||||
: YaPlugFrame(std::move(args.plug_frame_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3PlugFrameProxy::~Vst3PlugFrameProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -87,11 +87,11 @@ class Vst3PlugFrameProxy : public YaPlugFrame {
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaPlugFrame::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::IPlugFrame>(object)) {}
|
||||
|
||||
YaPlugFrame::YaPlugFrame(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaPlugFrame : public Steinberg::IPlugFrame {
|
||||
*/
|
||||
YaPlugFrame(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IPlugFrame::resizeView(<plug_view>,
|
||||
@@ -88,7 +88,7 @@ class YaPlugFrame : public Steinberg::IPlugFrame {
|
||||
Steinberg::ViewRect* newSize) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -31,7 +31,7 @@ Vst3PlugViewProxy::Vst3PlugViewProxy(ConstructArgs&& args) noexcept
|
||||
YaParameterFinder(std::move(args.parameter_finder_args)),
|
||||
YaPlugViewContentScaleSupport(
|
||||
std::move(args.plug_view_content_scale_support_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3PlugViewProxy::~Vst3PlugViewProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
|
||||
@@ -110,11 +110,11 @@ class Vst3PlugViewProxy : public YaPlugView,
|
||||
* Get the instance ID of the owner of this object.
|
||||
*/
|
||||
inline size_t owner_instance_id() const noexcept {
|
||||
return arguments.owner_instance_id;
|
||||
return arguments_.owner_instance_id;
|
||||
}
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaParameterFinder::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IParameterFinder>(object)) {}
|
||||
|
||||
YaParameterFinder::YaParameterFinder(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaParameterFinder : public Steinberg::Vst::IParameterFinder {
|
||||
*/
|
||||
YaParameterFinder(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* The response code and editor size returned by a call to
|
||||
@@ -102,7 +102,7 @@ class YaParameterFinder : public Steinberg::Vst::IParameterFinder {
|
||||
Steinberg::Vst::ParamID& resultTag /*out*/) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -25,4 +25,4 @@ YaPlugViewContentScaleSupport::ConstructArgs::ConstructArgs(
|
||||
|
||||
YaPlugViewContentScaleSupport::YaPlugViewContentScaleSupport(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaPlugViewContentScaleSupport
|
||||
*/
|
||||
YaPlugViewContentScaleSupport(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -85,7 +85,7 @@ class YaPlugViewContentScaleSupport
|
||||
setContentScaleFactor(ScaleFactor factor) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaPlugView::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::IPlugView>(object)) {}
|
||||
|
||||
YaPlugView::YaPlugView(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -61,7 +61,7 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
*/
|
||||
YaPlugView(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -365,7 +365,7 @@ class YaPlugView : public Steinberg::IPlugView {
|
||||
checkSizeConstraint(Steinberg::ViewRect* rect) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,7 +24,7 @@ Vst3PluginFactoryProxy::ConstructArgs::ConstructArgs(
|
||||
|
||||
Vst3PluginFactoryProxy::Vst3PluginFactoryProxy(ConstructArgs&& args) noexcept
|
||||
: YaPluginFactory3(std::move(args.plugin_factory_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
// clang-format just doesn't understand these macros, I guess
|
||||
Vst3PluginFactoryProxy::~Vst3PluginFactoryProxy() noexcept {
|
||||
|
||||
@@ -80,7 +80,7 @@ class Vst3PluginFactoryProxy : public YaPluginFactory3 {
|
||||
DECLARE_FUNKNOWN_METHODS
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -100,12 +100,12 @@ YaPluginFactory3::ConstructArgs::ConstructArgs(
|
||||
}
|
||||
|
||||
YaPluginFactory3::YaPluginFactory3(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory3::getFactoryInfo(Steinberg::PFactoryInfo* info) {
|
||||
if (info && arguments.factory_info) {
|
||||
*info = *arguments.factory_info;
|
||||
if (info && arguments_.factory_info) {
|
||||
*info = *arguments_.factory_info;
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kNotInitialized;
|
||||
@@ -113,19 +113,19 @@ YaPluginFactory3::getFactoryInfo(Steinberg::PFactoryInfo* info) {
|
||||
}
|
||||
|
||||
int32 PLUGIN_API YaPluginFactory3::countClasses() {
|
||||
return arguments.num_classes;
|
||||
return arguments_.num_classes;
|
||||
}
|
||||
|
||||
tresult PLUGIN_API YaPluginFactory3::getClassInfo(Steinberg::int32 index,
|
||||
Steinberg::PClassInfo* info) {
|
||||
if (index >= static_cast<int32>(arguments.class_infos_1.size())) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_1.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
// We will have already converted these class IDs to the native
|
||||
// representation in `YaPluginFactory3::ConstructArgs`
|
||||
if (arguments.class_infos_1[index]) {
|
||||
*info = *arguments.class_infos_1[index];
|
||||
if (arguments_.class_infos_1[index]) {
|
||||
*info = *arguments_.class_infos_1[index];
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kResultFalse;
|
||||
@@ -134,14 +134,14 @@ tresult PLUGIN_API YaPluginFactory3::getClassInfo(Steinberg::int32 index,
|
||||
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory3::getClassInfo2(int32 index, Steinberg::PClassInfo2* info) {
|
||||
if (index >= static_cast<int32>(arguments.class_infos_2.size())) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_2.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
// We will have already converted these class IDs to the native
|
||||
// representation in `YaPluginFactory3::ConstructArgs`
|
||||
if (arguments.class_infos_2[index]) {
|
||||
*info = *arguments.class_infos_2[index];
|
||||
if (arguments_.class_infos_2[index]) {
|
||||
*info = *arguments_.class_infos_2[index];
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kResultFalse;
|
||||
@@ -151,14 +151,14 @@ YaPluginFactory3::getClassInfo2(int32 index, Steinberg::PClassInfo2* info) {
|
||||
tresult PLUGIN_API
|
||||
YaPluginFactory3::getClassInfoUnicode(int32 index,
|
||||
Steinberg::PClassInfoW* info) {
|
||||
if (index >= static_cast<int32>(arguments.class_infos_unicode.size())) {
|
||||
if (index >= static_cast<int32>(arguments_.class_infos_unicode.size())) {
|
||||
return Steinberg::kInvalidArgument;
|
||||
}
|
||||
|
||||
// We will have already converted these class IDs to the native
|
||||
// representation in `YaPluginFactory3::ConstructArgs`
|
||||
if (arguments.class_infos_unicode[index]) {
|
||||
*info = *arguments.class_infos_unicode[index];
|
||||
if (arguments_.class_infos_unicode[index]) {
|
||||
*info = *arguments_.class_infos_unicode[index];
|
||||
return Steinberg::kResultOk;
|
||||
} else {
|
||||
return Steinberg::kResultFalse;
|
||||
|
||||
@@ -125,15 +125,15 @@ class YaPluginFactory3 : public Steinberg::IPluginFactory3 {
|
||||
YaPluginFactory3(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supports_plugin_factory() const noexcept {
|
||||
return arguments.supports_plugin_factory;
|
||||
return arguments_.supports_plugin_factory;
|
||||
}
|
||||
|
||||
inline bool supports_plugin_factory_2() const noexcept {
|
||||
return arguments.supports_plugin_factory_2;
|
||||
return arguments_.supports_plugin_factory_2;
|
||||
}
|
||||
|
||||
inline bool supports_plugin_factory_3() const noexcept {
|
||||
return arguments.supports_plugin_factory_3;
|
||||
return arguments_.supports_plugin_factory_3;
|
||||
}
|
||||
|
||||
// All of these functiosn returning class information are fetched once on
|
||||
@@ -182,7 +182,7 @@ class YaPluginFactory3 : public Steinberg::IPluginFactory3 {
|
||||
setHostContext(Steinberg::FUnknown* context) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -75,7 +75,7 @@ Vst3PluginProxy::Vst3PluginProxy(ConstructArgs&& args) noexcept
|
||||
YaUnitInfo(std::move(args.unit_info_args)),
|
||||
YaXmlRepresentationController(
|
||||
std::move(args.xml_representation_controller_args)),
|
||||
arguments(std::move(args)){FUNKNOWN_CTOR}
|
||||
arguments_(std::move(args)){FUNKNOWN_CTOR}
|
||||
|
||||
Vst3PluginProxy::~Vst3PluginProxy() noexcept {
|
||||
FUNKNOWN_DTOR
|
||||
@@ -204,47 +204,47 @@ tresult PLUGIN_API Vst3PluginProxy::queryInterface(Steinberg::FIDString _iid,
|
||||
|
||||
void Vst3PluginProxy::update_supported_interfaces(
|
||||
ConstructArgs&& updated_interfaces) {
|
||||
assert(arguments.instance_id == updated_interfaces.instance_id);
|
||||
assert(arguments_.instance_id == updated_interfaces.instance_id);
|
||||
|
||||
// NOTE: This has to be kept in sync with `Vst3PluginProxy`'s constructor
|
||||
YaAudioPresentationLatency::arguments =
|
||||
YaAudioPresentationLatency::arguments_ =
|
||||
std::move(updated_interfaces.audio_presentation_latency_args);
|
||||
YaAudioProcessor::arguments =
|
||||
YaAudioProcessor::arguments_ =
|
||||
std::move(updated_interfaces.audio_processor_args);
|
||||
YaAutomationState::arguments =
|
||||
YaAutomationState::arguments_ =
|
||||
std::move(updated_interfaces.automation_state_args);
|
||||
YaComponent::arguments = std::move(updated_interfaces.component_args);
|
||||
YaConnectionPoint::arguments =
|
||||
YaComponent::arguments_ = std::move(updated_interfaces.component_args);
|
||||
YaConnectionPoint::arguments_ =
|
||||
std::move(updated_interfaces.connection_point_args);
|
||||
YaEditController::arguments =
|
||||
YaEditController::arguments_ =
|
||||
std::move(updated_interfaces.edit_controller_args);
|
||||
YaEditController2::arguments =
|
||||
YaEditController2::arguments_ =
|
||||
std::move(updated_interfaces.edit_controller_2_args);
|
||||
YaEditControllerHostEditing::arguments =
|
||||
YaEditControllerHostEditing::arguments_ =
|
||||
std::move(updated_interfaces.edit_controller_host_editing_args);
|
||||
YaInfoListener::arguments =
|
||||
YaInfoListener::arguments_ =
|
||||
std::move(updated_interfaces.info_listener_args);
|
||||
YaKeyswitchController::arguments =
|
||||
YaKeyswitchController::arguments_ =
|
||||
std::move(updated_interfaces.keyswitch_controller_args);
|
||||
YaMidiLearn::arguments = std::move(updated_interfaces.midi_learn_args);
|
||||
YaMidiMapping::arguments = std::move(updated_interfaces.midi_mapping_args);
|
||||
YaNoteExpressionController::arguments =
|
||||
YaMidiLearn::arguments_ = std::move(updated_interfaces.midi_learn_args);
|
||||
YaMidiMapping::arguments_ = std::move(updated_interfaces.midi_mapping_args);
|
||||
YaNoteExpressionController::arguments_ =
|
||||
std::move(updated_interfaces.note_expression_controller_args);
|
||||
YaNoteExpressionPhysicalUIMapping::arguments =
|
||||
YaNoteExpressionPhysicalUIMapping::arguments_ =
|
||||
std::move(updated_interfaces.note_expression_physical_ui_mapping_args);
|
||||
YaParameterFunctionName::arguments =
|
||||
YaParameterFunctionName::arguments_ =
|
||||
std::move(updated_interfaces.parameter_function_name_args);
|
||||
YaPluginBase::arguments = std::move(updated_interfaces.plugin_base_args);
|
||||
YaPrefetchableSupport::arguments =
|
||||
YaPluginBase::arguments_ = std::move(updated_interfaces.plugin_base_args);
|
||||
YaPrefetchableSupport::arguments_ =
|
||||
std::move(updated_interfaces.prefetchable_support_args);
|
||||
YaProcessContextRequirements::arguments =
|
||||
YaProcessContextRequirements::arguments_ =
|
||||
std::move(updated_interfaces.process_context_requirements_args);
|
||||
YaProgramListData::arguments =
|
||||
YaProgramListData::arguments_ =
|
||||
std::move(updated_interfaces.program_list_data_args);
|
||||
YaUnitData::arguments = std::move(updated_interfaces.unit_data_args);
|
||||
YaUnitInfo::arguments = std::move(updated_interfaces.unit_info_args);
|
||||
YaXmlRepresentationController::arguments =
|
||||
YaUnitData::arguments_ = std::move(updated_interfaces.unit_data_args);
|
||||
YaUnitInfo::arguments_ = std::move(updated_interfaces.unit_info_args);
|
||||
YaXmlRepresentationController::arguments_ =
|
||||
std::move(updated_interfaces.xml_representation_controller_args);
|
||||
|
||||
arguments = std::move(updated_interfaces);
|
||||
arguments_ = std::move(updated_interfaces);
|
||||
}
|
||||
|
||||
@@ -230,7 +230,9 @@ class Vst3PluginProxy : public YaAudioPresentationLatency,
|
||||
* Get this object's instance ID. Used in `IConnectionPoint` to identify and
|
||||
* connect specific objects.
|
||||
*/
|
||||
inline size_t instance_id() const noexcept { return arguments.instance_id; }
|
||||
inline size_t instance_id() const noexcept {
|
||||
return arguments_.instance_id;
|
||||
}
|
||||
|
||||
// These have to be defined here instead of in `YaPluginBase` because we
|
||||
// need to reference the `ConstructArgs`
|
||||
@@ -343,7 +345,7 @@ class Vst3PluginProxy : public YaAudioPresentationLatency,
|
||||
void update_supported_interfaces(ConstructArgs&& updated_interfaces);
|
||||
|
||||
private:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -26,4 +26,4 @@ YaAudioPresentationLatency::ConstructArgs::ConstructArgs(
|
||||
|
||||
YaAudioPresentationLatency::YaAudioPresentationLatency(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaAudioPresentationLatency
|
||||
*/
|
||||
YaAudioPresentationLatency(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -91,7 +91,7 @@ class YaAudioPresentationLatency
|
||||
uint32 latencyInSamples) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaAudioProcessor::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IAudioProcessor>(object)) {}
|
||||
|
||||
YaAudioProcessor::YaAudioProcessor(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -62,7 +62,7 @@ class YaAudioProcessor : public Steinberg::Vst::IAudioProcessor {
|
||||
*/
|
||||
YaAudioProcessor(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -305,7 +305,7 @@ class YaAudioProcessor : public Steinberg::Vst::IAudioProcessor {
|
||||
virtual uint32 PLUGIN_API getTailSamples() override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaAutomationState::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IAutomationState>(object)) {}
|
||||
|
||||
YaAutomationState::YaAutomationState(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -62,7 +62,7 @@ class YaAutomationState : public Steinberg::Vst::IAutomationState {
|
||||
*/
|
||||
YaAutomationState(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -85,7 +85,7 @@ class YaAutomationState : public Steinberg::Vst::IAutomationState {
|
||||
virtual tresult PLUGIN_API setAutomationState(int32 state) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaComponent::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IComponent>(object)) {}
|
||||
|
||||
YaComponent::YaComponent(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -62,7 +62,7 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
*/
|
||||
YaComponent(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* The response code and returned CID for a call to
|
||||
@@ -281,7 +281,7 @@ class YaComponent : public Steinberg::Vst::IComponent {
|
||||
getState(Steinberg::IBStream* state) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -33,4 +33,4 @@ YaConnectionPoint::Vst3ConnectionPointProxyConstructArgs::
|
||||
: owner_instance_id(owner_instance_id), connection_point_args(object) {}
|
||||
|
||||
YaConnectionPoint::YaConnectionPoint(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -107,7 +107,7 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
|
||||
*/
|
||||
YaConnectionPoint(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IConnectionPoint::connect(other)` to
|
||||
@@ -204,7 +204,7 @@ class YaConnectionPoint : public Steinberg::Vst::IConnectionPoint {
|
||||
notify(Steinberg::Vst::IMessage* message) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaEditController2::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController2>(object)) {}
|
||||
|
||||
YaEditController2::YaEditController2(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaEditController2 : public Steinberg::Vst::IEditController2 {
|
||||
*/
|
||||
YaEditController2(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to `IEditController2::setKnobMode(mode)`
|
||||
@@ -123,7 +123,7 @@ class YaEditController2 : public Steinberg::Vst::IEditController2 {
|
||||
virtual tresult PLUGIN_API openAboutBox(TBool onlyCheck) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -26,4 +26,4 @@ YaEditControllerHostEditing::ConstructArgs::ConstructArgs(
|
||||
|
||||
YaEditControllerHostEditing::YaEditControllerHostEditing(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaEditControllerHostEditing
|
||||
*/
|
||||
YaEditControllerHostEditing(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -107,7 +107,7 @@ class YaEditControllerHostEditing
|
||||
endEditFromHost(Steinberg::Vst::ParamID paramID) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -24,4 +24,4 @@ YaEditController::ConstructArgs::ConstructArgs(
|
||||
Steinberg::FUnknownPtr<Steinberg::Vst::IEditController>(object)) {}
|
||||
|
||||
YaEditController::YaEditController(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -63,7 +63,7 @@ class YaEditController : public Steinberg::Vst::IEditController {
|
||||
*/
|
||||
YaEditController(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -399,7 +399,7 @@ class YaEditController : public Steinberg::Vst::IEditController {
|
||||
createView(Steinberg::FIDString name) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -25,4 +25,4 @@ YaInfoListener::ConstructArgs::ConstructArgs(
|
||||
object)) {}
|
||||
|
||||
YaInfoListener::YaInfoListener(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -60,7 +60,7 @@ class YaInfoListener : public Steinberg::Vst::ChannelContext::IInfoListener {
|
||||
*/
|
||||
YaInfoListener(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -88,7 +88,7 @@ class YaInfoListener : public Steinberg::Vst::ChannelContext::IInfoListener {
|
||||
setChannelContextInfos(Steinberg::Vst::IAttributeList* list) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,6 +23,5 @@ YaKeyswitchController::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IKeyswitchController>(
|
||||
object)) {}
|
||||
|
||||
YaKeyswitchController::YaKeyswitchController(
|
||||
ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
YaKeyswitchController::YaKeyswitchController(ConstructArgs&& args) noexcept
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
@@ -59,7 +59,7 @@ class YaKeyswitchController : public Steinberg::Vst::IKeyswitchController {
|
||||
*/
|
||||
YaKeyswitchController(ConstructArgs&& args) noexcept;
|
||||
|
||||
inline bool supported() const noexcept { return arguments.supported; }
|
||||
inline bool supported() const noexcept { return arguments_.supported; }
|
||||
|
||||
/**
|
||||
* Message to pass through a call to
|
||||
@@ -131,7 +131,7 @@ class YaKeyswitchController : public Steinberg::Vst::IKeyswitchController {
|
||||
Steinberg::Vst::KeyswitchInfo& info /*out*/) override = 0;
|
||||
|
||||
protected:
|
||||
ConstructArgs arguments;
|
||||
ConstructArgs arguments_;
|
||||
};
|
||||
|
||||
#pragma GCC diagnostic pop
|
||||
|
||||
@@ -23,4 +23,4 @@ YaMidiLearn::ConstructArgs::ConstructArgs(
|
||||
: supported(Steinberg::FUnknownPtr<Steinberg::Vst::IMidiLearn>(object)) {}
|
||||
|
||||
YaMidiLearn::YaMidiLearn(ConstructArgs&& args) noexcept
|
||||
: arguments(std::move(args)) {}
|
||||
: arguments_(std::move(args)) {}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user