mirror of
https://github.com/AxioDL/boo.git
synced 2025-12-14 15:46:19 +00:00
Update fmtlib
This commit is contained in:
@@ -73,7 +73,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
argSize = sizeof(devId);
|
||||
if (AudioObjectGetPropertyData(kAudioObjectSystemObject, &propertyAddress, sizeof(devName), &devName, &argSize,
|
||||
&devId) != noErr) {
|
||||
Log.report(logvisor::Error, fmt("unable to resolve audio device UID {}, using default"),
|
||||
Log.report(logvisor::Error, FMT_STRING("unable to resolve audio device UID {}, using default"),
|
||||
CFStringGetCStringPtr(devName, kCFStringEncodingUTF8));
|
||||
argSize = sizeof(devId);
|
||||
propertyAddress.mSelector = kAudioHardwarePropertyDefaultOutputDevice;
|
||||
@@ -83,7 +83,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||
AudioObjectGetPropertyData(devId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
|
||||
} else {
|
||||
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable determine default audio device"));
|
||||
return {AudioChannelSet::Unknown, 48000.0};
|
||||
}
|
||||
}
|
||||
@@ -249,7 +249,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (!(nameCstr = CFStringGetCStringPtr(namestr.get(), kCFStringEncodingUTF8)))
|
||||
continue;
|
||||
|
||||
ret.push_back(std::make_pair(fmt::format(fmt("{:08X}"), idNum), std::string(nameCstr)));
|
||||
ret.push_back(std::make_pair(fmt::format(FMT_STRING("{:08X}"), idNum), std::string(nameCstr)));
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -268,7 +268,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (MIDIObjectGetIntegerProperty(dev, kMIDIPropertyUniqueID, &idNum))
|
||||
continue;
|
||||
|
||||
if (fmt::format(fmt("{:08X}"), idNum) != name)
|
||||
if (fmt::format(FMT_STRING("{:08X}"), idNum) != name)
|
||||
continue;
|
||||
|
||||
return dev;
|
||||
@@ -462,9 +462,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
std::string name;
|
||||
auto appName = APP->getFriendlyName();
|
||||
if (!m_midiInCounter)
|
||||
name = fmt::format(fmt("{} MIDI-In"), appName);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-In"), appName);
|
||||
else
|
||||
name = fmt::format(fmt("{} MIDI-In {}"), appName, m_midiInCounter);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter);
|
||||
m_midiInCounter++;
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
@@ -487,9 +487,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
std::string name;
|
||||
auto appName = APP->getFriendlyName();
|
||||
if (!m_midiOutCounter)
|
||||
name = fmt::format(fmt("{} MIDI-Out"), appName);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-Out"), appName);
|
||||
else
|
||||
name = fmt::format(fmt("{} MIDI-Out {}"), appName, m_midiOutCounter);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter);
|
||||
m_midiOutCounter++;
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
@@ -510,9 +510,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
std::string name;
|
||||
auto appName = APP->getFriendlyName();
|
||||
if (!m_midiInCounter)
|
||||
name = fmt::format(fmt("{} MIDI-In"), appName);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-In"), appName);
|
||||
else
|
||||
name = fmt::format(fmt("{} MIDI-In {}"), appName, m_midiInCounter);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter);
|
||||
m_midiInCounter++;
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
@@ -524,9 +524,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
return {};
|
||||
|
||||
if (!m_midiOutCounter)
|
||||
name = fmt::format(fmt("{} MIDI-Out"), appName);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-Out"), appName);
|
||||
else
|
||||
name = fmt::format(fmt("{} MIDI-Out {}"), appName, m_midiOutCounter);
|
||||
name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter);
|
||||
m_midiOutCounter++;
|
||||
midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
@@ -548,7 +548,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (!ret)
|
||||
return {};
|
||||
|
||||
std::string mname = fmt::format(fmt("Boo MIDI Real In {}"), m_midiInCounter++);
|
||||
std::string mname = fmt::format(FMT_STRING("Boo MIDI Real In {}"), m_midiInCounter++);
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
if (MIDIInputPortCreate(m_midiClient, midiName.get(), MIDIReadProc(MIDIReceiveProc),
|
||||
@@ -572,7 +572,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (!ret)
|
||||
return {};
|
||||
|
||||
std::string mname = fmt::format(fmt("Boo MIDI Real Out {}"), m_midiOutCounter++);
|
||||
std::string mname = fmt::format(FMT_STRING("Boo MIDI Real Out {}"), m_midiOutCounter++);
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
if (MIDIOutputPortCreate(m_midiClient, midiName.get(), &static_cast<MIDIOut&>(*ret).m_midiPort))
|
||||
@@ -599,7 +599,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (!ret)
|
||||
return {};
|
||||
|
||||
std::string mname = fmt::format(fmt("Boo MIDI Real In {}"), m_midiInCounter++);
|
||||
std::string mname = fmt::format(FMT_STRING("Boo MIDI Real In {}"), m_midiInCounter++);
|
||||
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
if (MIDIInputPortCreate(m_midiClient, midiName.get(), MIDIReadProc(MIDIReceiveProc),
|
||||
@@ -611,7 +611,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
if (!ret)
|
||||
return {};
|
||||
|
||||
mname = fmt::format(fmt("Boo MIDI Real Out {}"), m_midiOutCounter++);
|
||||
mname = fmt::format(FMT_STRING("Boo MIDI Real Out {}"), m_midiOutCounter++);
|
||||
midiName = CFPointer<CFStringRef>::adopt(
|
||||
CFStringCreateWithCStringNoCopy(nullptr, mname.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
|
||||
if (MIDIOutputPortCreate(m_midiClient, midiName.get(), &static_cast<MIDIInOut&>(*ret).m_midiPortOut))
|
||||
@@ -653,13 +653,13 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
OSStatus err;
|
||||
if ((err = AudioQueueNewOutput(&desc, AudioQueueOutputCallback(Callback), this, CFRunLoopGetCurrent(),
|
||||
m_runLoopMode.get(), 0, &m_queue))) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to create output audio queue"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to create output audio queue"));
|
||||
return;
|
||||
}
|
||||
|
||||
CFStringRef devName = m_devName.get();
|
||||
if ((err = AudioQueueSetProperty(m_queue, kAudioQueueProperty_CurrentDevice, &devName, sizeof(devName)))) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to set current device into audio queue"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to set current device into audio queue"));
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -677,7 +677,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
AudioChannelLayout layout;
|
||||
UInt32 layoutSz = sizeof(layout);
|
||||
if (AudioQueueGetProperty(m_queue, kAudioQueueProperty_ChannelLayout, &layout, &layoutSz)) {
|
||||
Log.report(logvisor::Warning, fmt("unable to get channel layout from audio queue; using count's default"));
|
||||
Log.report(logvisor::Warning, FMT_STRING("unable to get channel layout from audio queue; using count's default"));
|
||||
switch (m_mixInfo.m_channels) {
|
||||
case AudioChannelSet::Stereo:
|
||||
default:
|
||||
@@ -758,7 +758,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
chMapOut.m_channels[4] = AudioChannel::FrontCenter;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Warning, fmt("unknown channel layout {}; using stereo"), layout.mChannelLayoutTag);
|
||||
Log.report(logvisor::Warning, FMT_STRING("unknown channel layout {}; using stereo"), layout.mChannelLayoutTag);
|
||||
chMapOut.m_channelCount = 2;
|
||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||
@@ -776,7 +776,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
m_mixInfo.m_periodFrames = m_5msFrames;
|
||||
for (int i = 0; i < AQS_NUM_BUFFERS; ++i)
|
||||
if (AudioQueueAllocateBuffer(m_queue, m_mixInfo.m_periodFrames * chCount * 4, &m_buffers[i])) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to create audio queue buffer"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to create audio queue buffer"));
|
||||
AudioQueueDispose(m_queue, false);
|
||||
m_queue = nullptr;
|
||||
return;
|
||||
@@ -826,7 +826,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
deviceAddress.mSelector = kAudioDevicePropertyDeviceUID;
|
||||
AudioObjectGetPropertyData(defaultDeviceId, &deviceAddress, 0, nullptr, &argSize, &m_devName);
|
||||
} else {
|
||||
Log.report(logvisor::Fatal, fmt("unable determine default audio device"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable determine default audio device"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ void AudioVoice::_setPitchRatio(double ratio, bool slew) {
|
||||
m_sampleRatio = ratio * m_sampleRateIn / m_sampleRateOut;
|
||||
soxr_error_t err = soxr_set_io_ratio(m_src, m_sampleRatio, slew ? m_head->m_5msFrames : 0);
|
||||
if (err) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to set resampler rate: {}"), soxr_strerror(err));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to set resampler rate: {}"), soxr_strerror(err));
|
||||
m_setPitchRatio = false;
|
||||
return;
|
||||
}
|
||||
@@ -71,7 +71,7 @@ void AudioVoiceMono::_resetSampleRate(double sampleRate) {
|
||||
m_src = soxr_create(sampleRate, rateOut, 1, &err, &ioSpec, &qSpec, nullptr);
|
||||
|
||||
if (err) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to create soxr resampler: {}"), soxr_strerror(err));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to create soxr resampler: {}"), soxr_strerror(err));
|
||||
m_resetSampleRate = false;
|
||||
return;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ void AudioVoiceStereo::_resetSampleRate(double sampleRate) {
|
||||
m_src = soxr_create(sampleRate, rateOut, 2, &err, &ioSpec, &qSpec, nullptr);
|
||||
|
||||
if (!m_src) {
|
||||
Log.report(logvisor::Fatal, fmt("unable to create soxr resampler: {}"), soxr_strerror(err));
|
||||
Log.report(logvisor::Fatal, FMT_STRING("unable to create soxr resampler: {}"), soxr_strerror(err));
|
||||
m_resetSampleRate = false;
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
||||
snd_ctl_t* ctl;
|
||||
int device = -1;
|
||||
int status;
|
||||
std::string name = fmt::format(fmt("hw:{}"), card);
|
||||
std::string name = fmt::format(FMT_STRING("hw:{}"), card);
|
||||
if ((status = snd_ctl_open(&ctl, name.c_str(), 0)) < 0)
|
||||
continue;
|
||||
|
||||
@@ -58,7 +58,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
||||
if (status < 0)
|
||||
break;
|
||||
if (device >= 0) {
|
||||
name += fmt::format(fmt(",{}"), device);
|
||||
name += fmt::format(FMT_STRING(",{}"), device);
|
||||
auto search = m_openHandles.find(name);
|
||||
if (search != m_openHandles.cend()) {
|
||||
ret.push_back(std::make_pair(name, search->second->description()));
|
||||
@@ -103,7 +103,7 @@ struct LinuxMidi : BaseAudioVoiceEngine {
|
||||
int rdBytes = snd_rawmidi_read(midi, buf, 512);
|
||||
if (rdBytes < 0) {
|
||||
if (rdBytes != -EINTR) {
|
||||
ALSALog.report(logvisor::Error, fmt("MIDI connection lost"));
|
||||
ALSALog.report(logvisor::Error, FMT_STRING("MIDI connection lost"));
|
||||
break;
|
||||
}
|
||||
continue;
|
||||
|
||||
@@ -69,7 +69,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
pa_operation_unref(op);
|
||||
|
||||
if (m_sampleSpec.format == PA_SAMPLE_INVALID) {
|
||||
Log.report(logvisor::Error, fmt("Unable to setup audio stream"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to setup audio stream"));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
m_mixInfo.m_bitsPerSample = 32;
|
||||
m_mixInfo.m_periodFrames = m_5msFrames;
|
||||
if (!(m_stream = pa_stream_new(m_ctx, "master", &m_sampleSpec, &m_chanMap))) {
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_stream_new(): {}"), pa_strerror(pa_context_errno(m_ctx)));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_new(): {}"), pa_strerror(pa_context_errno(m_ctx)));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
if (pa_stream_connect_playback(m_stream, m_sinkName.c_str(), &bufAttr,
|
||||
pa_stream_flags_t(PA_STREAM_START_UNMUTED | PA_STREAM_EARLY_REQUESTS), nullptr,
|
||||
nullptr)) {
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_stream_connect_playback()"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_connect_playback()"));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -115,16 +115,16 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
|
||||
PulseAudioVoiceEngine() {
|
||||
if (!(m_mainloop = pa_mainloop_new())) {
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_mainloop_new()"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_mainloop_new()"));
|
||||
return;
|
||||
}
|
||||
|
||||
pa_mainloop_api* mlApi = pa_mainloop_get_api(m_mainloop);
|
||||
pa_proplist* propList = pa_proplist_new();
|
||||
pa_proplist_sets(propList, PA_PROP_APPLICATION_ICON_NAME, APP->getUniqueName().data());
|
||||
pa_proplist_sets(propList, PA_PROP_APPLICATION_PROCESS_ID, fmt::format(fmt("{}"), int(getpid())).c_str());
|
||||
pa_proplist_sets(propList, PA_PROP_APPLICATION_PROCESS_ID, fmt::format(FMT_STRING("{}"), int(getpid())).c_str());
|
||||
if (!(m_ctx = pa_context_new_with_proplist(mlApi, APP->getFriendlyName().data(), propList))) {
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_context_new_with_proplist()"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_context_new_with_proplist()"));
|
||||
pa_mainloop_free(m_mainloop);
|
||||
m_mainloop = nullptr;
|
||||
return;
|
||||
@@ -133,7 +133,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
pa_operation* op;
|
||||
|
||||
if (pa_context_connect(m_ctx, nullptr, PA_CONTEXT_NOFLAGS, nullptr)) {
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_context_connect()"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_context_connect()"));
|
||||
goto err;
|
||||
}
|
||||
|
||||
@@ -340,7 +340,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
size_t nbytes = writablePeriods * periodSz;
|
||||
if (pa_stream_begin_write(m_stream, &data, &nbytes)) {
|
||||
pa_stream_state_t st = pa_stream_get_state(m_stream);
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_stream_begin_write(): {} {}"), pa_strerror(pa_context_errno(m_ctx)), st);
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_begin_write(): {} {}"), pa_strerror(pa_context_errno(m_ctx)), st);
|
||||
_doIterate();
|
||||
return;
|
||||
}
|
||||
@@ -349,7 +349,7 @@ struct PulseAudioVoiceEngine : LinuxMidi {
|
||||
_pumpAndMixVoices(m_mixInfo.m_periodFrames * writablePeriods, reinterpret_cast<float*>(data));
|
||||
|
||||
if (pa_stream_write(m_stream, data, nbytes, nullptr, 0, PA_SEEK_RELATIVE))
|
||||
Log.report(logvisor::Error, fmt("Unable to pa_stream_write()"));
|
||||
Log.report(logvisor::Error, FMT_STRING("Unable to pa_stream_write()"));
|
||||
|
||||
_doIterate();
|
||||
}
|
||||
|
||||
@@ -121,14 +121,14 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#if !WINDOWS_STORE
|
||||
if (!m_device) {
|
||||
if (FAILED(m_enumerator->GetDevice(MBSTWCS(m_sinkName.c_str()).c_str(), &m_device))) {
|
||||
Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), m_sinkName);
|
||||
Log.report(logvisor::Error, FMT_STRING("unable to obtain audio device {}"), m_sinkName);
|
||||
m_device.Reset();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (FAILED(m_device->Activate(IID_IAudioClient, CLSCTX_ALL, nullptr, &m_audClient))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to create audio client from device"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to create audio client from device"));
|
||||
m_device.Reset();
|
||||
return;
|
||||
}
|
||||
@@ -136,7 +136,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
WAVEFORMATEXTENSIBLE* pwfx;
|
||||
if (FAILED(m_audClient->GetMixFormat((WAVEFORMATEX**)&pwfx))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to obtain audio mix format from device"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to obtain audio mix format from device"));
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -204,7 +204,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
chMapOut.m_channels[7] = AudioChannel::SideRight;
|
||||
break;
|
||||
default:
|
||||
Log.report(logvisor::Warning, fmt("unknown channel layout {}; using stereo"), pwfx->Format.nChannels);
|
||||
Log.report(logvisor::Warning, FMT_STRING("unknown channel layout {}; using stereo"), pwfx->Format.nChannels);
|
||||
chMapOut.m_channelCount = 2;
|
||||
chMapOut.m_channels[0] = AudioChannel::FrontLeft;
|
||||
chMapOut.m_channels[1] = AudioChannel::FrontRight;
|
||||
@@ -214,7 +214,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
/* Initialize audio client */
|
||||
if (FAILED(m_audClient->Initialize(AUDCLNT_SHAREMODE_SHARED, 0, 450000, /* 45ms */
|
||||
0, (WAVEFORMATEX*)pwfx, nullptr))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to initialize audio client"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to initialize audio client"));
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -235,7 +235,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
m_mixInfo.m_sampleFormat = SOXR_INT32_I;
|
||||
m_mixInfo.m_bitsPerSample = 32;
|
||||
} else {
|
||||
Log.report(logvisor::Fatal, fmt(L"unsupported bits-per-sample {}"), pwfx->Format.wBitsPerSample);
|
||||
Log.report(logvisor::Fatal, FMT_STRING(L"unsupported bits-per-sample {}"), pwfx->Format.wBitsPerSample);
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -248,7 +248,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
m_mixInfo.m_sampleFormat = SOXR_FLOAT32_I;
|
||||
m_mixInfo.m_bitsPerSample = 32;
|
||||
} else {
|
||||
Log.report(logvisor::Error, fmt(L"unsupported floating-point bits-per-sample {}"), pwfx->Format.wBitsPerSample);
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unsupported floating-point bits-per-sample {}"), pwfx->Format.wBitsPerSample);
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -260,7 +260,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
UINT32 bufferFrameCount;
|
||||
if (FAILED(m_audClient->GetBufferSize(&bufferFrameCount))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to get audio buffer frame count"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to get audio buffer frame count"));
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -269,7 +269,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
m_mixInfo.m_periodFrames = bufferFrameCount;
|
||||
|
||||
if (FAILED(m_audClient->GetService(IID_IAudioRenderClient, &m_renderClient))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to create audio render client"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to create audio render client"));
|
||||
#if !WINDOWS_STORE
|
||||
m_device.Reset();
|
||||
#endif
|
||||
@@ -346,18 +346,18 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
/* Enumerate default audio device */
|
||||
if (FAILED(
|
||||
CoCreateInstance(CLSID_MMDeviceEnumerator, nullptr, CLSCTX_ALL, IID_IMMDeviceEnumerator, &m_enumerator))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to create MMDeviceEnumerator instance"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to create MMDeviceEnumerator instance"));
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_enumerator->RegisterEndpointNotificationCallback(&m_notificationClient))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to register multimedia event callback"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to register multimedia event callback"));
|
||||
m_device.Reset();
|
||||
return;
|
||||
}
|
||||
|
||||
if (FAILED(m_enumerator->GetDefaultAudioEndpoint(eRender, eConsole, &m_device))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to obtain default audio device"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to obtain default audio device"));
|
||||
m_device.Reset();
|
||||
return;
|
||||
}
|
||||
@@ -385,7 +385,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
m_started = false;
|
||||
|
||||
if (m_mixInfo.m_sampleFormat != oldFmt)
|
||||
Log.report(logvisor::Fatal, fmt(L"audio device sample format changed, boo doesn't support this!!"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING(L"audio device sample format changed, boo doesn't support this!!"));
|
||||
|
||||
_resetSampleRate();
|
||||
}
|
||||
@@ -402,7 +402,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
int attempt = 0;
|
||||
while (true) {
|
||||
if (attempt >= 10)
|
||||
Log.report(logvisor::Fatal, fmt(L"unable to setup AudioRenderClient"));
|
||||
Log.report(logvisor::Fatal, FMT_STRING(L"unable to setup AudioRenderClient"));
|
||||
|
||||
if (m_rebuild) {
|
||||
m_device.Reset();
|
||||
@@ -472,7 +472,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
bool setCurrentAudioOutput(const char* name) override {
|
||||
ComPtr<IMMDevice> newDevice;
|
||||
if (FAILED(m_enumerator->GetDevice(MBSTWCS(name).c_str(), &newDevice))) {
|
||||
Log.report(logvisor::Error, fmt("unable to obtain audio device {}"), name);
|
||||
Log.report(logvisor::Error, FMT_STRING("unable to obtain audio device {}"), name);
|
||||
return false;
|
||||
}
|
||||
m_device = newDevice;
|
||||
@@ -486,7 +486,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
|
||||
ComPtr<IMMDeviceCollection> collection;
|
||||
if (FAILED(m_enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &collection))) {
|
||||
Log.report(logvisor::Error, fmt(L"unable to enumerate audio outputs"));
|
||||
Log.report(logvisor::Error, FMT_STRING(L"unable to enumerate audio outputs"));
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -518,7 +518,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
ret.reserve(numInDevices);
|
||||
|
||||
for (UINT i = 0; i < numInDevices; ++i) {
|
||||
std::string name = fmt::format(fmt("in{}"), i);
|
||||
std::string name = fmt::format(FMT_STRING("in{}"), i);
|
||||
|
||||
MIDIINCAPS caps;
|
||||
if (FAILED(midiInGetDevCaps(i, &caps, sizeof(caps))))
|
||||
@@ -534,7 +534,7 @@ struct WASAPIAudioVoiceEngine : BaseAudioVoiceEngine {
|
||||
#if 0
|
||||
for (UINT i=0 ; i<numOutDevices ; ++i)
|
||||
{
|
||||
std::string name = fmt::format(fmt("out{}"), i);
|
||||
std::string name = fmt::format(FMT_STRING("out{}"), i);
|
||||
|
||||
MIDIOUTCAPS caps;
|
||||
if (FAILED(midiOutGetDevCaps(i, &caps, sizeof(caps))))
|
||||
|
||||
Reference in New Issue
Block a user