Use a Logger to print initialization errors

This way the errors will get written to a file instead of to STDERR if
`YABRIDGE_DEBUG_FILE` is set.
This commit is contained in:
Robbert van der Helm
2020-05-09 11:15:27 +02:00
parent c76992bb66
commit 57cb404f6b
3 changed files with 12 additions and 9 deletions
+1
View File
@@ -12,6 +12,7 @@ Versioning](https://semver.org/spec/v2.0.0.html).
- Changed installation recommendations to only install using symlinks with hosts
that support individually sandboxed plugins.
- Respect `YABRIDGE_DEBUG_FILE` when printing initialization errors.
## [1.1.0] - 2020-05-07
+7 -7
View File
@@ -378,13 +378,13 @@ as the _Windows VST plugin_. The whole process works as follows:
the `dispatcher()` and `audioMaster()` functions respectively. For operations
involving the plugin editor there is also some extra glue in
`WineBridge::dispatch_wrapper`. On the receiving end of the function calls,
the `passthrough_event()` function calls the callback functions and handles
the marshalling between our data types created by the `*DataConverter`
classes and the VST API's different pointer types. This behaviour is
separated from `receive_event()` so we can handle MIDI events separately.
This is needed because a select few plugins only store pointers to the
received events rather than copies of the objects. Because of this, the
received event data must live at least until the next audio buffer gets
the `passthrough_event()` function which calls the callback functions and
handles the marshalling between our data types created by the
`*DataConverter` classes and the VST API's different pointer types. This
behaviour is separated from `receive_event()` so we can handle MIDI events
separately. This is needed because a select few plugins only store pointers
to the received events rather than copies of the objects. Because of this,
the received event data must live at least until the next audio buffer gets
processed so it needs to be stored temporarily.
6. The Wine VST host loads the Windows VST plugin and starts forwarding messages
+4 -2
View File
@@ -19,6 +19,7 @@
#include <iostream>
#include <memory>
#include "../common/logging.h"
#include "plugin-bridge.h"
#define VST_EXPORT __attribute__((visibility("default")))
@@ -55,8 +56,9 @@ VST_EXPORT AEffect* VSTPluginMain(audioMasterCallback host_callback) {
return &bridge->plugin;
} catch (const std::exception& error) {
std::cerr << "Error during initialization:" << std::endl;
std::cerr << error.what() << std::endl;
Logger logger = Logger::create_from_environment();
logger.log("Error during initialization:");
logger.log(error.what());
return nullptr;
}