mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-10 04:30:12 +02:00
Clean up after reverting buffer handling change
This is what you get from not taking any breaks.
This commit is contained in:
+29
-35
@@ -193,43 +193,37 @@ void passthrough_event(boost::asio::local::stream_protocol::socket& socket,
|
|||||||
// arbitrary C-style string.
|
// arbitrary C-style string.
|
||||||
std::array<char, max_string_length> string_buffer;
|
std::array<char, max_string_length> string_buffer;
|
||||||
string_buffer[0] = 0;
|
string_buffer[0] = 0;
|
||||||
// This buffer is only used for retrieving chunk data and will be allocated
|
|
||||||
// as needed
|
|
||||||
std::vector<uint8_t> binary_buffer;
|
|
||||||
|
|
||||||
void* data = std::visit(
|
void* data = std::visit(
|
||||||
overload{[&](const std::nullptr_t&) -> void* { return nullptr; },
|
overload{
|
||||||
[&](const std::string& s) -> void* {
|
[&](const std::nullptr_t&) -> void* { return nullptr; },
|
||||||
return const_cast<char*>(s.c_str());
|
[&](const std::string& s) -> void* {
|
||||||
},
|
return const_cast<char*>(s.c_str());
|
||||||
[&](const std::vector<uint8_t>& buffer) -> void* {
|
},
|
||||||
return const_cast<uint8_t*>(buffer.data());
|
[&](const std::vector<uint8_t>& buffer) -> void* {
|
||||||
},
|
return const_cast<uint8_t*>(buffer.data());
|
||||||
[&](native_size_t& window_handle) -> void* {
|
},
|
||||||
// This is the X11 window handle that the editor should
|
[&](native_size_t& window_handle) -> void* {
|
||||||
// reparent itself to. We have a special wrapper around the
|
// This is the X11 window handle that the editor should reparent
|
||||||
// dispatch function that intercepts `effEditOpen` events
|
// itself to. We have a special wrapper around the dispatch
|
||||||
// and creates a Win32 window and then finally embeds the
|
// function that intercepts `effEditOpen` events and creates a
|
||||||
// X11 window Wine created into this wnidow handle.
|
// Win32 window and then finally embeds the X11 window Wine
|
||||||
// Make sure to convert the window ID first to `size_t` in
|
// created into this wnidow handle. Make sure to convert the
|
||||||
// case this is the 32-bit host.
|
// window ID first to `size_t` in case this is the 32-bit host.
|
||||||
return reinterpret_cast<void*>(
|
return reinterpret_cast<void*>(
|
||||||
static_cast<size_t>(window_handle));
|
static_cast<size_t>(window_handle));
|
||||||
},
|
},
|
||||||
[&](const AEffect&) -> void* { return nullptr; },
|
[&](const AEffect&) -> void* { return nullptr; },
|
||||||
[&](DynamicVstEvents& events) -> void* {
|
[&](DynamicVstEvents& events) -> void* {
|
||||||
return &events.as_c_events();
|
return &events.as_c_events();
|
||||||
},
|
},
|
||||||
[&](WantsChunkBuffer&) -> void* {
|
[&](WantsChunkBuffer&) -> void* { return string_buffer.data(); },
|
||||||
binary_buffer.resize(binary_buffer_size);
|
[&](VstIOProperties& props) -> void* { return &props; },
|
||||||
return binary_buffer.data();
|
[&](VstMidiKeyName& key_name) -> void* { return &key_name; },
|
||||||
},
|
[&](VstParameterProperties& props) -> void* { return &props; },
|
||||||
[&](VstIOProperties& props) -> void* { return &props; },
|
[&](WantsVstRect&) -> void* { return string_buffer.data(); },
|
||||||
[&](VstMidiKeyName& key_name) -> void* { return &key_name; },
|
[&](const WantsVstTimeInfo&) -> void* { return nullptr; },
|
||||||
[&](VstParameterProperties& props) -> void* { return &props; },
|
[&](WantsString&) -> void* { return string_buffer.data(); }},
|
||||||
[&](WantsVstRect&) -> void* { return string_buffer.data(); },
|
|
||||||
[&](const WantsVstTimeInfo&) -> void* { return nullptr; },
|
|
||||||
[&](WantsString&) -> void* { return string_buffer.data(); }},
|
|
||||||
event.payload);
|
event.payload);
|
||||||
|
|
||||||
const intptr_t return_value = callback(plugin, event.opcode, event.index,
|
const intptr_t return_value = callback(plugin, event.opcode, event.index,
|
||||||
|
|||||||
@@ -279,7 +279,7 @@ class DispatchDataConverter : DefaultDataConverter {
|
|||||||
std::get<std::vector<uint8_t>>(response.payload);
|
std::get<std::vector<uint8_t>>(response.payload);
|
||||||
chunk.assign(buffer.begin(), buffer.end());
|
chunk.assign(buffer.begin(), buffer.end());
|
||||||
|
|
||||||
*static_cast<void**>(data) = chunk.data();
|
*static_cast<uint8_t**>(data) = chunk.data();
|
||||||
} break;
|
} break;
|
||||||
case effGetInputProperties:
|
case effGetInputProperties:
|
||||||
case effGetOutputProperties: {
|
case effGetOutputProperties: {
|
||||||
|
|||||||
Reference in New Issue
Block a user