Route plugin logging through the Void::Log facade
Rewrite the ~80 ECHOION_LOG_* sites in PluginInterface/CoreLoader to
Void::Log::<level>("<Subsystem>", "{}", <expr>); add <iostream> where the
deleted LoggerInterface.hpp previously pulled it in. The plugin shares the
process-wide Void::Log sink installed by Core.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
1 parent
b313ed7101
commit
9a61e01fda
2 files changed
+83
-82
No files matched your search
+21
-21
@@ -1,4 +1,4 @@
|
||||
#include "LoggerInterface.hpp"
|
||||
#include <Void/Log/Log.hpp>
|
||||
#include "dylib.hpp"
|
||||
#include "echoion/plugin/CoreLoader.hpp"
|
||||
#include <chrono>
|
||||
@@ -21,7 +21,7 @@ namespace Echoion::Plugin
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
if (!currentLibraryPath_.empty() &&
|
||||
std::filesystem::exists(currentLibraryPath_)) {
|
||||
ECHOION_LOG_INFO(std::format("Enabling auto-reload for: {}",
|
||||
Void::Log::info("CoreLoader", "{}", std::format("Enabling auto-reload for: {}",
|
||||
currentLibraryPath_.string()));
|
||||
|
||||
fileWatcher_.startWatching(currentLibraryPath_,
|
||||
@@ -33,7 +33,7 @@ namespace Echoion::Plugin
|
||||
{
|
||||
autoReloadEnabled_ = false;
|
||||
fileWatcher_.stopWatching();
|
||||
ECHOION_LOG_INFO("Auto-reload disabled");
|
||||
Void::Log::info("CoreLoader", "{}", "Auto-reload disabled");
|
||||
}
|
||||
|
||||
bool CoreLoader::isAutoReloadEnabled() const noexcept
|
||||
@@ -47,7 +47,7 @@ namespace Echoion::Plugin
|
||||
return;
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("CoreLoader", "{}",
|
||||
"Core file changed, scheduling hot reload after current track...");
|
||||
|
||||
// Small delay to ensure file write is complete
|
||||
@@ -69,7 +69,7 @@ namespace Echoion::Plugin
|
||||
}
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("CoreLoader", "{}",
|
||||
std::format("Playback active (track: {}), deferring reload "
|
||||
"until track finishes",
|
||||
currentTrackId));
|
||||
@@ -85,10 +85,10 @@ namespace Echoion::Plugin
|
||||
// No playback, reload immediately
|
||||
auto result = hotReload(currentLibraryPath_);
|
||||
if (!result) {
|
||||
ECHOION_LOG_ERROR(std::format("Auto hot-reload failed: {}",
|
||||
Void::Log::error("CoreLoader", "{}", std::format("Auto hot-reload failed: {}",
|
||||
result.error().message));
|
||||
} else {
|
||||
ECHOION_LOG_INFO("Auto hot-reload completed successfully");
|
||||
Void::Log::info("CoreLoader", "{}", "Auto hot-reload completed successfully");
|
||||
// Notify Plugin to re-register callbacks
|
||||
if (hotReloadCallback_) {
|
||||
hotReloadCallback_();
|
||||
@@ -129,7 +129,7 @@ namespace Echoion::Plugin
|
||||
void CoreLoader::waitForTrackAndReload(
|
||||
const std::filesystem::path& targetPath, const std::string& trackId)
|
||||
{
|
||||
ECHOION_LOG_INFO(std::format(
|
||||
Void::Log::info("CoreLoader", "{}", std::format(
|
||||
"Waiting for track {} to finish before reload...", trackId));
|
||||
|
||||
// Poll every 500ms to check if the specific track finished
|
||||
@@ -139,7 +139,7 @@ namespace Echoion::Plugin
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("Track finished, starting hot reload");
|
||||
Void::Log::info("CoreLoader", "{}", "Track finished, starting hot reload");
|
||||
|
||||
// Clear pending flag
|
||||
{
|
||||
@@ -151,10 +151,10 @@ namespace Echoion::Plugin
|
||||
// Now do the reload
|
||||
auto result = hotReload(targetPath);
|
||||
if (!result) {
|
||||
ECHOION_LOG_ERROR(std::format("Deferred hot-reload failed: {}",
|
||||
Void::Log::error("CoreLoader", "{}", std::format("Deferred hot-reload failed: {}",
|
||||
result.error().message));
|
||||
} else {
|
||||
ECHOION_LOG_INFO("Deferred hot-reload completed successfully");
|
||||
Void::Log::info("CoreLoader", "{}", "Deferred hot-reload completed successfully");
|
||||
// Notify Plugin to re-register callbacks
|
||||
if (hotReloadCallback_) {
|
||||
hotReloadCallback_();
|
||||
@@ -238,13 +238,13 @@ namespace Echoion::Plugin
|
||||
|
||||
hotReloading_ = true;
|
||||
|
||||
ECHOION_LOG_INFO("Starting hot reload with temp file...");
|
||||
Void::Log::info("CoreLoader", "{}", "Starting hot reload with temp file...");
|
||||
|
||||
// Step 1: Save state as opaque blob (Plugin doesn't know contents)
|
||||
Api::StateBlob stateBlob;
|
||||
if (core_) {
|
||||
stateBlob = core_->saveState();
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("CoreLoader", "{}",
|
||||
std::format("Saved state: version={}, size={} bytes",
|
||||
stateBlob.version, stateBlob.size()));
|
||||
}
|
||||
@@ -300,13 +300,13 @@ namespace Echoion::Plugin
|
||||
auto coreVersion = core_->getStateFormatVersion();
|
||||
auto stateVersion = stateBlob.version;
|
||||
|
||||
ECHOION_LOG_INFO(std::format("Restoring state v{} to Core v{}",
|
||||
Void::Log::info("CoreLoader", "{}", std::format("Restoring state v{} to Core v{}",
|
||||
stateVersion, coreVersion));
|
||||
|
||||
if (core_->canRestoreStateVersion(stateVersion)) {
|
||||
auto restoreResult = core_->restoreState(stateBlob);
|
||||
if (!restoreResult) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("CoreLoader", "{}",
|
||||
std::format("Failed to restore state: {}",
|
||||
restoreResult.error().message));
|
||||
|
||||
@@ -314,17 +314,17 @@ namespace Echoion::Plugin
|
||||
if (restoreResult.error().code ==
|
||||
Api::ErrorCode::IncompatibleVersion) {
|
||||
// Signal user to update/restart
|
||||
ECHOION_LOG_WARNING("State version incompatible. "
|
||||
Void::Log::warn("CoreLoader", "{}", "State version incompatible. "
|
||||
"User needs to update/restart.");
|
||||
// Optionally: notify through plugin interface
|
||||
}
|
||||
|
||||
// Continue with empty state - graceful degradation
|
||||
} else {
|
||||
ECHOION_LOG_INFO("State restored successfully");
|
||||
Void::Log::info("CoreLoader", "{}", "State restored successfully");
|
||||
}
|
||||
} else {
|
||||
ECHOION_LOG_WARNING(std::format(
|
||||
Void::Log::warn("CoreLoader", "{}", std::format(
|
||||
"Cannot restore state v{} in Core v{}. "
|
||||
"Version age exceeds maximum supported ({} versions).",
|
||||
stateVersion, coreVersion,
|
||||
@@ -336,7 +336,7 @@ namespace Echoion::Plugin
|
||||
currentLibraryPath_ = targetPath;
|
||||
hotReloading_ = false;
|
||||
|
||||
ECHOION_LOG_INFO("Hot reload complete");
|
||||
Void::Log::info("CoreLoader", "{}", "Hot reload complete");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -411,7 +411,7 @@ namespace Echoion::Plugin
|
||||
|
||||
loaded_ = true;
|
||||
|
||||
ECHOION_LOG_INFO(std::format(
|
||||
Void::Log::info("CoreLoader", "{}", std::format(
|
||||
"Core library loaded (API version: {})", versionFunc()));
|
||||
return {};
|
||||
|
||||
@@ -434,7 +434,7 @@ namespace Echoion::Plugin
|
||||
return {};
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("Unloading core library...");
|
||||
Void::Log::info("CoreLoader", "{}", "Unloading core library...");
|
||||
|
||||
if (core_) {
|
||||
core_->shutdown();
|
||||
|
||||
+62
-61
@@ -1,5 +1,6 @@
|
||||
#include <iostream>
|
||||
#include <echoion/plugin/PluginInterface.hpp>
|
||||
#include "LoggerInterface.hpp"
|
||||
#include <Void/Log/Log.hpp>
|
||||
#include "teamspeak/public_definitions.h"
|
||||
#include "teamspeak/public_rare_definitions.h"
|
||||
#include <cstring>
|
||||
@@ -55,7 +56,7 @@ namespace Echoion::Plugin
|
||||
if (res != ERROR_ok) {
|
||||
char* errorMsg = nullptr;
|
||||
ts3Functions_->getErrorMessage(res, &errorMsg);
|
||||
ECHOION_LOG_ERROR(std::format(
|
||||
Void::Log::error("PluginInterface", "{}", std::format(
|
||||
"Unable to register custom device: {}",
|
||||
errorMsg));
|
||||
ts3Functions_->freeMemory(errorMsg);
|
||||
@@ -66,7 +67,7 @@ namespace Echoion::Plugin
|
||||
});
|
||||
|
||||
initialized_ = true;
|
||||
ECHOION_LOG_INFO("PluginInterface initialized with TeamSpeak functions "
|
||||
Void::Log::info("PluginInterface", "{}", "PluginInterface initialized with TeamSpeak functions "
|
||||
"(audio deferred)");
|
||||
return {};
|
||||
}
|
||||
@@ -118,7 +119,7 @@ namespace Echoion::Plugin
|
||||
ts3Functions_ = nullptr;
|
||||
initialized_ = false;
|
||||
|
||||
ECHOION_LOG_INFO("PluginInterface shutdown");
|
||||
Void::Log::info("PluginInterface", "{}", "PluginInterface shutdown");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -429,7 +430,7 @@ namespace Echoion::Plugin
|
||||
std::max(maxSample, std::abs(static_cast<int>(data[i])));
|
||||
}
|
||||
nonZeroTotal += nonZero;
|
||||
ECHOION_LOG_DEBUG(std::format(
|
||||
Void::Log::debug("PluginInterface", "{}", std::format(
|
||||
"sendAudioData {}: {} samples, nonZero={}/100, maxSample={}, "
|
||||
"queueSize={}",
|
||||
callCount, data.size(), nonZero, maxSample,
|
||||
@@ -438,7 +439,7 @@ namespace Echoion::Plugin
|
||||
|
||||
if (!initialized_ || !ts3Functions_) {
|
||||
if (callCount <= 10) {
|
||||
ECHOION_LOG_ERROR(std::format(
|
||||
Void::Log::error("PluginInterface", "{}", std::format(
|
||||
"sendAudioData {}: not initialized", callCount));
|
||||
}
|
||||
return Api::fail(Api::ErrorCode::ServiceUnavailable,
|
||||
@@ -447,7 +448,7 @@ namespace Echoion::Plugin
|
||||
|
||||
if (!audioDeviceOpen_) {
|
||||
if (callCount <= 10) {
|
||||
ECHOION_LOG_ERROR(std::format(
|
||||
Void::Log::error("PluginInterface", "{}", std::format(
|
||||
"sendAudioData {}: audio device not open", callCount));
|
||||
}
|
||||
return Api::fail(
|
||||
@@ -506,7 +507,7 @@ namespace Echoion::Plugin
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
eventCallbacks_.push_back(callback);
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("PluginInterface", "{}",
|
||||
std::format("Event callback registered, total callbacks: {}",
|
||||
eventCallbacks_.size()));
|
||||
}
|
||||
@@ -523,7 +524,7 @@ namespace Echoion::Plugin
|
||||
void PluginInterface::clearEventCallbacks()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("PluginInterface", "{}",
|
||||
std::format("Clearing {} event callbacks", eventCallbacks_.size()));
|
||||
eventCallbacks_.clear();
|
||||
}
|
||||
@@ -626,7 +627,7 @@ namespace Echoion::Plugin
|
||||
serverConnectionHandlerId_ = 0;
|
||||
char* msg;
|
||||
ts3Functions_->getErrorMessage(error, &msg);
|
||||
ECHOION_LOG_ERROR(std::format("GUI Connect failed: {}", msg));
|
||||
Void::Log::error("PluginInterface", "{}", std::format("GUI Connect failed: {}", msg));
|
||||
ts3Functions_->freeMemory(msg);
|
||||
return Api::fail(
|
||||
Api::ErrorCode::NetworkError,
|
||||
@@ -636,11 +637,11 @@ namespace Echoion::Plugin
|
||||
// Open audio device
|
||||
auto audioResult = openAudioDevice();
|
||||
if (!audioResult) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
"Failed to open audio device, continuing without audio");
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO(std::format("Connecting to server {}:{} as {}",
|
||||
Void::Log::info("PluginInterface", "{}", std::format("Connecting to server {}:{} as {}",
|
||||
config.address, config.port,
|
||||
config.nickname));
|
||||
|
||||
@@ -664,7 +665,7 @@ namespace Echoion::Plugin
|
||||
unsigned int error = ts3Functions_->stopConnection(
|
||||
serverConnectionHandlerId_, "Echoion Bot disconnecting");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Error stopping connection: {}", error));
|
||||
}
|
||||
|
||||
@@ -672,12 +673,12 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->destroyServerConnectionHandler(
|
||||
serverConnectionHandlerId_);
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Error destroying connection handler: {}", error));
|
||||
}
|
||||
|
||||
serverConnectionHandlerId_ = 0;
|
||||
ECHOION_LOG_INFO("Disconnected from server");
|
||||
Void::Log::info("PluginInterface", "{}", "Disconnected from server");
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -715,22 +716,22 @@ namespace Echoion::Plugin
|
||||
|
||||
Api::Result<void> PluginInterface::registerAudioDevice()
|
||||
{
|
||||
ECHOION_LOG_DEBUG("registerAudioDevice called");
|
||||
Void::Log::debug("PluginInterface", "{}", "registerAudioDevice called");
|
||||
|
||||
if (!ts3Functions_) {
|
||||
ECHOION_LOG_ERROR("registerAudioDevice: ts3Functions_ is null");
|
||||
Void::Log::error("PluginInterface", "{}", "registerAudioDevice: ts3Functions_ is null");
|
||||
return Api::fail(Api::ErrorCode::ServiceUnavailable,
|
||||
"TS3 functions not available");
|
||||
}
|
||||
|
||||
if (audioDeviceRegistered_) {
|
||||
ECHOION_LOG_DEBUG("registerAudioDevice: already registered");
|
||||
Void::Log::debug("PluginInterface", "{}", "registerAudioDevice: already registered");
|
||||
return {};
|
||||
}
|
||||
|
||||
// Check if registerCustomDevice is available (null pointer check)
|
||||
if (!ts3Functions_->registerCustomDevice) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
"registerCustomDevice not available in this TeamSpeak version");
|
||||
return Api::fail(Api::ErrorCode::NotSupported,
|
||||
"Custom audio devices not supported by this "
|
||||
@@ -738,7 +739,7 @@ namespace Echoion::Plugin
|
||||
}
|
||||
|
||||
// Register custom device for both capture and playback
|
||||
ECHOION_LOG_DEBUG(std::format("Registering device: {} at {}Hz, {}ch",
|
||||
Void::Log::debug("PluginInterface", "{}", std::format("Registering device: {} at {}Hz, {}ch",
|
||||
AudioDeviceConfig::DEVICE_ID,
|
||||
AudioDeviceConfig::SAMPLE_RATE,
|
||||
AudioDeviceConfig::CHANNELS));
|
||||
@@ -752,7 +753,7 @@ namespace Echoion::Plugin
|
||||
AudioDeviceConfig::CHANNELS);
|
||||
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("PluginInterface", "{}",
|
||||
std::format("registerCustomDevice failed: {}", error));
|
||||
return Api::fail(
|
||||
Api::ErrorCode::PluginError,
|
||||
@@ -761,7 +762,7 @@ namespace Echoion::Plugin
|
||||
}
|
||||
|
||||
audioDeviceRegistered_ = true;
|
||||
ECHOION_LOG_INFO("Audio device registered successfully");
|
||||
Void::Log::info("PluginInterface", "{}", "Audio device registered successfully");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -779,7 +780,7 @@ namespace Echoion::Plugin
|
||||
|
||||
// Check if unregisterCustomDevice is available
|
||||
if (!ts3Functions_->unregisterCustomDevice) {
|
||||
ECHOION_LOG_WARNING("");
|
||||
Void::Log::warn("PluginInterface", "{}", "");
|
||||
std::cerr << std::format(
|
||||
"[WARNING] unregisterCustomDevice not available")
|
||||
<< std::endl;
|
||||
@@ -805,46 +806,46 @@ namespace Echoion::Plugin
|
||||
Api::Result<void> PluginInterface::openAudioDevice()
|
||||
{
|
||||
if (auto res = closeAudioDevice(); !res.has_value()) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("PluginInterface", "{}",
|
||||
std::format("Not closed devices: {}", res.error().toString()));
|
||||
}
|
||||
|
||||
ECHOION_LOG_DEBUG("openAudioDevice called");
|
||||
Void::Log::debug("PluginInterface", "{}", "openAudioDevice called");
|
||||
|
||||
if (!ts3Functions_) {
|
||||
ECHOION_LOG_ERROR("openAudioDevice: ts3Functions_ is null");
|
||||
Void::Log::error("PluginInterface", "{}", "openAudioDevice: ts3Functions_ is null");
|
||||
return Api::fail(Api::ErrorCode::ServiceUnavailable,
|
||||
"TS3 functions not available");
|
||||
}
|
||||
|
||||
if (!audioDeviceRegistered_) {
|
||||
ECHOION_LOG_ERROR("openAudioDevice: device not registered");
|
||||
Void::Log::error("PluginInterface", "{}", "openAudioDevice: device not registered");
|
||||
return Api::fail(Api::ErrorCode::ServiceUnavailable,
|
||||
"Audio device not registered");
|
||||
}
|
||||
|
||||
if (audioDeviceOpen_) {
|
||||
ECHOION_LOG_DEBUG("openAudioDevice: already open");
|
||||
Void::Log::debug("PluginInterface", "{}", "openAudioDevice: already open");
|
||||
return {};
|
||||
}
|
||||
|
||||
if (serverConnectionHandlerId_ == 0) {
|
||||
ECHOION_LOG_ERROR("openAudioDevice: not connected (handler=0)");
|
||||
Void::Log::error("PluginInterface", "{}", "openAudioDevice: not connected (handler=0)");
|
||||
return Api::fail(
|
||||
Api::ErrorCode::ServiceUnavailable, "Not connected to server");
|
||||
}
|
||||
|
||||
// Close any existing device first (in case it was left open)
|
||||
ECHOION_LOG_DEBUG("Closing any existing device first...");
|
||||
Void::Log::debug("PluginInterface", "{}", "Closing any existing device first...");
|
||||
ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_);
|
||||
ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_);
|
||||
|
||||
ECHOION_LOG_DEBUG("Opening playback device...");
|
||||
Void::Log::debug("PluginInterface", "{}", "Opening playback device...");
|
||||
unsigned int err = ts3Functions_->openPlaybackDevice(
|
||||
serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID);
|
||||
|
||||
if (err == ERROR_sound_device_already_registerred) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
"Playback device already registered, treating as open");
|
||||
audioDeviceOpen_ = true;
|
||||
return {};
|
||||
@@ -855,14 +856,14 @@ namespace Echoion::Plugin
|
||||
ts3Functions_->getErrorMessage(err, &msg);
|
||||
std::string errStr = msg;
|
||||
ts3Functions_->freeMemory(msg);
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("PluginInterface", "{}",
|
||||
std::format("openPlaybackDevice failed: {}", errStr));
|
||||
return Api::fail(
|
||||
Api::ErrorCode::PluginError,
|
||||
std::format("Failed to open playback device: {}", errStr));
|
||||
}
|
||||
|
||||
ECHOION_LOG_DEBUG("Opening capture device...");
|
||||
Void::Log::debug("PluginInterface", "{}", "Opening capture device...");
|
||||
err = ts3Functions_->openCaptureDevice(
|
||||
serverConnectionHandlerId_, "custom", AudioDeviceConfig::DEVICE_ID);
|
||||
|
||||
@@ -871,17 +872,17 @@ namespace Echoion::Plugin
|
||||
ts3Functions_->getErrorMessage(err, &msg);
|
||||
std::string errStr = msg;
|
||||
ts3Functions_->freeMemory(msg);
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to open capture device: {}", errStr));
|
||||
}
|
||||
|
||||
audioDeviceOpen_ = true;
|
||||
ECHOION_LOG_INFO("Audio device opened successfully");
|
||||
Void::Log::info("PluginInterface", "{}", "Audio device opened successfully");
|
||||
|
||||
// Configure audio profile for optimal music playback
|
||||
auto profileResult = configureAudioProfile();
|
||||
if (!profileResult) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to configure audio profile: {}",
|
||||
profileResult.error().message));
|
||||
// Continue anyway - audio will still work with default settings
|
||||
@@ -903,18 +904,18 @@ namespace Echoion::Plugin
|
||||
unsigned int error =
|
||||
ts3Functions_->closePlaybackDevice(serverConnectionHandlerId_);
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Error closing playback device: {}", error));
|
||||
}
|
||||
|
||||
error = ts3Functions_->closeCaptureDevice(serverConnectionHandlerId_);
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Error closing capture device: {}", error));
|
||||
}
|
||||
|
||||
audioDeviceOpen_ = false;
|
||||
ECHOION_LOG_INFO("Audio device closed");
|
||||
Void::Log::info("PluginInterface", "{}", "Audio device closed");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -938,19 +939,19 @@ namespace Echoion::Plugin
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(eventMutex_);
|
||||
if (eventCallbacks_.empty()) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
"No event callbacks registered, event will be dropped!");
|
||||
return;
|
||||
}
|
||||
ECHOION_LOG_DEBUG(std::format("Broadcasting event to {} callbacks",
|
||||
Void::Log::debug("PluginInterface", "{}", std::format("Broadcasting event to {} callbacks",
|
||||
eventCallbacks_.size()));
|
||||
for (size_t i = 0; i < eventCallbacks_.size(); ++i) {
|
||||
try {
|
||||
ECHOION_LOG_DEBUG(std::format("Calling callback {}...", i));
|
||||
Void::Log::debug("PluginInterface", "{}", std::format("Calling callback {}...", i));
|
||||
eventCallbacks_[i](event);
|
||||
ECHOION_LOG_DEBUG(std::format("Callback {} completed", i));
|
||||
Void::Log::debug("PluginInterface", "{}", std::format("Callback {} completed", i));
|
||||
} catch (const std::exception& e) {
|
||||
ECHOION_LOG_ERROR(
|
||||
Void::Log::error("PluginInterface", "{}",
|
||||
std::format("Event callback {} error: {}", i, e.what()));
|
||||
}
|
||||
}
|
||||
@@ -1082,7 +1083,7 @@ namespace Echoion::Plugin
|
||||
Api::ErrorCode::ServiceUnavailable, "Not connected to server");
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("Configuring audio profile for music bot...");
|
||||
Void::Log::info("PluginInterface", "{}", "Configuring audio profile for music bot...");
|
||||
|
||||
// Configure preprocessor settings (noise reduction, echo cancellation,
|
||||
// etc.) These settings optimize the audio for music playback rather
|
||||
@@ -1093,7 +1094,7 @@ namespace Echoion::Plugin
|
||||
unsigned int error = ts3Functions_->setPreProcessorConfigValue(
|
||||
serverConnectionHandlerId_, "denoise", "false");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable denoiser: {}", error));
|
||||
}
|
||||
|
||||
@@ -1101,7 +1102,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setPreProcessorConfigValue(
|
||||
serverConnectionHandlerId_, "agc", "false");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable AGC: {}", error));
|
||||
}
|
||||
|
||||
@@ -1110,7 +1111,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setPreProcessorConfigValue(
|
||||
serverConnectionHandlerId_, "vad", "false");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable VAD: {}", error));
|
||||
}
|
||||
|
||||
@@ -1118,7 +1119,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setPreProcessorConfigValue(
|
||||
serverConnectionHandlerId_, "echocancel", "false");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable echo cancellation: {}", error));
|
||||
}
|
||||
|
||||
@@ -1126,7 +1127,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setPreProcessorConfigValue(
|
||||
serverConnectionHandlerId_, "echo_reduction", "false");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable echo reduction: {}", error));
|
||||
}
|
||||
|
||||
@@ -1135,7 +1136,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setPlaybackConfigValue(
|
||||
serverConnectionHandlerId_, "typing_attenuation", "0");
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
std::format("Failed to disable typing attenuation: {}", error));
|
||||
}
|
||||
|
||||
@@ -1144,7 +1145,7 @@ namespace Echoion::Plugin
|
||||
error = ts3Functions_->setClientSelfVariableAsInt(
|
||||
serverConnectionHandlerId_, CLIENT_INPUT_DEACTIVATED, 0);
|
||||
if (error != ERROR_ok) {
|
||||
ECHOION_LOG_WARNING(std::format(
|
||||
Void::Log::warn("PluginInterface", "{}", std::format(
|
||||
"Failed to enable continuous transmission: {}", error));
|
||||
}
|
||||
const char* returnCode = nullptr;
|
||||
@@ -1152,7 +1153,7 @@ namespace Echoion::Plugin
|
||||
ts3Functions_->flushClientSelfUpdates(serverConnectionHandlerId_,
|
||||
returnCode);
|
||||
|
||||
ECHOION_LOG_INFO("Audio profile configured successfully");
|
||||
Void::Log::info("PluginInterface", "{}", "Audio profile configured successfully");
|
||||
return {};
|
||||
}
|
||||
|
||||
@@ -1163,7 +1164,7 @@ namespace Echoion::Plugin
|
||||
"TS3 functions not available");
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("Checking for first-run setup...");
|
||||
Void::Log::info("PluginInterface", "{}", "Checking for first-run setup...");
|
||||
|
||||
// Check if we have a valid client identity
|
||||
// TeamSpeak requires accepting TOS on first run, which is handled by
|
||||
@@ -1173,13 +1174,13 @@ namespace Echoion::Plugin
|
||||
char* identity = nullptr;
|
||||
unsigned int error = ts3Functions_->getClientLibVersion(&identity);
|
||||
if (error != ERROR_ok || !identity) {
|
||||
ECHOION_LOG_WARNING(
|
||||
Void::Log::warn("PluginInterface", "{}",
|
||||
"TeamSpeak client library not properly initialized");
|
||||
ECHOION_LOG_INFO(
|
||||
Void::Log::info("PluginInterface", "{}",
|
||||
"Please ensure TeamSpeak client is properly configured:");
|
||||
ECHOION_LOG_INFO(" 1. Accept the Terms of Service");
|
||||
ECHOION_LOG_INFO(" 2. Create/obtain your identity");
|
||||
ECHOION_LOG_INFO(" 3. Complete the initial setup wizard");
|
||||
Void::Log::info("PluginInterface", "{}", " 1. Accept the Terms of Service");
|
||||
Void::Log::info("PluginInterface", "{}", " 2. Create/obtain your identity");
|
||||
Void::Log::info("PluginInterface", "{}", " 3. Complete the initial setup wizard");
|
||||
|
||||
if (identity) {
|
||||
ts3Functions_->freeMemory(identity);
|
||||
@@ -1193,7 +1194,7 @@ namespace Echoion::Plugin
|
||||
ts3Functions_->freeMemory(identity);
|
||||
}
|
||||
|
||||
ECHOION_LOG_INFO("TeamSpeak client is properly initialized");
|
||||
Void::Log::info("PluginInterface", "{}", "TeamSpeak client is properly initialized");
|
||||
return {};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user