MuseScore
MuseScore copied to clipboard
[MU4 Issue] Preferences > I/O > Audio device: names of available audio devices appears badly
Describe the bug
On my Mac, if I go to Preferences > I/O > Audio device, and open the dropdown of available audio devices, I see this:
For some devices, the name is missing completely, and the bottom one is supposed to be "Studio Display-luidsprekers" but the first and last few characters are missing.
The names don't contain any special characters, so that can't be the reason.
@cbjeukendrup Could you check String::trimmed for the device name?
@Eism I did some experimenting, and the error seems to be in OSXAudioDriver, specifically in the conversion from CFStringRef to std::string. I took inspiration from https://gist.github.com/peter-bloomfield/1b228e2bb654702b1e50ef7524121fb9, which fixes the issue almost completely, except that the one that's supposed to say "Studio Display-luidsprekers" is completely blank now. For this string, CFShowStr(nameRef); prints "This is an NSString, not CFString". So apparently a CFStringRef is not always a CFString but sometimes an NSString. I think that this relates to the fact that in Objective-C, there's something called toll-free bridging between CFString and NSString. (This would be useful for us too, since converting from NSString to std::string is easier.) So I think we can fix this problem by renaming osxaudiodriver.cpp to osxaudiodriver.mm. Do you know if there's anything against this?