Removed Debug logs from user-view
This commit is contained in:
@@ -367,7 +367,7 @@ void AudioDownloader::run() {
|
||||
if (stop_.load()) break;
|
||||
setStatus("Downloading audio files (" + std::to_string(downloaded + 1) +
|
||||
" / " + std::to_string(queue.size()) + ")...");
|
||||
if (!downloadAndVerify(work.filename, work.md5)) break;
|
||||
if (!downloadAndVerify(work.filename, work.md5, work.display_name)) break;
|
||||
addAvailable(work);
|
||||
++downloaded;
|
||||
// Publish immediately so a file that just finished downloading
|
||||
@@ -388,7 +388,7 @@ void AudioDownloader::run() {
|
||||
continue;
|
||||
}
|
||||
if (orderByFilename.count(name) == 0) {
|
||||
logger::Logger::instance().info("Audio", "Removing leftover " + name);
|
||||
logger::Logger::instance().debug("Audio", "Removing leftover " + name);
|
||||
std::filesystem::remove(it->path(), ec);
|
||||
}
|
||||
}
|
||||
@@ -425,7 +425,7 @@ bool AudioDownloader::fetchManifest(std::vector<AudioManifestEntry>& out) {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool AudioDownloader::downloadAndVerify(const std::string& filename, const std::string& expectedMd5) {
|
||||
bool AudioDownloader::downloadAndVerify(const std::string& filename, const std::string& expectedMd5, const std::string& displayName) {
|
||||
std::string dir = audioDir();
|
||||
std::string destPath = dir + filename;
|
||||
std::string tmpPath = destPath + ".part";
|
||||
@@ -454,7 +454,7 @@ bool AudioDownloader::downloadAndVerify(const std::string& filename, const std::
|
||||
return false;
|
||||
}
|
||||
|
||||
logger::Logger::instance().info("Audio", "Downloaded and verified " + filename);
|
||||
logger::Logger::instance().info("Audio", "Downloaded and verified " + displayName);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public:
|
||||
private:
|
||||
void run();
|
||||
bool fetchManifest(std::vector<AudioManifestEntry>& out);
|
||||
bool downloadAndVerify(const std::string& filename, const std::string& expectedMd5);
|
||||
bool downloadAndVerify(const std::string& filename, const std::string& expectedMd5, const std::string& displayName);
|
||||
|
||||
void setStatus(const std::string& msg);
|
||||
void wait(std::chrono::seconds seconds);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "audio_manager.h"
|
||||
#include "db/database_manager.h"
|
||||
#include "logger/logger.h"
|
||||
|
||||
#include <SDL3/SDL.h>
|
||||
@@ -104,10 +105,31 @@ namespace radiantwave::audio
|
||||
float gain = enabled_ ? (volume_ / 100.0f) : 0.0f;
|
||||
MIX_SetMixerGain(mixer_, gain);
|
||||
|
||||
logger::Logger::instance().info("Audio", "SDL3_mixer audio system initialized successfully");
|
||||
logger::Logger::instance().debug("Audio", "SDL3_mixer audio system initialized successfully");
|
||||
return true;
|
||||
}
|
||||
|
||||
void AudioManager::attachDatabase(db::DatabaseManager& db)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
db_ = &db;
|
||||
}
|
||||
|
||||
std::string AudioManager::displayNameFor(const std::string& wav_filename) const
|
||||
{
|
||||
if (db_)
|
||||
{
|
||||
for (const auto& record : db_->getAudioFiles())
|
||||
{
|
||||
if (record.filename == wav_filename)
|
||||
{
|
||||
return record.display_name;
|
||||
}
|
||||
}
|
||||
}
|
||||
return wav_filename;
|
||||
}
|
||||
|
||||
float AudioManager::effectiveGain() const
|
||||
{
|
||||
return enabled_ ? (volume_ / 100.0f) : 0.0f;
|
||||
@@ -233,7 +255,7 @@ namespace radiantwave::audio
|
||||
std::lock_guard<std::mutex> lock(mutex_);
|
||||
currentDevice_ = raw_device_name;
|
||||
|
||||
logger::Logger::instance().info("Audio", "Switched audio output device to: " + mapToFriendlyDeviceName(raw_device_name));
|
||||
logger::Logger::instance().debug("Audio", "Switched audio output device to: " + mapToFriendlyDeviceName(raw_device_name));
|
||||
|
||||
if (configManager_)
|
||||
{
|
||||
@@ -301,7 +323,7 @@ namespace radiantwave::audio
|
||||
slot.fadeInElapsed = 0.0f;
|
||||
MIX_SetTrackGain(slot.track, 0.0f);
|
||||
MIX_PlayTrack(slot.track, 0); // Loop playback
|
||||
logger::Logger::instance().info("Audio", "Started playback of " + currentTrack_ + " (fade-in)");
|
||||
logger::Logger::instance().info("Audio", "Started playback of " + displayNameFor(currentTrack_) + " (fade-in)");
|
||||
}
|
||||
|
||||
bool AudioManager::playTrack(const std::string &wav_filename)
|
||||
@@ -325,7 +347,7 @@ namespace radiantwave::audio
|
||||
{ cfg.audio.current_track = wav_filename; });
|
||||
}
|
||||
|
||||
logger::Logger::instance().info("Audio", "Started playback of " + wav_filename);
|
||||
logger::Logger::instance().info("Audio", "Started playback of " + displayNameFor(wav_filename));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace radiantwave::db {
|
||||
class DatabaseManager;
|
||||
}
|
||||
|
||||
namespace radiantwave::audio {
|
||||
|
||||
struct AudioDeviceItem {
|
||||
@@ -28,6 +32,9 @@ public:
|
||||
// Initialize SDL3_mixer audio system
|
||||
bool initialize(config::ConfigManager& config);
|
||||
|
||||
// Provide a database handle for user-facing display-name lookups.
|
||||
void attachDatabase(db::DatabaseManager& db);
|
||||
|
||||
// Shutdown audio subsystem
|
||||
void shutdown();
|
||||
|
||||
@@ -75,8 +82,10 @@ private:
|
||||
float effectiveGain() const;
|
||||
bool loadTrackInto(int slotIndex, const std::string& wav_filename);
|
||||
void startFadeIn(int slotIndex, float seconds);
|
||||
std::string displayNameFor(const std::string& wav_filename) const;
|
||||
|
||||
config::ConfigManager* configManager_ = nullptr;
|
||||
db::DatabaseManager* db_ = nullptr;
|
||||
|
||||
bool initialized_ = false;
|
||||
bool enabled_ = true;
|
||||
|
||||
Reference in New Issue
Block a user