Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Core Audio Backend #6056

Closed
wants to merge 1 commit into from
Closed

Conversation

kfreezen
Copy link

@kfreezen kfreezen commented May 7, 2020

I added a basic Driver class for a Core Audio backend, and added a RadioGroupBox to the preference dialog for selecting Core Audio.

Why did I want to add this code/What are the benefits?
I wanted MuseScore to switch output devices automatically if I were to plug one in. PortAudio required me to mess with the I/O tab in the Preferences dialog to switch output devices. PortAudio has no API for tracking output device changes.

Using Core Audio directly has another benefit, which is a lower "Energy Impact" score. My not-so-scientific test yielded a difference between 5 and 2.5 when playback was stopped. It's not groundbreaking, but it is a small improvement.

  • I signed CLA
  • I made sure the code in the PR follows the coding rules
  • I made sure the code compiles on my machine
  • I made sure there are no unnecessary changes in the code
  • I made sure the title of the PR reflects the core meaning of the issue you are solving
  • I made sure the commit message(s) contain a description and answer the question "Why do those changes fix that particular issue?" or "Why are those changes really necessary as improvements?"
  • I made sure the commit message title starts with "fix #424242:" if there is a related issue
  • I created the test (mtest, vtest, script test) to verify the changes I made

@mattmcclinch
Copy link
Contributor

mattmcclinch commented May 7, 2020

Thank you for the work you have done and are continuing to do on this. I feel that lack of CoreAudio support has been a huge drawback up until now.

CMakeLists.txt Outdated Show resolved Hide resolved
mscore/prefsdialog.ui Outdated Show resolved Hide resolved
mscore/prefsdialog.ui Outdated Show resolved Hide resolved
mscore/prefsdialog.ui Outdated Show resolved Hide resolved
mscore/prefsdialog.ui Show resolved Hide resolved
@mattmcclinch
Copy link
Contributor

@kfreezen, are you still working on this? And are you willing to do what it takes to make this pull request mergeable? If so, then I can give you as much or as little help as you need. Otherwise, I would be happy to take over from here.

@kfreezen
Copy link
Author

kfreezen commented May 8, 2020

@mattmcclinch Yes, I'm still working on it. I got to the point where I didn't know what else to do. I thought that I'd add a PR here and get others' input on it. As for specific comments on the code, I will be replying to those throughout the day today.

Thanks for your interest in this. It makes me a little happier than I was before I saw this thread this morning.

@mattmcclinch
Copy link
Contributor

By the way, if you don't know what else to do, you can work on reformatting your code so that it follows the coding rules.

@kfreezen
Copy link
Author

kfreezen commented May 8, 2020 via email

@mattmcclinch
Copy link
Contributor

You will probably have to do it by hand.

@Jojo-Schmitz
Copy link
Contributor

There is an xml file suitable for QtCreator in the developerts' handbook

@kfreezen
Copy link
Author

kfreezen commented May 9, 2020 via email

@mattmcclinch
Copy link
Contributor

The pitch issue occurred when I was just using the MacBook Pro speakers. If I had earphones plugged in or a bluetooth headset connected, it sounded fine.

CMakeLists.txt Outdated Show resolved Hide resolved
@Jojo-Schmitz
Copy link
Contributor

Please squash all these commits into just one

@kfreezen kfreezen force-pushed the feature/coreaudio branch 2 times, most recently from 461e790 to 38a168e Compare May 11, 2020 02:37
@kfreezen
Copy link
Author

I'm hoping that covers all the formatting changes. Tried to make sure I got them all.

There seems to be a glitch I'm running into intermittently while using the CoreAudio driver. The position indicator froze at position 0 in the score and the sequencer buffer filled to max. I can't get that to reproduce consistently for me though.

Copy link
Contributor

@mattmcclinch mattmcclinch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found a few remaining formatting issues. Also, please use Q_UNUSED to silence the many 'unused parameter' warnings in coreaudio.cpp.

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
audio/drivers/driver.cpp Show resolved Hide resolved
audio/drivers/coreaudio.cpp Show resolved Hide resolved
audio/drivers/coreaudio.cpp Outdated Show resolved Hide resolved
audio/drivers/coreaudio.h Outdated Show resolved Hide resolved
audio/drivers/coreaudio.cpp Outdated Show resolved Hide resolved
audio/drivers/coreaudio.cpp Outdated Show resolved Hide resolved
audio/drivers/coreaudio.cpp Outdated Show resolved Hide resolved
audio/drivers/coreaudio.h Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@kfreezen kfreezen force-pushed the feature/coreaudio branch 3 times, most recently from 9c828a8 to c9d5ef6 Compare May 12, 2020 02:34
@kfreezen kfreezen force-pushed the feature/coreaudio branch from c9d5ef6 to ae807c9 Compare May 18, 2020 18:01
@kfreezen
Copy link
Author

I'm curious whether there's anything I missed on this one, or if it's waiting on someone else?

@Jojo-Schmitz
Copy link
Contributor

It needs a rebase, adjusting to the new coding style. There's a script to help with that, in tools/codestyle.
Also some of the files may have been moved around, quite some changes have been done reorganizing the code.

@kfreezen kfreezen force-pushed the feature/coreaudio branch 2 times, most recently from 4b96e6a to 8b109e9 Compare August 12, 2020 17:29
@kfreezen
Copy link
Author

There are some glitches that a friend and I have run into while testing this branch over the last 3-4 months.

The main glitch is what looks like the sequencer freezing after the program has been running in the background for a while. I have not narrowed down what causes the bug, since it's fairly intermittent and shows up when you hit the Play button.

It seems like the problem is fixed if I edit the score before playing, however. Maybe someone can give me some ideas on where to look for this one?

Added option and tabstop for Core Audio to preference dialog
@kfreezen
Copy link
Author

I'm curious what architecture changes are being actively made in MuseScore. Is there a source or documentation on those arch changes? Is audio driver code moving to another project? That's what it looks like.

@RobFog
Copy link

RobFog commented Dec 19, 2020

@igorkorsukov should be able to answer that.

@igorkorsukov
Copy link
Contributor

I'm curious what architecture changes are being actively made in MuseScore. Is there a source or documentation on those arch changes? Is audio driver code moving to another project? That's what it looks like.

Yes, that's right, the architecture of the project has changed a lot.
In general, you can read about the principles of the new project architecture here (not about audio)
https://github.com/musescore/Documentation/blob/master/Architecture/README.md

The new audio driver is here, you can preview it.
https://github.com/musescore/MuseScore/blob/master/src/framework/audio/internal/platform/osx/osxaudiodriver.cpp

I am very sorry that we were not able to take advantage of your work.

@kfreezen
Copy link
Author

@igorkorsukov no problem. As long as I can get "instant switching" with my Airpods, I'm happy. Where is a good place to ask questions about the general architecture and MuseScore's long term goals with it?

@igorkorsukov
Copy link
Contributor

@igorkorsukov no problem. As long as I can get "instant switching" with my Airpods, I'm happy. Where is a good place to ask questions about the general architecture and MuseScore's long term goals with it?

You can ask questions in pull requests or in the development chat https://t.me/musescoreeditorchat (if the question is about architecture, then it's better to mention me)

@igorkorsukov igorkorsukov added the archived PRs that have gone stale but could potentially be revived in the future label Dec 26, 2020
@igorkorsukov
Copy link
Contributor

As long as I can get "instant switching" with my Airpods, I'm happy.

@psmokotnin FYI

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
archived PRs that have gone stale but could potentially be revived in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants