-
Notifications
You must be signed in to change notification settings - Fork 757
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
[scsynth portaudio] allow independent input output devices #4475
[scsynth portaudio] allow independent input output devices #4475
Conversation
Default selection working for ASIO and MME
Now debugging crash |
@sonoro1234 thanks, this also had the bug you found #4476 (comment) - fixed now. |
Cant debug this because only happens with my WASAPI devices but I can reach them compiling with mingw |
Could you give a full scsynth output for the WASAPI issue? |
It is not a WASAPI issue. The issue is a crash when not possible to boot.
There is not information in gdb. I think that it is related to exception handling in scsynth. |
Are you requesting sample rate 11200? I've seen issues booting to SR < 44100 (like 8000) and I don't know what's the problem. Does this happen with the regular build as well? |
This is not a problem, my ASIO card wont boot with 11200, I just asked for this impossible samplerate to debug the crash after |
Note on selecting ASIO soundcard by default: I had an opportunity to do more tests on other systems. I found at least one other Windows laptop that had Realtek ASIO driver present (for the internal soundcard), and booting to this did not work. Therefore, I removed selecting ASIO device by default. This PR still adds more checks that help with device selection, but the default behavior (selecting default MME device) is the same as before. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @dyfer!!
Thanks for the review @brianlheim ! I'll work on implementing changes. Also, Travis CI is failing on an arithmetic unit test... not sure what's that about... |
Thanks! Let me know if you have any more questions or if any comments were unclear
Not sure either, I just restarted the job. Don't worry about it. |
Thanks! Things are rather clear, I'll just need a bit of time to work on this and will ask you if I have questions along the way. |
Hi @brianlheim, I tried to address your comments. Please let me know how this looks now. Also, I created a function to get stream parameters to simplify some of the new code. Should I also use it in the DriverSetup section (which would be a work towards implementing your other suggestion) or should that be left for #4477? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks marcin! this is not as comprehensive a review as i wanted to give right now but i think there should still be plenty to work with. i will try to respond to your other comments asap.
1fee251
to
fb991c5
Compare
Thank you for your (partial?) review Brian! I also have a question regarding Which is better: bool isInput; //if matchingDeviceType is hypothetically neither Input nor Output, this stays unititialized
if (matchingDeviceType == IOType::Input)
isInput = true;
else if (matchingDeviceType == IOType::Output)
isInput = false;
if (isInput) {
// do on input
} else {
// do on output
}
fprintf(stdout, "this is %s\n", (isInput ? "input" : "output")); vs bool isInput = false; //we don't check whether it's IOType::Output or something else
if (matchingDeviceType == IOType::Input)
isInput = true;
if (isInput) {
// do on input
} else {
// do on output
}
fprintf(stdout, "this is %s\n", (isInput ? "input" : "output")); vs if (matchingDeviceType == IOType::Input) {
// do on input
} else if (matchingDeviceType == IOType::Output) {
// do on output
}
fprintf(stdout, "this is %s\n", ((matchingDeviceType == IOType::Input) ? "input" : "output")); //we don't check whether it's IOType::Output or something else |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I took some more time to digest what was going on and I think this should be my last round of comments. Thanks again for your patience. When a comment is more a light recommendation than a request for changes, I've marked it with "(suggestion)" at the start.
Two general suggestions:
- add documentation for functions (e.g., CheckPaDevices) in the header, not the cpp file.
- I don't know if you need "Pa" in the name of every function since it's already obvious these functions operate on PortAudio streams and objects. I realize you may have been trying to follow precedent with
GetPaDeviceFromName
but for me it has the effect of making it harder to understand when a function call is to something in PortAudio's API vs part of the class interface.
To answer your earlier question:
Also, I created a function to get stream parameters to simplify some of the new code. Should I also use it in the DriverSetup section (which would be a work towards implementing your other suggestion) or should that be left for #4477?
Leave it for #4477 :)
I also have a question regarding IOType here.
Which is better:
I answered your question in an inline comment here
Thanks for the fix! This now works as expected |
Thank you for the patches @jamshark70! Question: you replaced "macOS" with "MacOS" in your patches. Are you sure this is best? It seems that Apple stylizes it "macOS" everywhere, including beginning of the sentence, and I was trying to follow that. Example: I don't have a very strong opinion, but I wanted to clarify my conscious choice here. edit: after the dev meeting the consensus was that we should keep it as "macOS" in all cases. Thanks again for all the corrections! |
I've just tried the build with both my Steinberg MR816 ASIO card and Reaper's ReaRoute ASIO and both work well, no regression ! thanks ! |
Thanks for testing @geoffroymontel |
No objection to changing it back to Apple/apple(?) style. |
I've tried the following
The behaviour is the same on 3.10.2 on my Windows box |
@geoffroymontel thanks for testing. I'll check if there's a reason. Otherwise at least it's not a regression. |
update on ASIO default sample rate: It seems this is a PortAudio bug. PortAudio obtains ASIOError asioError = ASIOGetSampleRate(&deviceInfo->defaultSampleRate); and that seemed to work (server booted to device's sample rate), but I don't know enough to propose a full fix in PA for that. I have posted to their list so maybe it will be fixed upstream at some point. edit: |
@brianlheim please let me know when you think this is ready for me to rebase. @jamshark70 could you take a look whether your comments were properly addressed? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your work on this and patience @dyfer .
@jamshark70 please review when you have time
8ee9913
to
b315166
Compare
Windows/Linux: list/use APIs in device names Improve device selection logic Windows: use device's sample rate by default
create new reference: AudioDeviceSelection.schelp update and move Aggregate Device creation (macOS) to the new document link the new document from other help files
b315166
to
0316193
Compare
This PR's commit history is now cleaned up (I rebased and squashed relevant commits). Pending @jamshark70 's approval w/r/t #4475 (comment) it is ready to merge. |
@jamshark70 no pressure but FYI this PR (and your approval of it) is what's currently blocking the 3.10.3 release. |
Sorry for the delay -- I hadn't realized that I was holding up a release. I took the liberty of merging -- I hope that wasn't out of turn, but I recall this PR has already been extensively, exhaustively reviewed and if my approval was the last thing needed, seemed appropriate. Much-needed feature! |
thanks @jamshark70 !!! |
@dyfer Congratulations for such a long work!! |
Purpose and Motivation
This is a cleaned up version of #4009 focused on scsynth and documentation. See #4476 for supernova-related PR. Fixes #3990.
On Windows, scsynth was not able to select separate input and output devices (it accepted only single device name and tried to use it as both input and output). This essentially prevented manual device selection for anything other than soundcards with ASIO drivers.
This PR allows independent device selection, provides documentation and improves automatic device selection with PortAudio.
Thanks to @jamshark70 @sonoro1234 and others who helped with the original PR. This is the summary of the discussion so far:
there seemed to be a consensus that ASIO should be selected by defaultif ASIO device is not available,Types of changes
New featureBug fix: improve default device selectionif no devices are specified, try selecting an ASIO device firstTo-do list
Unresolved issues
This PR does not solve setting device names for devices with unicode characters. Character encoding seems to be a larger issue. My work so far on it was moved to #4479. Partial names however are matched as before.