Fix macOS compilation

This commit is contained in:
Luke Street 2022-02-04 23:25:35 -05:00
parent 9f8035dbd8
commit 693500c055
1 changed files with 14 additions and 14 deletions

View File

@ -46,6 +46,8 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
MIDIClientRef m_midiClient = 0; MIDIClientRef m_midiClient = 0;
std::string m_friendlyName;
bool m_cbRunning = true; bool m_cbRunning = true;
bool m_needsRebuild = false; bool m_needsRebuild = false;
@ -460,11 +462,10 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
return {}; return {};
std::string name; std::string name;
auto appName = APP->getFriendlyName();
if (!m_midiInCounter) if (!m_midiInCounter)
name = fmt::format(FMT_STRING("{} MIDI-In"), appName); name = fmt::format(FMT_STRING("{} MIDI-In"), m_friendlyName);
else else
name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter); name = fmt::format(FMT_STRING("{} MIDI-In {}"), m_friendlyName, m_midiInCounter);
m_midiInCounter++; m_midiInCounter++;
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt( CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
@ -485,11 +486,10 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
return {}; return {};
std::string name; std::string name;
auto appName = APP->getFriendlyName();
if (!m_midiOutCounter) if (!m_midiOutCounter)
name = fmt::format(FMT_STRING("{} MIDI-Out"), appName); name = fmt::format(FMT_STRING("{} MIDI-Out"), m_friendlyName);
else else
name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter); name = fmt::format(FMT_STRING("{} MIDI-Out {}"), m_friendlyName, m_midiOutCounter);
m_midiOutCounter++; m_midiOutCounter++;
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt( CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
@ -508,11 +508,10 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
return {}; return {};
std::string name; std::string name;
auto appName = APP->getFriendlyName();
if (!m_midiInCounter) if (!m_midiInCounter)
name = fmt::format(FMT_STRING("{} MIDI-In"), appName); name = fmt::format(FMT_STRING("{} MIDI-In"), m_friendlyName);
else else
name = fmt::format(FMT_STRING("{} MIDI-In {}"), appName, m_midiInCounter); name = fmt::format(FMT_STRING("{} MIDI-In {}"), m_friendlyName, m_midiInCounter);
m_midiInCounter++; m_midiInCounter++;
CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt( CFPointer<CFStringRef> midiName = CFPointer<CFStringRef>::adopt(
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
@ -524,9 +523,9 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
return {}; return {};
if (!m_midiOutCounter) if (!m_midiOutCounter)
name = fmt::format(FMT_STRING("{} MIDI-Out"), appName); name = fmt::format(FMT_STRING("{} MIDI-Out"), m_friendlyName);
else else
name = fmt::format(FMT_STRING("{} MIDI-Out {}"), appName, m_midiOutCounter); name = fmt::format(FMT_STRING("{} MIDI-Out {}"), m_friendlyName, m_midiOutCounter);
m_midiOutCounter++; m_midiOutCounter++;
midiName = CFPointer<CFStringRef>::adopt( midiName = CFPointer<CFStringRef>::adopt(
CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull)); CFStringCreateWithCStringNoCopy(nullptr, name.c_str(), kCFStringEncodingUTF8, kCFAllocatorNull));
@ -809,9 +808,10 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
return noErr; return noErr;
} }
AQSAudioVoiceEngine() AQSAudioVoiceEngine(const char* friendlyName)
: m_runLoopMode(CFPointer<CFStringRef>::adopt( : m_runLoopMode(CFPointer<CFStringRef>::adopt(
CFStringCreateWithCStringNoCopy(nullptr, "BooAQSMode", kCFStringEncodingUTF8, kCFAllocatorNull))) { CFStringCreateWithCStringNoCopy(nullptr, "BooAQSMode", kCFStringEncodingUTF8, kCFAllocatorNull)))
, m_friendlyName(friendlyName) {
AudioObjectPropertyAddress propertyAddress; AudioObjectPropertyAddress propertyAddress;
propertyAddress.mScope = kAudioObjectPropertyScopeGlobal; propertyAddress.mScope = kAudioObjectPropertyScopeGlobal;
propertyAddress.mElement = kAudioObjectPropertyElementMaster; propertyAddress.mElement = kAudioObjectPropertyElementMaster;
@ -857,7 +857,7 @@ struct AQSAudioVoiceEngine : BaseAudioVoiceEngine {
}; };
std::unique_ptr<IAudioVoiceEngine> NewAudioVoiceEngine(const char* uniqueName, const char* friendlyName) { std::unique_ptr<IAudioVoiceEngine> NewAudioVoiceEngine(const char* uniqueName, const char* friendlyName) {
std::unique_ptr<IAudioVoiceEngine> ret = std::make_unique<AQSAudioVoiceEngine>(); std::unique_ptr<IAudioVoiceEngine> ret = std::make_unique<AQSAudioVoiceEngine>(friendlyName);
if (!static_cast<AQSAudioVoiceEngine&>(*ret).m_queue) if (!static_cast<AQSAudioVoiceEngine&>(*ret).m_queue)
return {}; return {};
return ret; return ret;