mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-07 03:50:11 +02:00
Add missing const qualifiers to member functions
This commit is contained in:
+7
-6
@@ -38,7 +38,7 @@ class DefaultDataConverter {
|
||||
virtual EventPayload read(const int /*opcode*/,
|
||||
const int /*index*/,
|
||||
const intptr_t /*value*/,
|
||||
const void* data) {
|
||||
const void* data) const {
|
||||
if (!data) {
|
||||
return nullptr;
|
||||
}
|
||||
@@ -60,8 +60,9 @@ class DefaultDataConverter {
|
||||
* can be serialized and conveys the meaning of the event. This is only used
|
||||
* for the `effSetSpeakerArrangement` and `effGetSpeakerArrangement` events.
|
||||
*/
|
||||
virtual std::optional<EventPayload> read_value(const int /*opcode*/,
|
||||
const intptr_t /*value*/) {
|
||||
virtual std::optional<EventPayload> read_value(
|
||||
const int /*opcode*/,
|
||||
const intptr_t /*value*/) const {
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
@@ -70,7 +71,7 @@ class DefaultDataConverter {
|
||||
*/
|
||||
virtual void write(const int /*opcode*/,
|
||||
void* data,
|
||||
const EventResult& response) {
|
||||
const EventResult& response) const {
|
||||
// The default behavior is to handle this as a null terminated C-style
|
||||
// string
|
||||
std::visit(overload{[&](const auto&) {},
|
||||
@@ -92,7 +93,7 @@ class DefaultDataConverter {
|
||||
*/
|
||||
virtual void write_value(const int /*opcode*/,
|
||||
intptr_t /*value*/,
|
||||
const EventResult& /*response*/) {}
|
||||
const EventResult& /*response*/) const {}
|
||||
|
||||
/**
|
||||
* This function can override a callback's return value based on the opcode.
|
||||
@@ -104,7 +105,7 @@ class DefaultDataConverter {
|
||||
* function.
|
||||
*/
|
||||
virtual intptr_t return_value(const int /*opcode*/,
|
||||
const intptr_t original) {
|
||||
const intptr_t original) const {
|
||||
return original;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -297,7 +297,7 @@ void Logger::log_event_response(
|
||||
}
|
||||
}
|
||||
|
||||
bool Logger::should_filter_event(bool is_dispatch, int opcode) {
|
||||
bool Logger::should_filter_event(bool is_dispatch, int opcode) const {
|
||||
if (verbosity >= Verbosity::all_events) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -118,7 +118,7 @@ class Logger {
|
||||
* Determine whether an event should be filtered based on the current
|
||||
* verbosity level.
|
||||
*/
|
||||
bool should_filter_event(bool is_dispatch, int opcode);
|
||||
bool should_filter_event(bool is_dispatch, int opcode) const;
|
||||
|
||||
/**
|
||||
* The output stream to write the log messages to. Typically either STDERR
|
||||
|
||||
@@ -187,7 +187,7 @@ class DispatchDataConverter : DefaultDataConverter {
|
||||
EventPayload read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
const void* data) const override {
|
||||
// There are some events that need specific structs that we can't simply
|
||||
// serialize as a string because they might contain null bytes
|
||||
switch (opcode) {
|
||||
@@ -262,8 +262,9 @@ class DispatchDataConverter : DefaultDataConverter {
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<EventPayload> read_value(const int opcode,
|
||||
const intptr_t value) {
|
||||
std::optional<EventPayload> read_value(
|
||||
const int opcode,
|
||||
const intptr_t value) const override {
|
||||
switch (opcode) {
|
||||
case effSetSpeakerArrangement:
|
||||
case effGetSpeakerArrangement:
|
||||
@@ -282,7 +283,9 @@ class DispatchDataConverter : DefaultDataConverter {
|
||||
}
|
||||
}
|
||||
|
||||
void write(const int opcode, void* data, const EventResult& response) {
|
||||
void write(const int opcode,
|
||||
void* data,
|
||||
const EventResult& response) const override {
|
||||
switch (opcode) {
|
||||
case effOpen: {
|
||||
// Update our `AEffect` object one last time for improperly
|
||||
@@ -363,13 +366,14 @@ class DispatchDataConverter : DefaultDataConverter {
|
||||
}
|
||||
}
|
||||
|
||||
intptr_t return_value(const int opcode, const intptr_t original) {
|
||||
intptr_t return_value(const int opcode,
|
||||
const intptr_t original) const override {
|
||||
return DefaultDataConverter::return_value(opcode, original);
|
||||
}
|
||||
|
||||
void write_value(const int opcode,
|
||||
intptr_t value,
|
||||
const EventResult& response) {
|
||||
const EventResult& response) const override {
|
||||
switch (opcode) {
|
||||
case effGetSpeakerArrangement: {
|
||||
// Same as the above, but now for the input speaker
|
||||
|
||||
@@ -116,7 +116,7 @@ class GroupBridge {
|
||||
* STDOUT and STDERR streams of the current process will be redirected to
|
||||
* a pipe so they can be properly written to a log file.
|
||||
*/
|
||||
GroupBridge(boost::filesystem::path group_socket_path);
|
||||
explicit GroupBridge(boost::filesystem::path group_socket_path);
|
||||
|
||||
~GroupBridge();
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ Vst2Bridge::Vst2Bridge(boost::asio::io_context& main_context,
|
||||
Win32Thread(handle_process_replacing_proxy, this);
|
||||
}
|
||||
|
||||
bool Vst2Bridge::should_skip_message_loop() {
|
||||
bool Vst2Bridge::should_skip_message_loop() const {
|
||||
return std::holds_alternative<EditorOpening>(editor);
|
||||
}
|
||||
|
||||
@@ -417,7 +417,7 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
EventPayload read(const int opcode,
|
||||
const int index,
|
||||
const intptr_t value,
|
||||
const void* data) {
|
||||
const void* data) const override {
|
||||
switch (opcode) {
|
||||
case audioMasterGetTime:
|
||||
return WantsVstTimeInfo{};
|
||||
@@ -445,12 +445,15 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
}
|
||||
}
|
||||
|
||||
std::optional<EventPayload> read_value(const int opcode,
|
||||
const intptr_t value) {
|
||||
std::optional<EventPayload> read_value(
|
||||
const int opcode,
|
||||
const intptr_t value) const override {
|
||||
return DefaultDataConverter::read_value(opcode, value);
|
||||
}
|
||||
|
||||
void write(const int opcode, void* data, const EventResult& response) {
|
||||
void write(const int opcode,
|
||||
void* data,
|
||||
const EventResult& response) const override {
|
||||
switch (opcode) {
|
||||
case audioMasterGetTime:
|
||||
// Write the returned `VstTimeInfo` struct into a field and
|
||||
@@ -470,7 +473,8 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
}
|
||||
}
|
||||
|
||||
intptr_t return_value(const int opcode, const intptr_t original) {
|
||||
intptr_t return_value(const int opcode,
|
||||
const intptr_t original) const override {
|
||||
switch (opcode) {
|
||||
case audioMasterGetTime: {
|
||||
// Return a pointer to the `VstTimeInfo` object written in
|
||||
@@ -490,7 +494,7 @@ class HostCallbackDataConverter : DefaultDataConverter {
|
||||
|
||||
void write_value(const int opcode,
|
||||
intptr_t value,
|
||||
const EventResult& response) {
|
||||
const EventResult& response) const override {
|
||||
return DefaultDataConverter::write_value(opcode, value, response);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ class Vst2Bridge {
|
||||
* individually hosted plugins this check is done implicitely in
|
||||
* `Vst2Bridge::handle_win32_events()`.
|
||||
*/
|
||||
bool should_skip_message_loop();
|
||||
bool should_skip_message_loop() const;
|
||||
|
||||
/**
|
||||
* Handle events until the plugin exits. The actual events are posted to
|
||||
@@ -151,7 +151,7 @@ class Vst2Bridge {
|
||||
private:
|
||||
/**
|
||||
* A wrapper around `plugin->dispatcher` that handles the opening and
|
||||
* closing of GUIs.
|
||||
* closing of GUIs. Used inside of `handle_dispatch()`.
|
||||
*/
|
||||
intptr_t dispatch_wrapper(AEffect* plugin,
|
||||
int opcode,
|
||||
|
||||
@@ -139,7 +139,7 @@ void Editor::send_idle_event() {
|
||||
plugin->dispatcher(plugin, effEditIdle, 0, 0, nullptr, 0);
|
||||
}
|
||||
|
||||
void Editor::handle_win32_events() {
|
||||
void Editor::handle_win32_events() const {
|
||||
MSG msg;
|
||||
|
||||
// The null value for the second argument is needed to handle interaction
|
||||
@@ -162,7 +162,7 @@ void Editor::handle_win32_events() {
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::handle_x11_events() {
|
||||
void Editor::handle_x11_events() const {
|
||||
// TODO: Initiating drag-and-drop in Serum _sometimes_ causes the GUI to
|
||||
// update while dragging while other times it does not. From all the
|
||||
// plugins I've tested this only happens in Serum though.
|
||||
@@ -201,7 +201,7 @@ void Editor::handle_x11_events() {
|
||||
}
|
||||
}
|
||||
|
||||
void Editor::fix_local_coordinates() {
|
||||
void Editor::fix_local_coordinates() const {
|
||||
// We're purposely not using XEmbed. This has the consequence that wine
|
||||
// still thinks that any X and Y coordinates are relative to the x11 window
|
||||
// root instead of the parent window provided by the DAW, causing all sorts
|
||||
|
||||
@@ -107,12 +107,12 @@ class Editor {
|
||||
* Must be run from the same thread the GUI was created in because of Win32
|
||||
* limitations.
|
||||
*/
|
||||
void handle_win32_events();
|
||||
void handle_win32_events() const;
|
||||
|
||||
/**
|
||||
* Handle X11 events sent to the window our editor is embedded in.
|
||||
*/
|
||||
void handle_x11_events();
|
||||
void handle_x11_events() const;
|
||||
|
||||
private:
|
||||
/**
|
||||
@@ -120,7 +120,7 @@ class Editor {
|
||||
* reparenting without using XEmbed. See the comment at the top of the
|
||||
* implementation on why this is needed.
|
||||
*/
|
||||
void fix_local_coordinates();
|
||||
void fix_local_coordinates() const;
|
||||
|
||||
/**
|
||||
* A pointer to the currently active window. Will be a null pointer if no
|
||||
|
||||
Reference in New Issue
Block a user