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