Commit b29a43b4 authored by Max Kellermann's avatar Max Kellermann

decoder/mad, ...: more libfmt logging

parent f60a42e0
...@@ -234,7 +234,7 @@ cycle_log_files() noexcept ...@@ -234,7 +234,7 @@ cycle_log_files() noexcept
if (out_path.IsNull()) if (out_path.IsNull())
return 0; return 0;
FormatDebug(log_domain, "Cycling log files"); LogDebug(log_domain, "Cycling log files");
close_log_files(); close_log_files();
fd = open_log_file(); fd = open_log_file();
......
...@@ -44,7 +44,7 @@ Client::OnTimeout() noexcept ...@@ -44,7 +44,7 @@ Client::OnTimeout() noexcept
assert(!idle_waiting); assert(!idle_waiting);
assert(!background_command); assert(!background_command);
FormatDebug(client_domain, "[%u] timeout", num); FmtDebug(client_domain, "[{}] timeout", num);
} }
Close(); Close();
......
...@@ -113,8 +113,7 @@ UpdateService::Task() noexcept ...@@ -113,8 +113,7 @@ UpdateService::Task() noexcept
SetThreadName("update"); SetThreadName("update");
if (!next.path_utf8.empty()) if (!next.path_utf8.empty())
FormatDebug(update_domain, "starting: %s", FmtDebug(update_domain, "starting: {}", next.path_utf8);
next.path_utf8.c_str());
else else
LogDebug(update_domain, "starting"); LogDebug(update_domain, "starting");
...@@ -133,8 +132,7 @@ UpdateService::Task() noexcept ...@@ -133,8 +132,7 @@ UpdateService::Task() noexcept
} }
if (!next.path_utf8.empty()) if (!next.path_utf8.empty())
FormatDebug(update_domain, "finished: %s", FmtDebug(update_domain, "finished: {}", next.path_utf8);
next.path_utf8.c_str());
else else
LogDebug(update_domain, "finished"); LogDebug(update_domain, "finished");
...@@ -155,8 +153,8 @@ UpdateService::StartThread(UpdateQueueItem &&i) ...@@ -155,8 +153,8 @@ UpdateService::StartThread(UpdateQueueItem &&i)
update_thread.Start(); update_thread.Start();
FormatDebug(update_domain, FmtDebug(update_domain,
"spawned thread for update job id %i", next.id); "spawned thread for update job id {}", next.id);
} }
unsigned unsigned
......
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include "DecoderAPI.hxx" #include "DecoderAPI.hxx"
#include "Domain.hxx" #include "Domain.hxx"
#include "Control.hxx" #include "Control.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "pcm/Convert.hxx" #include "pcm/Convert.hxx"
#include "MusicPipe.hxx" #include "MusicPipe.hxx"
...@@ -268,9 +269,9 @@ DecoderBridge::Ready(const AudioFormat audio_format, ...@@ -268,9 +269,9 @@ DecoderBridge::Ready(const AudioFormat audio_format,
assert(decoder_tag == nullptr); assert(decoder_tag == nullptr);
assert(!seeking); assert(!seeking);
FormatDebug(decoder_domain, "audio_format=%s, seekable=%s", FmtDebug(decoder_domain, "audio_format={}, seekable={}",
ToString(audio_format).c_str(), audio_format,
seekable ? "true" : "false"); seekable);
{ {
const std::lock_guard<Mutex> protect(dc.mutex); const std::lock_guard<Mutex> protect(dc.mutex);
...@@ -278,8 +279,8 @@ DecoderBridge::Ready(const AudioFormat audio_format, ...@@ -278,8 +279,8 @@ DecoderBridge::Ready(const AudioFormat audio_format,
} }
if (dc.in_audio_format != dc.out_audio_format) { if (dc.in_audio_format != dc.out_audio_format) {
FormatDebug(decoder_domain, "converting to %s", FmtDebug(decoder_domain, "converting to %s",
ToString(dc.out_audio_format).c_str()); dc.out_audio_format);
try { try {
convert = std::make_unique<PcmConvert>(dc.in_audio_format, convert = std::make_unique<PcmConvert>(dc.in_audio_format,
......
...@@ -61,7 +61,7 @@ DecoderUriDecode(const DecoderPlugin &plugin, ...@@ -61,7 +61,7 @@ DecoderUriDecode(const DecoderPlugin &plugin,
assert(uri != nullptr); assert(uri != nullptr);
assert(bridge.dc.state == DecoderState::START); assert(bridge.dc.state == DecoderState::START);
FormatDebug(decoder_thread_domain, "probing plugin %s", plugin.name); FmtDebug(decoder_thread_domain, "probing plugin {}", plugin.name);
if (bridge.dc.command == DecoderCommand::STOP) if (bridge.dc.command == DecoderCommand::STOP)
throw StopDecoder(); throw StopDecoder();
...@@ -99,7 +99,7 @@ decoder_stream_decode(const DecoderPlugin &plugin, ...@@ -99,7 +99,7 @@ decoder_stream_decode(const DecoderPlugin &plugin,
assert(input_stream.IsReady()); assert(input_stream.IsReady());
assert(bridge.dc.state == DecoderState::START); assert(bridge.dc.state == DecoderState::START);
FormatDebug(decoder_thread_domain, "probing plugin %s", plugin.name); FmtDebug(decoder_thread_domain, "probing plugin {}", plugin.name);
if (bridge.dc.command == DecoderCommand::STOP) if (bridge.dc.command == DecoderCommand::STOP)
throw StopDecoder(); throw StopDecoder();
...@@ -142,7 +142,7 @@ decoder_file_decode(const DecoderPlugin &plugin, ...@@ -142,7 +142,7 @@ decoder_file_decode(const DecoderPlugin &plugin,
assert(path.IsAbsolute()); assert(path.IsAbsolute());
assert(bridge.dc.state == DecoderState::START); assert(bridge.dc.state == DecoderState::START);
FormatDebug(decoder_thread_domain, "probing plugin %s", plugin.name); FmtDebug(decoder_thread_domain, "probing plugin {}", plugin.name);
if (bridge.dc.command == DecoderCommand::STOP) if (bridge.dc.command == DecoderCommand::STOP)
throw StopDecoder(); throw StopDecoder();
......
...@@ -38,8 +38,8 @@ static unsigned sample_rate; ...@@ -38,8 +38,8 @@ static unsigned sample_rate;
static bool static bool
adplug_init(const ConfigBlock &block) adplug_init(const ConfigBlock &block)
{ {
FormatDebug(adplug_domain, "adplug %s", FmtDebug(adplug_domain, "adplug {}",
CAdPlug::get_version().c_str()); CAdPlug::get_version());
sample_rate = block.GetPositiveValue("sample_rate", 48000U); sample_rate = block.GetPositiveValue("sample_rate", 48000U);
CheckSampleRate(sample_rate); CheckSampleRate(sample_rate);
......
...@@ -168,8 +168,8 @@ audiofile_setup_sample_format(AFfilehandle af_fp) noexcept ...@@ -168,8 +168,8 @@ audiofile_setup_sample_format(AFfilehandle af_fp) noexcept
afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits); afGetSampleFormat(af_fp, AF_DEFAULT_TRACK, &fs, &bits);
if (!audio_valid_sample_format(audiofile_bits_to_sample_format(bits))) { if (!audio_valid_sample_format(audiofile_bits_to_sample_format(bits))) {
FormatDebug(audiofile_domain, FmtDebug(audiofile_domain,
"input file has %d bit samples, converting to 16", "input file has {} bit samples, converting to 16",
bits); bits);
bits = 16; bits = 16;
} }
......
...@@ -73,8 +73,8 @@ flac_scan_file(Path path_fs, TagHandler &handler) ...@@ -73,8 +73,8 @@ flac_scan_file(Path path_fs, TagHandler &handler)
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.Read(NarrowPath(path_fs))) { if (!chain.Read(NarrowPath(path_fs))) {
FormatDebug(flac_domain, FmtDebug(flac_domain,
"Failed to read FLAC tags: %s", "Failed to read FLAC tags: {}",
chain.GetStatusString()); chain.GetStatusString());
return false; return false;
} }
...@@ -88,8 +88,8 @@ flac_scan_stream(InputStream &is, TagHandler &handler) ...@@ -88,8 +88,8 @@ flac_scan_stream(InputStream &is, TagHandler &handler)
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.Read(is)) { if (!chain.Read(is)) {
FormatDebug(flac_domain, FmtDebug(flac_domain,
"Failed to read FLAC tags: %s", "Failed to read FLAC tags: {}",
chain.GetStatusString()); chain.GetStatusString());
return false; return false;
} }
...@@ -317,8 +317,8 @@ oggflac_scan_file(Path path_fs, TagHandler &handler) ...@@ -317,8 +317,8 @@ oggflac_scan_file(Path path_fs, TagHandler &handler)
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.ReadOgg(NarrowPath(path_fs))) { if (!chain.ReadOgg(NarrowPath(path_fs))) {
FormatDebug(flac_domain, FmtDebug(flac_domain,
"Failed to read OggFLAC tags: %s", "Failed to read OggFLAC tags: {}",
chain.GetStatusString()); chain.GetStatusString());
return false; return false;
} }
...@@ -332,8 +332,8 @@ oggflac_scan_stream(InputStream &is, TagHandler &handler) ...@@ -332,8 +332,8 @@ oggflac_scan_stream(InputStream &is, TagHandler &handler)
{ {
FlacMetadataChain chain; FlacMetadataChain chain;
if (!chain.ReadOgg(is)) { if (!chain.ReadOgg(is)) {
FormatDebug(flac_domain, FmtDebug(flac_domain,
"Failed to read OggFLAC tags: %s", "Failed to read OggFLAC tags: {}",
chain.GetStatusString()); chain.GetStatusString());
return false; return false;
} }
......
...@@ -160,7 +160,7 @@ gme_file_decode(DecoderClient &client, Path path_fs) ...@@ -160,7 +160,7 @@ gme_file_decode(DecoderClient &client, Path path_fs)
AtScopeExit(emu) { gme_delete(emu); }; AtScopeExit(emu) { gme_delete(emu); };
FormatDebug(gme_domain, "emulator type '%s'\n", FmtDebug(gme_domain, "emulator type '{}'",
gme_type_system(gme_type(emu))); gme_type_system(gme_type(emu)));
#if GME_VERSION >= 0x000600 #if GME_VERSION >= 0x000600
......
...@@ -382,8 +382,8 @@ RecoverFrameError(const struct mad_stream &stream) noexcept ...@@ -382,8 +382,8 @@ RecoverFrameError(const struct mad_stream &stream) noexcept
if (MAD_RECOVERABLE(stream.error)) if (MAD_RECOVERABLE(stream.error))
return MadDecoderAction::SKIP; return MadDecoderAction::SKIP;
FormatWarning(mad_domain, FmtWarning(mad_domain,
"unrecoverable frame level error: %s", "unrecoverable frame level error: {}",
mad_stream_errorstr(&stream)); mad_stream_errorstr(&stream));
return MadDecoderAction::BREAK; return MadDecoderAction::BREAK;
} }
...@@ -571,7 +571,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept ...@@ -571,7 +571,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
&lame->version.major, &lame->version.minor) != 2) &lame->version.major, &lame->version.minor) != 2)
return false; return false;
FormatDebug(mad_domain, "detected LAME version %i.%i (\"%s\")", FmtDebug(mad_domain, "detected LAME version {}.{} (\"{}\")",
lame->version.major, lame->version.minor, lame->encoder); lame->version.major, lame->version.minor, lame->encoder);
/* The reference volume was changed from the 83dB used in the /* The reference volume was changed from the 83dB used in the
...@@ -589,7 +589,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept ...@@ -589,7 +589,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
mad_bit_skip(ptr, 16); mad_bit_skip(ptr, 16);
lame->peak = MAD_F(mad_bit_read(ptr, 32) << 5); /* peak */ lame->peak = MAD_F(mad_bit_read(ptr, 32) << 5); /* peak */
FormatDebug(mad_domain, "LAME peak found: %f", double(lame->peak)); FmtDebug(mad_domain, "LAME peak found: {}", lame->peak);
lame->track_gain = 0; lame->track_gain = 0;
unsigned name = mad_bit_read(ptr, 3); /* gain name */ unsigned name = mad_bit_read(ptr, 3); /* gain name */
...@@ -598,8 +598,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept ...@@ -598,8 +598,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
int gain = mad_bit_read(ptr, 9); /* gain*10 */ int gain = mad_bit_read(ptr, 9); /* gain*10 */
if (gain && name == 1 && orig != 0) { if (gain && name == 1 && orig != 0) {
lame->track_gain = ((sign ? -gain : gain) / 10.0f) + adj; lame->track_gain = ((sign ? -gain : gain) / 10.0f) + adj;
FormatDebug(mad_domain, "LAME track gain found: %f", FmtDebug(mad_domain, "LAME track gain found: {}",
double(lame->track_gain)); lame->track_gain);
} }
/* tmz reports that this isn't currently written by any version of lame /* tmz reports that this isn't currently written by any version of lame
...@@ -614,8 +614,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept ...@@ -614,8 +614,8 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
gain = mad_bit_read(ptr, 9); /* gain*10 */ gain = mad_bit_read(ptr, 9); /* gain*10 */
if (gain && name == 2 && orig != 0) { if (gain && name == 2 && orig != 0) {
lame->album_gain = ((sign ? -gain : gain) / 10.0) + adj; lame->album_gain = ((sign ? -gain : gain) / 10.0) + adj;
FormatDebug(mad_domain, "LAME album gain found: %f", FmtDebug(mad_domain, "LAME album gain found: {}",
double(lame->track_gain)); lame->track_gain);
} }
#else #else
mad_bit_skip(ptr, 16); mad_bit_skip(ptr, 16);
...@@ -626,7 +626,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept ...@@ -626,7 +626,7 @@ parse_lame(struct lame *lame, struct mad_bitptr *ptr, int *bitlen) noexcept
lame->encoder_delay = mad_bit_read(ptr, 12); lame->encoder_delay = mad_bit_read(ptr, 12);
lame->encoder_padding = mad_bit_read(ptr, 12); lame->encoder_padding = mad_bit_read(ptr, 12);
FormatDebug(mad_domain, "encoder delay is %i, encoder padding is %i", FmtDebug(mad_domain, "encoder delay is {}, encoder padding is {}",
lame->encoder_delay, lame->encoder_padding); lame->encoder_delay, lame->encoder_padding);
mad_bit_skip(ptr, 80); mad_bit_skip(ptr, 80);
...@@ -763,8 +763,8 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept ...@@ -763,8 +763,8 @@ MadDecoder::DecodeFirstFrame(Tag *tag) noexcept
return false; return false;
if (max_frames > 8 * 1024 * 1024) { if (max_frames > 8 * 1024 * 1024) {
FormatWarning(mad_domain, FmtWarning(mad_domain,
"mp3 file header indicates too many frames: %zu", "mp3 file header indicates too many frames: {}",
max_frames); max_frames);
return false; return false;
} }
......
...@@ -101,8 +101,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -101,8 +101,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
char *endptr; char *endptr;
unsigned value = ParseUnsigned(s, &endptr); unsigned value = ParseUnsigned(s, &endptr);
if (endptr == s || *endptr != 0) { if (endptr == s || *endptr != 0) {
FormatWarning(pcm_decoder_domain, FmtWarning(pcm_decoder_domain,
"Failed to parse sample rate: %s", "Failed to parse sample rate: {}",
s); s);
return; return;
} }
...@@ -123,8 +123,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -123,8 +123,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
char *endptr; char *endptr;
unsigned value = ParseUnsigned(s, &endptr); unsigned value = ParseUnsigned(s, &endptr);
if (endptr == s || *endptr != 0) { if (endptr == s || *endptr != 0) {
FormatWarning(pcm_decoder_domain, FmtWarning(pcm_decoder_domain,
"Failed to parse sample rate: %s", "Failed to parse sample rate: {}",
s); s);
return; return;
} }
...@@ -146,8 +146,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -146,8 +146,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
const char *s = i->second.c_str(); const char *s = i->second.c_str();
audio_format = ParseAudioFormat(s, false); audio_format = ParseAudioFormat(s, false);
if (!audio_format.IsFullyDefined()) { if (!audio_format.IsFullyDefined()) {
FormatWarning(pcm_decoder_domain, FmtWarning(pcm_decoder_domain,
"Invalid audio format specification: %s", "Invalid audio format specification: {}",
mime); mime);
return; return;
} }
...@@ -157,8 +157,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is) ...@@ -157,8 +157,8 @@ pcm_stream_decode(DecoderClient &client, InputStream &is)
} }
if (audio_format.sample_rate == 0) { if (audio_format.sample_rate == 0) {
FormatWarning(pcm_decoder_domain, FmtWarning(pcm_decoder_domain,
"Missing 'rate' parameter: %s", "Missing 'rate' parameter: {}",
mime); mime);
return; return;
} }
......
...@@ -254,8 +254,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -254,8 +254,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
#else #else
const char *error = tune.getInfo().statusString; const char *error = tune.getInfo().statusString;
#endif #endif
FormatWarning(sidplay_domain, "failed to load file: %s", FmtWarning(sidplay_domain, "failed to load file: {}", error);
error);
return; return;
} }
...@@ -283,8 +282,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -283,8 +282,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
bool error = player.load(&tune) < 0; bool error = player.load(&tune) < 0;
#endif #endif
if (error) { if (error) {
FormatWarning(sidplay_domain, FmtWarning(sidplay_domain,
"sidplay2.load() failed: %s", player.error()); "sidplay2.load() failed: {}", player.error());
return; return;
} }
...@@ -293,16 +292,16 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -293,16 +292,16 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
#ifdef HAVE_SIDPLAYFP #ifdef HAVE_SIDPLAYFP
ReSIDfpBuilder builder("ReSID"); ReSIDfpBuilder builder("ReSID");
if (!builder.getStatus()) { if (!builder.getStatus()) {
FormatWarning(sidplay_domain, FmtWarning(sidplay_domain,
"failed to initialize ReSIDfpBuilder: %s", "failed to initialize ReSIDfpBuilder: {}",
builder.error()); builder.error());
return; return;
} }
builder.create(player.info().maxsids()); builder.create(player.info().maxsids());
if (!builder.getStatus()) { if (!builder.getStatus()) {
FormatWarning(sidplay_domain, FmtWarning(sidplay_domain,
"ReSIDfpBuilder.create() failed: %s", "ReSIDfpBuilder.create() failed: {}",
builder.error()); builder.error());
return; return;
} }
...@@ -310,7 +309,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -310,7 +309,7 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
ReSIDBuilder builder("ReSID"); ReSIDBuilder builder("ReSID");
builder.create(player.info().maxsids); builder.create(player.info().maxsids);
if (!builder) { if (!builder) {
FormatWarning(sidplay_domain, "ReSIDBuilder.create() failed: %s", FmtWarning(sidplay_domain, "ReSIDBuilder.create() failed: {}",
builder.error()); builder.error());
return; return;
} }
...@@ -319,14 +318,14 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -319,14 +318,14 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
builder.filter(sidplay_global->filter_setting); builder.filter(sidplay_global->filter_setting);
#ifdef HAVE_SIDPLAYFP #ifdef HAVE_SIDPLAYFP
if (!builder.getStatus()) { if (!builder.getStatus()) {
FormatWarning(sidplay_domain, FmtWarning(sidplay_domain,
"ReSIDfpBuilder.filter() failed: %s", "ReSIDfpBuilder.filter() failed: {}",
builder.error()); builder.error());
return; return;
} }
#else #else
if (!builder) { if (!builder) {
FormatWarning(sidplay_domain, "ReSIDBuilder.filter() failed: %s", FmtWarning(sidplay_domain, "ReSIDBuilder.filter() failed: {}",
builder.error()); builder.error());
return; return;
} }
...@@ -388,8 +387,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs) ...@@ -388,8 +387,8 @@ sidplay_file_decode(DecoderClient &client, Path path_fs)
error = player.config(config) < 0; error = player.config(config) < 0;
#endif #endif
if (error) { if (error) {
FormatWarning(sidplay_domain, FmtWarning(sidplay_domain,
"sidplay2.config() failed: %s", player.error()); "sidplay2.config() failed: {}", player.error());
return; return;
} }
......
...@@ -203,7 +203,7 @@ sndfile_stream_decode(DecoderClient &client, InputStream &is) ...@@ -203,7 +203,7 @@ sndfile_stream_decode(DecoderClient &client, InputStream &is)
SNDFILE *const sf = sf_open_virtual(const_cast<SF_VIRTUAL_IO *>(&vio), SNDFILE *const sf = sf_open_virtual(const_cast<SF_VIRTUAL_IO *>(&vio),
SFM_READ, &info, &sis); SFM_READ, &info, &sis);
if (sf == nullptr) { if (sf == nullptr) {
FormatWarning(sndfile_domain, "sf_open_virtual() failed: %s", FmtWarning(sndfile_domain, "sf_open_virtual() failed: {}",
sf_strerror(nullptr)); sf_strerror(nullptr));
return; return;
} }
...@@ -281,8 +281,8 @@ sndfile_scan_stream(InputStream &is, TagHandler &handler) ...@@ -281,8 +281,8 @@ sndfile_scan_stream(InputStream &is, TagHandler &handler)
AtScopeExit(sf) { sf_close(sf); }; AtScopeExit(sf) { sf_close(sf); };
if (!audio_valid_sample_rate(info.samplerate)) { if (!audio_valid_sample_rate(info.samplerate)) {
FormatWarning(sndfile_domain, FmtWarning(sndfile_domain,
"Invalid sample rate in %s", is.GetURI()); "Invalid sample rate in {}", is.GetURI());
return false; return false;
} }
......
...@@ -124,8 +124,8 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block) ...@@ -124,8 +124,8 @@ PreparedTwolameEncoder::PreparedTwolameEncoder(const ConfigBlock &block)
static PreparedEncoder * static PreparedEncoder *
twolame_encoder_init(const ConfigBlock &block) twolame_encoder_init(const ConfigBlock &block)
{ {
FormatDebug(twolame_encoder_domain, FmtDebug(twolame_encoder_domain,
"libtwolame version %s", get_twolame_version()); "libtwolame version {}", get_twolame_version());
return new PreparedTwolameEncoder(block); return new PreparedTwolameEncoder(block);
} }
......
...@@ -53,6 +53,7 @@ encoder_plugins = static_library( ...@@ -53,6 +53,7 @@ encoder_plugins = static_library(
liblame_dep, liblame_dep,
libtwolame_dep, libtwolame_dep,
libshine_dep, libshine_dep,
log_dep,
], ],
) )
......
...@@ -94,8 +94,8 @@ public: ...@@ -94,8 +94,8 @@ public:
/* no change */ /* no change */
return; return;
FormatDebug(replay_gain_domain, FmtDebug(replay_gain_domain,
"replay gain mode has changed %s->%s\n", "replay gain mode has changed {}->{}",
ToString(mode), ToString(_mode)); ToString(mode), ToString(_mode));
mode = _mode; mode = _mode;
...@@ -155,8 +155,7 @@ ReplayGainFilter::Update() ...@@ -155,8 +155,7 @@ ReplayGainFilter::Update()
if (mode != ReplayGainMode::OFF) { if (mode != ReplayGainMode::OFF) {
const auto &tuple = info.Get(mode); const auto &tuple = info.Get(mode);
float scale = tuple.CalculateScale(config); float scale = tuple.CalculateScale(config);
FormatDebug(replay_gain_domain, FmtDebug(replay_gain_domain, "scale={}\n", scale);
"scale=%f\n", (double)scale);
volume = pcm_float_to_volume(scale); volume = pcm_float_to_volume(scale);
} }
......
...@@ -26,6 +26,7 @@ filter_plugins = static_library( ...@@ -26,6 +26,7 @@ filter_plugins = static_library(
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
filter_plugins_deps, filter_plugins_deps,
log_dep,
], ],
) )
......
...@@ -270,15 +270,15 @@ AlsaInputStream::Recover(int err) ...@@ -270,15 +270,15 @@ AlsaInputStream::Recover(int err)
{ {
switch(err) { switch(err) {
case -EPIPE: case -EPIPE:
FormatDebug(alsa_input_domain, FmtDebug(alsa_input_domain,
"Overrun on ALSA capture device \"%s\"", "Overrun on ALSA capture device \"{}\"",
device.c_str()); device);
break; break;
case -ESTRPIPE: case -ESTRPIPE:
FormatDebug(alsa_input_domain, FmtDebug(alsa_input_domain,
"ALSA capture device \"%s\" was suspended", "ALSA capture device \"{}\" was suspended",
device.c_str()); device);
break; break;
} }
...@@ -361,8 +361,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format) ...@@ -361,8 +361,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format)
unsigned buffer_time_min, buffer_time_max; unsigned buffer_time_min, buffer_time_max;
snd_pcm_hw_params_get_buffer_time_min(hw_params, &buffer_time_min, nullptr); snd_pcm_hw_params_get_buffer_time_min(hw_params, &buffer_time_min, nullptr);
snd_pcm_hw_params_get_buffer_time_max(hw_params, &buffer_time_max, nullptr); snd_pcm_hw_params_get_buffer_time_max(hw_params, &buffer_time_max, nullptr);
FormatDebug(alsa_input_domain, "buffer: size=%u..%u time=%u..%u", FmtDebug(alsa_input_domain, "buffer: size={}..{} time={}..{}",
(unsigned)buffer_size_min, (unsigned)buffer_size_max, buffer_size_min, buffer_size_max,
buffer_time_min, buffer_time_max); buffer_time_min, buffer_time_max);
snd_pcm_uframes_t period_size_min, period_size_max; snd_pcm_uframes_t period_size_min, period_size_max;
...@@ -371,8 +371,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format) ...@@ -371,8 +371,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format)
unsigned period_time_min, period_time_max; unsigned period_time_min, period_time_max;
snd_pcm_hw_params_get_period_time_min(hw_params, &period_time_min, nullptr); snd_pcm_hw_params_get_period_time_min(hw_params, &period_time_min, nullptr);
snd_pcm_hw_params_get_period_time_max(hw_params, &period_time_max, nullptr); snd_pcm_hw_params_get_period_time_max(hw_params, &period_time_max, nullptr);
FormatDebug(alsa_input_domain, "period: size=%u..%u time=%u..%u", FmtDebug(alsa_input_domain, "period: size={}..{} time={}..{}",
(unsigned)period_size_min, (unsigned)period_size_max, period_size_min, period_size_max,
period_time_min, period_time_max); period_time_min, period_time_max);
/* choose the maximum possible buffer_size ... */ /* choose the maximum possible buffer_size ... */
...@@ -409,8 +409,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format) ...@@ -409,8 +409,8 @@ AlsaInputStream::ConfigureCapture(AudioFormat audio_format)
throw FormatRuntimeError("snd_pcm_hw_params_get_period_size() failed: %s", throw FormatRuntimeError("snd_pcm_hw_params_get_period_size() failed: %s",
snd_strerror(-err)); snd_strerror(-err));
FormatDebug(alsa_input_domain, "buffer_size=%u period_size=%u", FmtDebug(alsa_input_domain, "buffer_size={} period_size={}",
(unsigned)alsa_buffer_size, (unsigned)alsa_period_size); alsa_buffer_size, alsa_period_size);
snd_pcm_sw_params_t *sw_params; snd_pcm_sw_params_t *sw_params;
snd_pcm_sw_params_alloca(&sw_params); snd_pcm_sw_params_alloca(&sw_params);
......
...@@ -281,10 +281,7 @@ CurlInputStream::OnHeaders(unsigned status, ...@@ -281,10 +281,7 @@ CurlInputStream::OnHeaders(unsigned status,
if (i != headers.end()) { if (i != headers.end()) {
size_t icy_metaint = ParseUint64(i->second.c_str()); size_t icy_metaint = ParseUint64(i->second.c_str());
#ifndef _WIN32 FmtDebug(curl_domain, "icy-metaint={}", icy_metaint);
/* Windows doesn't know "%z" */
FormatDebug(curl_domain, "icy-metaint=%zu", icy_metaint);
#endif
if (icy_metaint > 0) { if (icy_metaint > 0) {
icy->Start(icy_metaint); icy->Start(icy_metaint);
...@@ -358,9 +355,9 @@ input_curl_init(EventLoop &event_loop, const ConfigBlock &block) ...@@ -358,9 +355,9 @@ input_curl_init(EventLoop &event_loop, const ConfigBlock &block)
const auto version_info = curl_version_info(CURLVERSION_FIRST); const auto version_info = curl_version_info(CURLVERSION_FIRST);
if (version_info != nullptr) { if (version_info != nullptr) {
FormatDebug(curl_domain, "version %s", version_info->version); FmtDebug(curl_domain, "version {}", version_info->version);
if (version_info->features & CURL_VERSION_SSL) if (version_info->features & CURL_VERSION_SSL)
FormatDebug(curl_domain, "with %s", FmtDebug(curl_domain, "with {}",
version_info->ssl_version); version_info->ssl_version);
} }
......
...@@ -183,7 +183,8 @@ InitTidalInput(EventLoop &event_loop, const ConfigBlock &block) ...@@ -183,7 +183,8 @@ InitTidalInput(EventLoop &event_loop, const ConfigBlock &block)
if (password == nullptr) if (password == nullptr)
throw PluginUnconfigured("No Tidal password configured"); throw PluginUnconfigured("No Tidal password configured");
FormatWarning(tidal_domain, "The Tidal input plugin is deprecated because Tidal has changed the protocol and doesn't share documentation"); LogWarning(tidal_domain,
"The Tidal input plugin is deprecated because Tidal has changed the protocol and doesn't share documentation");
tidal_audioquality = block.GetBlockValue("audioquality", "HIGH"); tidal_audioquality = block.GetBlockValue("audioquality", "HIGH");
......
...@@ -81,7 +81,7 @@ TidalSessionManager::AddLoginHandler(TidalSessionHandler &h) noexcept ...@@ -81,7 +81,7 @@ TidalSessionManager::AddLoginHandler(TidalSessionHandler &h) noexcept
void void
TidalSessionManager::OnTidalLoginSuccess(std::string _session) noexcept TidalSessionManager::OnTidalLoginSuccess(std::string _session) noexcept
{ {
FormatDebug(tidal_domain, "Login successful, session=%s", _session.c_str()); FmtDebug(tidal_domain, "Login successful, session={}", _session);
{ {
const std::lock_guard<Mutex> protect(mutex); const std::lock_guard<Mutex> protect(mutex);
......
...@@ -235,8 +235,8 @@ SetupHw(snd_pcm_t *pcm, ...@@ -235,8 +235,8 @@ SetupHw(snd_pcm_t *pcm,
unsigned buffer_time_min, buffer_time_max; unsigned buffer_time_min, buffer_time_max;
snd_pcm_hw_params_get_buffer_time_min(hwparams, &buffer_time_min, nullptr); snd_pcm_hw_params_get_buffer_time_min(hwparams, &buffer_time_min, nullptr);
snd_pcm_hw_params_get_buffer_time_max(hwparams, &buffer_time_max, nullptr); snd_pcm_hw_params_get_buffer_time_max(hwparams, &buffer_time_max, nullptr);
FormatDebug(alsa_output_domain, "buffer: size=%u..%u time=%u..%u", FmtDebug(alsa_output_domain, "buffer: size={}..{} time={}..{}",
(unsigned)buffer_size_min, (unsigned)buffer_size_max, buffer_size_min, buffer_size_max,
buffer_time_min, buffer_time_max); buffer_time_min, buffer_time_max);
snd_pcm_uframes_t period_size_min, period_size_max; snd_pcm_uframes_t period_size_min, period_size_max;
...@@ -245,8 +245,8 @@ SetupHw(snd_pcm_t *pcm, ...@@ -245,8 +245,8 @@ SetupHw(snd_pcm_t *pcm,
unsigned period_time_min, period_time_max; unsigned period_time_min, period_time_max;
snd_pcm_hw_params_get_period_time_min(hwparams, &period_time_min, nullptr); snd_pcm_hw_params_get_period_time_min(hwparams, &period_time_min, nullptr);
snd_pcm_hw_params_get_period_time_max(hwparams, &period_time_max, nullptr); snd_pcm_hw_params_get_period_time_max(hwparams, &period_time_max, nullptr);
FormatDebug(alsa_output_domain, "period: size=%u..%u time=%u..%u", FmtDebug(alsa_output_domain, "period: size={}..{} time={}..{}",
(unsigned)period_size_min, (unsigned)period_size_max, period_size_min, period_size_max,
period_time_min, period_time_max); period_time_min, period_time_max);
if (buffer_time > 0) { if (buffer_time > 0) {
...@@ -265,8 +265,8 @@ SetupHw(snd_pcm_t *pcm, ...@@ -265,8 +265,8 @@ SetupHw(snd_pcm_t *pcm,
if (period_time_ro == 0 && buffer_time >= 10000) { if (period_time_ro == 0 && buffer_time >= 10000) {
period_time_ro = period_time = buffer_time / 4; period_time_ro = period_time = buffer_time / 4;
FormatDebug(alsa_output_domain, FmtDebug(alsa_output_domain,
"default period_time = buffer_time/4 = %u/4 = %u", "default period_time = buffer_time/4 = {}/4 = {}",
buffer_time, period_time); buffer_time, period_time);
} }
......
...@@ -20,6 +20,7 @@ alsa = static_library( ...@@ -20,6 +20,7 @@ alsa = static_library(
include_directories: inc, include_directories: inc,
dependencies: [ dependencies: [
libasound_dep, libasound_dep,
log_dep,
], ],
) )
......
...@@ -153,9 +153,9 @@ OssMixer::GetVolume() ...@@ -153,9 +153,9 @@ OssMixer::GetVolume()
right = (level & 0xff00) >> 8; right = (level & 0xff00) >> 8;
if (left != right) { if (left != right) {
FormatWarning(oss_mixer_domain, FmtWarning(oss_mixer_domain,
"volume for left and right is not the same, \"%i\" and " "volume for left and right is not the same, \"{}\" and "
"\"%i\"\n", left, right); "\"{}\"\n", left, right);
} }
return left; return left;
......
...@@ -70,8 +70,8 @@ audio_output_state_read(const char *line, MultipleOutputs &outputs) ...@@ -70,8 +70,8 @@ audio_output_state_read(const char *line, MultipleOutputs &outputs)
name = endptr + 1; name = endptr + 1;
auto *ao = outputs.FindByName(name); auto *ao = outputs.FindByName(name);
if (ao == nullptr) { if (ao == nullptr) {
FormatDebug(output_domain, FmtDebug(output_domain,
"Ignoring device state for '%s'", name); "Ignoring device state for '{}'", name);
return true; return true;
} }
......
...@@ -123,7 +123,7 @@ AoOutput::AoOutput(const ConfigBlock &block) ...@@ -123,7 +123,7 @@ AoOutput::AoOutput(const ConfigBlock &block)
if (ai == nullptr) if (ai == nullptr)
throw std::runtime_error("problems getting driver info"); throw std::runtime_error("problems getting driver info");
FormatDebug(ao_output_domain, "using ao driver \"%s\" for \"%s\"\n", FmtDebug(ao_output_domain, "using ao driver \"{}\" for \"{}\"\n",
ai->short_name, block.GetBlockValue("name", nullptr)); ai->short_name, block.GetBlockValue("name", nullptr));
value = block.GetBlockValue("options", nullptr); value = block.GetBlockValue("options", nullptr);
......
...@@ -90,8 +90,8 @@ FifoOutput::FifoOutput(const ConfigBlock &block) ...@@ -90,8 +90,8 @@ FifoOutput::FifoOutput(const ConfigBlock &block)
inline void inline void
FifoOutput::Delete() FifoOutput::Delete()
{ {
FormatDebug(fifo_output_domain, FmtDebug(fifo_output_domain,
"Removing FIFO \"%s\"", path_utf8.c_str()); "Removing FIFO \"{}\"", path_utf8);
try { try {
RemoveFile(path); RemoveFile(path);
......
...@@ -96,7 +96,7 @@ initialize_application() ...@@ -96,7 +96,7 @@ initialize_application()
// TODO: actually Run() it and handle B_QUIT_REQUESTED // TODO: actually Run() it and handle B_QUIT_REQUESTED
// TODO: use some locking? // TODO: use some locking?
if (be_app == NULL) { if (be_app == NULL) {
FormatDebug(haiku_output_domain, "creating be_app\n"); LogDebug(haiku_output_domain, "creating be_app");
new BApplication("application/x-vnd.MusicPD"); new BApplication("application/x-vnd.MusicPD");
} }
} }
...@@ -107,7 +107,7 @@ finalize_application() ...@@ -107,7 +107,7 @@ finalize_application()
// TODO: use some locking? // TODO: use some locking?
delete be_app; delete be_app;
be_app = NULL; be_app = NULL;
FormatDebug(haiku_output_domain, "deleting be_app\n"); LogDebug(haiku_output_domain, "deleting be_app");
} }
static bool static bool
...@@ -165,17 +165,16 @@ HaikuOutput::FillBuffer(void* _buffer, size_t size, ...@@ -165,17 +165,16 @@ HaikuOutput::FillBuffer(void* _buffer, size_t size,
bigtime_t w = system_time() - start; bigtime_t w = system_time() - start;
if (w > 5000LL) { if (w > 5000LL) {
FormatDebug(haiku_output_domain, FmtDebug(haiku_output_domain,
"haiku:fill_buffer waited %Ldus\n", w); "haiku:fill_buffer waited {}us", w);
} }
if (buffer_filled < buffer_size) { if (buffer_filled < buffer_size) {
memset(buffer + buffer_filled, 0, memset(buffer + buffer_filled, 0,
buffer_size - buffer_filled); buffer_size - buffer_filled);
FormatDebug(haiku_output_domain, FmtDebug(haiku_output_domain,
"haiku:fill_buffer filled %d size %d clearing remainder\n", "haiku:fill_buffer filled {} size {} clearing remainder",
(int)buffer_filled, (int)buffer_size); buffer_filled, buffer_size);
} }
} }
...@@ -222,12 +221,12 @@ HaikuOutput::Open(AudioFormat &audio_format) ...@@ -222,12 +221,12 @@ HaikuOutput::Open(AudioFormat &audio_format)
format.channel_count, format.format, format.channel_count, format.format,
format.frame_rate, B_UNKNOWN_BUS) * 2; format.frame_rate, B_UNKNOWN_BUS) * 2;
FormatDebug(haiku_output_domain, FmtDebug(haiku_output_domain,
"using haiku driver ad: bs: %d ws: %d " "using haiku driver ad: bs: {} ws: {} "
"channels %d rate %f fmt %08lx bs %d\n", "channels {} rate {} fmt {:08x} bs {}",
(int)buffer_size, (int)write_size, buffer_size, write_size,
(int)format.channel_count, format.frame_rate, format.channel_count, format.frame_rate,
format.format, (int)format.buffer_size); format.format, format.buffer_size);
sound_player = new BSoundPlayer(&format, "MPD Output", sound_player = new BSoundPlayer(&format, "MPD Output",
HaikuOutput::_FillBuffer, NULL, this); HaikuOutput::_FillBuffer, NULL, this);
...@@ -247,8 +246,7 @@ HaikuOutput::Open(AudioFormat &audio_format) ...@@ -247,8 +246,7 @@ HaikuOutput::Open(AudioFormat &audio_format)
buffer_delay *= 1000 / format.frame_rate; buffer_delay *= 1000 / format.frame_rate;
// half of the total buffer play time // half of the total buffer play time
buffer_delay /= 2; buffer_delay /= 2;
FormatDebug(haiku_output_domain, FmtDebug(haiku_output_domain, "buffer delay: {} ms", buffer_delay);
"buffer delay: %d ms\n", buffer_delay);
new_buffer = create_sem(0, "New buffer request"); new_buffer = create_sem(0, "New buffer request");
buffer_done = create_sem(0, "Buffer done"); buffer_done = create_sem(0, "Buffer done");
...@@ -303,8 +301,8 @@ HaikuOutput::Delay() const noexcept ...@@ -303,8 +301,8 @@ HaikuOutput::Delay() const noexcept
{ {
unsigned delay = buffer_filled ? 0 : buffer_delay; unsigned delay = buffer_filled ? 0 : buffer_delay;
//FormatDebug(haiku_output_domain, //FmtDebug(haiku_output_domain,
// "delay=%d\n", delay / 2); // "delay={}", delay / 2);
// XXX: doesn't work // XXX: doesn't work
//return (delay / 2) ? 1 : 0; //return (delay / 2) ? 1 : 0;
(void)delay; (void)delay;
...@@ -393,8 +391,9 @@ HaikuOutput::SendTag(const Tag &tag) ...@@ -393,8 +391,9 @@ HaikuOutput::SendTag(const Tag &tag)
case TAG_MUSICBRAINZ_ALBUMARTISTID: case TAG_MUSICBRAINZ_ALBUMARTISTID:
case TAG_MUSICBRAINZ_TRACKID: case TAG_MUSICBRAINZ_TRACKID:
default: default:
FormatDebug(haiku_output_domain, FmtDebug(haiku_output_domain,
"tag item: type %d value '%s'\n", item.type, item.value); "tag item: type {} value '{}'\n",
item.type, item.value);
break; break;
} }
} }
......
...@@ -242,8 +242,8 @@ JackOutput::JackOutput(const ConfigBlock &block) ...@@ -242,8 +242,8 @@ JackOutput::JackOutput(const ConfigBlock &block)
/* compatibility with MPD < 0.16 */ /* compatibility with MPD < 0.16 */
value = block.GetBlockValue("ports", nullptr); value = block.GetBlockValue("ports", nullptr);
if (value != nullptr) if (value != nullptr)
FormatWarning(jack_output_domain, FmtWarning(jack_output_domain,
"deprecated option 'ports' in line %d", "deprecated option 'ports' in line {}",
block.line); block.line);
} }
...@@ -258,9 +258,9 @@ JackOutput::JackOutput(const ConfigBlock &block) ...@@ -258,9 +258,9 @@ JackOutput::JackOutput(const ConfigBlock &block)
if (num_destination_ports > 0 && if (num_destination_ports > 0 &&
num_destination_ports != num_source_ports) num_destination_ports != num_source_ports)
FormatWarning(jack_output_domain, FmtWarning(jack_output_domain,
"number of source ports (%u) mismatches the " "number of source ports ({}) mismatches the "
"number of destination ports (%u) in line %d", "number of destination ports ({}) in line {}",
num_source_ports, num_destination_ports, num_source_ports, num_destination_ports,
block.line); block.line);
...@@ -543,10 +543,9 @@ JackOutput::Start() ...@@ -543,10 +543,9 @@ JackOutput::Start()
for (num_dports = 0; num_dports < MAX_PORTS && for (num_dports = 0; num_dports < MAX_PORTS &&
jports[num_dports] != nullptr; jports[num_dports] != nullptr;
++num_dports) { ++num_dports) {
FormatDebug(jack_output_domain, FmtDebug(jack_output_domain,
"destination_port[%u] = '%s'\n", "destination_port[{}] = '{}'\n",
num_dports, num_dports, jports[num_dports]);
jports[num_dports]);
dports[num_dports] = jports[num_dports]; dports[num_dports] = jports[num_dports];
} }
} else { } else {
......
...@@ -258,9 +258,10 @@ osx_output_parse_channel_map(const char *device_name, ...@@ -258,9 +258,10 @@ osx_output_parse_channel_map(const char *device_name,
channel_map_str = endptr; channel_map_str = endptr;
want_number = false; want_number = false;
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"%s: channel_map[%u] = %d", "{}: channel_map[{}] = {}",
device_name, inserted_channels, channel_map[inserted_channels]); device_name, inserted_channels,
channel_map[inserted_channels]);
++inserted_channels; ++inserted_channels;
continue; continue;
} }
...@@ -421,10 +422,10 @@ osx_output_set_device_format(AudioDeviceID dev_id, ...@@ -421,10 +422,10 @@ osx_output_set_device_format(AudioDeviceID dev_id,
// print all (linear pcm) formats and their rating // print all (linear pcm) formats and their rating
if (score > 0.0f) if (score > 0.0f)
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"Format: %s rated %f", "Format: {} rated {}",
StreamDescriptionToString(format_desc).c_str(), StreamDescriptionToString(format_desc).c_str(),
(double)score); score);
if (score > output_score) { if (score > output_score) {
output_score = score; output_score = score;
...@@ -498,14 +499,14 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept ...@@ -498,14 +499,14 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept
if (hog) { if (hog) {
if (hog_pid != -1) { if (hog_pid != -1) {
FormatDebug(osx_output_domain, LogDebug(osx_output_domain,
"Device is already hogged."); "Device is already hogged");
return; return;
} }
} else { } else {
if (hog_pid != getpid()) { if (hog_pid != getpid()) {
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"Device is not owned by this process."); "Device is not owned by this process");
return; return;
} }
} }
...@@ -520,9 +521,8 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept ...@@ -520,9 +521,8 @@ osx_output_hog_device(AudioDeviceID dev_id, bool hog) noexcept
size, size,
&hog_pid); &hog_pid);
if (err != noErr) { if (err != noErr) {
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"Cannot hog the device: %d", "Cannot hog the device: {}", err);
err);
} else { } else {
LogDebug(osx_output_domain, LogDebug(osx_output_domain,
hog_pid == -1 hog_pid == -1
...@@ -585,16 +585,16 @@ osx_output_set_device(OSXOutput *oo) ...@@ -585,16 +585,16 @@ osx_output_set_device(OSXOutput *oo)
const auto id = FindAudioDeviceByName(oo->device_name); const auto id = FindAudioDeviceByName(oo->device_name);
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"found matching device: ID=%u, name=%s", "found matching device: ID={}, name={}",
(unsigned)id, oo->device_name); id, oo->device_name);
AudioUnitSetCurrentDevice(oo->au, id); AudioUnitSetCurrentDevice(oo->au, id);
oo->dev_id = id; oo->dev_id = id;
FormatDebug(osx_output_domain, FmtDebug(osx_output_domain,
"set OS X audio output device ID=%u, name=%s", "set OS X audio output device ID={}, name={}",
(unsigned)id, oo->device_name); id, oo->device_name);
if (oo->channel_map) if (oo->channel_map)
osx_output_set_channel_map(oo); osx_output_set_channel_map(oo);
......
...@@ -200,16 +200,16 @@ oss_open_default() ...@@ -200,16 +200,16 @@ oss_open_default()
/* never reached */ /* never reached */
break; break;
case OSS_STAT_DOESN_T_EXIST: case OSS_STAT_DOESN_T_EXIST:
FormatWarning(oss_output_domain, FmtWarning(oss_output_domain,
"%s not found", dev); "{} not found", dev);
break; break;
case OSS_STAT_NOT_CHAR_DEV: case OSS_STAT_NOT_CHAR_DEV:
FormatWarning(oss_output_domain, FmtWarning(oss_output_domain,
"%s is not a character device", dev); "{} is not a character device", dev);
break; break;
case OSS_STAT_NO_PERMS: case OSS_STAT_NO_PERMS:
FormatWarning(oss_output_domain, FmtWarning(oss_output_domain,
"%s: permission denied", dev); "{}: permission denied", dev);
break; break;
case OSS_STAT_OTHER: case OSS_STAT_OTHER:
FormatErrno(oss_output_domain, err[i], FormatErrno(oss_output_domain, err[i],
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "RecorderOutputPlugin.hxx" #include "RecorderOutputPlugin.hxx"
#include "../OutputAPI.hxx" #include "../OutputAPI.hxx"
#include "lib/fmt/PathFormatter.hxx"
#include "tag/Format.hxx" #include "tag/Format.hxx"
#include "encoder/ToOutputStream.hxx" #include "encoder/ToOutputStream.hxx"
#include "encoder/EncoderInterface.hxx" #include "encoder/EncoderInterface.hxx"
...@@ -276,8 +277,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path) ...@@ -276,8 +277,7 @@ RecorderOutput::ReopenFormat(AllocatedPath &&new_path)
path = std::move(new_path); path = std::move(new_path);
file = new_file; file = new_file;
FormatDebug(recorder_domain, "Recording to \"%s\"", FmtDebug(recorder_domain, "Recording to \"{}\"", path);
path.ToUTF8().c_str());
} }
void void
......
...@@ -282,8 +282,8 @@ ShoutOutput::Close() noexcept ...@@ -282,8 +282,8 @@ ShoutOutput::Close() noexcept
if (shout_get_connected(shout_conn) != SHOUTERR_UNCONNECTED && if (shout_get_connected(shout_conn) != SHOUTERR_UNCONNECTED &&
shout_close(shout_conn) != SHOUTERR_SUCCESS) { shout_close(shout_conn) != SHOUTERR_SUCCESS) {
FormatWarning(shout_output_domain, FmtWarning(shout_output_domain,
"problem closing connection to shout server: %s", "problem closing connection to shout server: {}",
shout_get_error(shout_conn)); shout_get_error(shout_conn));
} }
} }
......
...@@ -171,8 +171,8 @@ HttpdClient::SendResponse() noexcept ...@@ -171,8 +171,8 @@ HttpdClient::SendResponse() noexcept
ssize_t nbytes = GetSocket().Write(response, strlen(response)); ssize_t nbytes = GetSocket().Write(response, strlen(response));
if (gcc_unlikely(nbytes < 0)) { if (gcc_unlikely(nbytes < 0)) {
const SocketErrorMessage msg; const SocketErrorMessage msg;
FormatWarning(httpd_output_domain, FmtWarning(httpd_output_domain,
"failed to write to client: %s", "failed to write to client: {}",
(const char *)msg); (const char *)msg);
LockClose(); LockClose();
return false; return false;
...@@ -284,8 +284,8 @@ HttpdClient::TryWrite() noexcept ...@@ -284,8 +284,8 @@ HttpdClient::TryWrite() noexcept
if (!IsSocketErrorClosed(e)) { if (!IsSocketErrorClosed(e)) {
SocketErrorMessage msg(e); SocketErrorMessage msg(e);
FormatWarning(httpd_output_domain, FmtWarning(httpd_output_domain,
"failed to write to client: %s", "failed to write to client: {}",
(const char *)msg); (const char *)msg);
} }
...@@ -311,8 +311,8 @@ HttpdClient::TryWrite() noexcept ...@@ -311,8 +311,8 @@ HttpdClient::TryWrite() noexcept
if (!IsSocketErrorClosed(e)) { if (!IsSocketErrorClosed(e)) {
SocketErrorMessage msg(e); SocketErrorMessage msg(e);
FormatWarning(httpd_output_domain, FmtWarning(httpd_output_domain,
"failed to write to client: %s", "failed to write to client: {}",
(const char *)msg); (const char *)msg);
} }
...@@ -334,8 +334,8 @@ HttpdClient::TryWrite() noexcept ...@@ -334,8 +334,8 @@ HttpdClient::TryWrite() noexcept
if (!IsSocketErrorClosed(e)) { if (!IsSocketErrorClosed(e)) {
SocketErrorMessage msg(e); SocketErrorMessage msg(e);
FormatWarning(httpd_output_domain, FmtWarning(httpd_output_domain,
"failed to write to client: %s", "failed to write to client: {}",
(const char *)msg); (const char *)msg);
} }
...@@ -370,7 +370,7 @@ HttpdClient::PushPage(PagePtr page) noexcept ...@@ -370,7 +370,7 @@ HttpdClient::PushPage(PagePtr page) noexcept
return; return;
if (queue_size > 256 * 1024) { if (queue_size > 256 * 1024) {
FormatDebug(httpd_output_domain, LogDebug(httpd_output_domain,
"client is too slow, flushing its queue"); "client is too slow, flushing its queue");
ClearQueue(); ClearQueue();
} }
......
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "PropertyStore.hxx" #include "PropertyStore.hxx"
#include "output/OutputAPI.hxx" #include "output/OutputAPI.hxx"
#include "lib/icu/Win32.hxx" #include "lib/icu/Win32.hxx"
#include "lib/fmt/AudioFormatFormatter.hxx"
#include "mixer/MixerList.hxx" #include "mixer/MixerList.hxx"
#include "output/Error.hxx" #include "output/Error.hxx"
#include "pcm/Export.hxx" #include "pcm/Export.hxx"
...@@ -824,13 +825,12 @@ WasapiOutput::TryFormatExclusive(const AudioFormat &audio_format) ...@@ -824,13 +825,12 @@ WasapiOutput::TryFormatExclusive(const AudioFormat &audio_format)
HRESULT result = client->IsFormatSupported( HRESULT result = client->IsFormatSupported(
AUDCLNT_SHAREMODE_EXCLUSIVE, AUDCLNT_SHAREMODE_EXCLUSIVE,
reinterpret_cast<WAVEFORMATEX *>(&test_format), nullptr); reinterpret_cast<WAVEFORMATEX *>(&test_format), nullptr);
const auto format_string = ToString(audio_format);
const auto result_string = std::string(HRESULTToString(result)); const auto result_string = std::string(HRESULTToString(result));
FormatDebug(wasapi_output_domain, "Trying %s %lu %u-%u (exclusive) -> %s", FmtDebug(wasapi_output_domain, "Trying {} {} {}-{} (exclusive) -> {}",
format_string.c_str(), test_format.Format.nSamplesPerSec, audio_format, test_format.Format.nSamplesPerSec,
test_format.Format.wBitsPerSample, test_format.Format.wBitsPerSample,
test_format.Samples.wValidBitsPerSample, test_format.Samples.wValidBitsPerSample,
result_string.c_str()); result_string);
if (SUCCEEDED(result)) { if (SUCCEEDED(result)) {
device_format = test_format; device_format = test_format;
return true; return true;
...@@ -922,13 +922,12 @@ WasapiOutput::FindSharedFormatSupported(AudioFormat &audio_format) ...@@ -922,13 +922,12 @@ WasapiOutput::FindSharedFormatSupported(AudioFormat &audio_format)
reinterpret_cast<WAVEFORMATEX *>(&device_format), reinterpret_cast<WAVEFORMATEX *>(&device_format),
closest_format.AddressCast<WAVEFORMATEX>()); closest_format.AddressCast<WAVEFORMATEX>());
{ {
const auto format_string = ToString(audio_format);
const auto result_string = std::string(HRESULTToString(result)); const auto result_string = std::string(HRESULTToString(result));
FormatDebug(wasapi_output_domain, "Trying %s %lu %u-%u (shared) -> %s", FmtDebug(wasapi_output_domain, "Trying {} {} {}-{} (shared) -> {}",
format_string.c_str(), device_format.Format.nSamplesPerSec, audio_format, device_format.Format.nSamplesPerSec,
device_format.Format.wBitsPerSample, device_format.Format.wBitsPerSample,
device_format.Samples.wValidBitsPerSample, device_format.Samples.wValidBitsPerSample,
result_string.c_str()); result_string);
} }
if (FAILED(result) && result != AUDCLNT_E_UNSUPPORTED_FORMAT) { if (FAILED(result) && result != AUDCLNT_E_UNSUPPORTED_FORMAT) {
...@@ -950,15 +949,14 @@ WasapiOutput::FindSharedFormatSupported(AudioFormat &audio_format) ...@@ -950,15 +949,14 @@ WasapiOutput::FindSharedFormatSupported(AudioFormat &audio_format)
reinterpret_cast<WAVEFORMATEX *>(&device_format), reinterpret_cast<WAVEFORMATEX *>(&device_format),
closest_format.AddressCast<WAVEFORMATEX>()); closest_format.AddressCast<WAVEFORMATEX>());
{ {
const auto format_string = ToString(audio_format);
const auto result_string = std::string(HRESULTToString(result)); const auto result_string = std::string(HRESULTToString(result));
FormatDebug(wasapi_output_domain, FmtDebug(wasapi_output_domain,
"Trying %s %lu %u-%u (shared) -> %s", "Trying {} {} {}-{} (shared) -> {}",
format_string.c_str(), audio_format,
device_format.Format.nSamplesPerSec, device_format.Format.nSamplesPerSec,
device_format.Format.wBitsPerSample, device_format.Format.wBitsPerSample,
device_format.Samples.wValidBitsPerSample, device_format.Samples.wValidBitsPerSample,
result_string.c_str()); result_string);
} }
if (FAILED(result)) { if (FAILED(result)) {
throw MakeHResultError(result, "Format is not supported"); throw MakeHResultError(result, "Format is not supported");
......
...@@ -71,8 +71,8 @@ pcm_resample_lsr_global_init(const ConfigBlock &block) ...@@ -71,8 +71,8 @@ pcm_resample_lsr_global_init(const ConfigBlock &block)
throw FormatRuntimeError("unknown samplerate converter '%s'", throw FormatRuntimeError("unknown samplerate converter '%s'",
converter); converter);
FormatDebug(libsamplerate_domain, FmtDebug(libsamplerate_domain,
"libsamplerate converter '%s'", "libsamplerate converter '{}'",
src_get_name(lsr_converter)); src_get_name(lsr_converter));
} }
...@@ -98,8 +98,8 @@ LibsampleratePcmResampler::Open(AudioFormat &af, unsigned new_sample_rate) ...@@ -98,8 +98,8 @@ LibsampleratePcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
memset(&data, 0, sizeof(data)); memset(&data, 0, sizeof(data));
data.src_ratio = double(new_sample_rate) / double(af.sample_rate); data.src_ratio = double(new_sample_rate) / double(af.sample_rate);
FormatDebug(libsamplerate_domain, FmtDebug(libsamplerate_domain,
"setting samplerate conversion ratio to %.2lf", "setting samplerate conversion ratio to {:.2}",
data.src_ratio); data.src_ratio);
src_set_ratio(state, data.src_ratio); src_set_ratio(state, data.src_ratio);
......
...@@ -200,8 +200,7 @@ pcm_resample_soxr_global_init(const ConfigBlock &block) ...@@ -200,8 +200,7 @@ pcm_resample_soxr_global_init(const ConfigBlock &block)
soxr_quality = soxr_quality_spec(recipe, 0); soxr_quality = soxr_quality_spec(recipe, 0);
} }
FormatDebug(soxr_domain, FmtDebug(soxr_domain, "soxr converter '{}'",
"soxr converter '%s'",
soxr_quality_name(recipe)); soxr_quality_name(recipe));
const unsigned n_threads = block.GetBlockValue("threads", 1); const unsigned n_threads = block.GetBlockValue("threads", 1);
...@@ -226,7 +225,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate) ...@@ -226,7 +225,7 @@ SoxrPcmResampler::Open(AudioFormat &af, unsigned new_sample_rate)
throw FormatRuntimeError("soxr initialization has failed: %s", throw FormatRuntimeError("soxr initialization has failed: %s",
e); e);
FormatDebug(soxr_domain, "soxr engine '%s'", soxr_engine(soxr)); FmtDebug(soxr_domain, "soxr engine '{}'", soxr_engine(soxr));
if (soxr_use_custom_recipe) if (soxr_use_custom_recipe)
FormatDebug(soxr_domain, FormatDebug(soxr_domain,
"soxr precision=%0.0f, phase_response=%0.2f, " "soxr precision=%0.0f, phase_response=%0.2f, "
......
...@@ -69,6 +69,7 @@ pcm = static_library( ...@@ -69,6 +69,7 @@ pcm = static_library(
pcm_basic_dep, pcm_basic_dep,
libsamplerate_dep, libsamplerate_dep,
soxr_dep, soxr_dep,
log_dep,
], ],
) )
......
...@@ -128,8 +128,8 @@ CrossFadeSettings::Calculate(SignedSongTime total_time, ...@@ -128,8 +128,8 @@ CrossFadeSettings::Calculate(SignedSongTime total_time,
mixramp_delay <= mixramp_overlap) { mixramp_delay <= mixramp_overlap) {
chunks = lround((mixramp_overlap - mixramp_delay) chunks = lround((mixramp_overlap - mixramp_delay)
/ chunk_duration); / chunk_duration);
FormatDebug(cross_fade_domain, FmtDebug(cross_fade_domain,
"will overlap %d chunks, %fs", chunks, "will overlap {} chunks, {}s", chunks,
(mixramp_overlap - mixramp_delay).count()); (mixramp_overlap - mixramp_delay).count());
} }
} }
......
...@@ -71,7 +71,7 @@ playlist::QueueSongOrder(PlayerControl &pc, unsigned order) noexcept ...@@ -71,7 +71,7 @@ playlist::QueueSongOrder(PlayerControl &pc, unsigned order) noexcept
const DetachedSong &song = queue.GetOrder(order); const DetachedSong &song = queue.GetOrder(order);
FormatDebug(playlist_domain, "queue song %i:\"%s\"", FmtDebug(playlist_domain, "queue song {}:\"{}\"",
queued, song.GetURI()); queued, song.GetURI());
pc.LockEnqueueSong(std::make_unique<DetachedSong>(song)); pc.LockEnqueueSong(std::make_unique<DetachedSong>(song));
...@@ -178,7 +178,7 @@ playlist::PlayOrder(PlayerControl &pc, unsigned order) ...@@ -178,7 +178,7 @@ playlist::PlayOrder(PlayerControl &pc, unsigned order)
const DetachedSong &song = queue.GetOrder(order); const DetachedSong &song = queue.GetOrder(order);
FormatDebug(playlist_domain, "play %u:\"%s\"", order, song.GetURI()); FmtDebug(playlist_domain, "play {}:\"{}\"", order, song.GetURI());
current = order; current = order;
......
...@@ -36,7 +36,7 @@ playlist::Stop(PlayerControl &pc) noexcept ...@@ -36,7 +36,7 @@ playlist::Stop(PlayerControl &pc) noexcept
assert(current >= 0); assert(current >= 0);
FormatDebug(playlist_domain, "stop"); LogDebug(playlist_domain, "stop");
pc.LockStop(); pc.LockStop();
queued = -1; queued = -1;
playing = false; playing = false;
......
...@@ -79,8 +79,8 @@ BonjourHelper::Callback([[maybe_unused]] DNSServiceRef sdRef, ...@@ -79,8 +79,8 @@ BonjourHelper::Callback([[maybe_unused]] DNSServiceRef sdRef,
helper.Cancel(); helper.Cancel();
} else { } else {
FormatDebug(bonjour_domain, FmtDebug(bonjour_domain,
"Registered zeroconf service with name '%s'", "Registered zeroconf service with name '{}'",
name); name);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment