MuseScore icon indicating copy to clipboard operation
MuseScore copied to clipboard

[MU4 Issue] Preferences > I/O > Audio device: names of available audio devices appears badly

Open cbjeukendrup opened this issue 1 year ago • 2 comments

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: Scherm­afbeelding 2022-12-19 om 00 57 28 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 avatar Dec 19 '22 00:12 cbjeukendrup

@cbjeukendrup Could you check String::trimmed for the device name?

Eism avatar Dec 20 '22 12:12 Eism

@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?

cbjeukendrup avatar Dec 20 '22 19:12 cbjeukendrup