-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rubberband: switch between v2 and v3 at runtime #4855
Conversation
Thanks for the commit. It doesn't build unfortunately (fix is trivial). I'll finish #4853 and and then review this. It'll be a couple of days though. |
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.
Thank you. I have left some comments for improvement.
src/engine/enginebuffer.cpp
Outdated
@@ -62,6 +62,8 @@ constexpr SINT kSamplesPerFrame = 2; // Engine buffer uses Stereo frames only | |||
// Rate at which the playpos slider is updated | |||
constexpr int kPlaypositionUpdateRate = 15; // updates per second | |||
|
|||
#define RUBBERBANDV3 (RUBBERBAND_API_MINOR_VERSION >= 2 && RUBBERBAND_API_MINOR_VERSION >= 7) |
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.
#define RUBBERBANDV3 (RUBBERBAND_API_MINOR_VERSION >= 2 && RUBBERBAND_API_MINOR_VERSION >= 7) | |
#define RUBBERBANDV3 (RUBBERBAND_API_MINOR_VERSION >= 2 && RUBBERBAND_API_MINOR_VERSION >= 7) |
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.
But it would be nice to hide the dependency here.
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.
I don't spot the difference in your suggestion?
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.
Agree, including the entirety of RubberbandStretcher.h just for RUBBERBAND_API_MAJOR-/MINOR_VERSION
is quite a big dependency, but what other choice do we have?
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.
would a global const defined in enginebufferscalerubberband.h work?
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.
My original point was that the EngineScaler should handle the dependency not EngineBuffer.
Than EngieBuffer can use a member of EngineScaler to query about that.
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.
understood.
We need to differentiate at build time
That as well, thus my naive question about global const (set at compile time in the EngineScaler).
Than EngieBuffer can use a member of EngineScaler to query about that.
and that, too. Though how is that supossed to work for the enum in the EngineBuffer header?
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.
That as well, thus my naive question about global const (set at compile time in the EngineScaler).
The issue with globals consts is that they get to be evaluated after the preprocessor finished. Since we want to do conditional compilation using #if
, we need this value sooner, so we need a #define
for that then. RubberBandStretcher.h
is a pretty lean header (90% is just comments) so I guess its not a big problem to include that a bunch of times.
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.
Though how is that supossed to work for the enum in the EngineBuffer header?
My idea was to remove all the guards from the static code as if we are at a V3 build. If the engine Finer is not available the option need to be hidden from the GUI, that's all.
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.
Sure, but hiding it in the GUI seems more complicated than working with the guards in both EngineBuffer and EngineBufferScaleRubberBand.
Are you suggesting to first populate the keylock combobox with all values, then (probably in
DlgPrefSound::loadSettings) somehow query EngineBuffer / EngineBufferScaleRubberBand to decide if we remove RubberBand finer
from the combobox (and also reset the config to RubberBand (faster)) ?
d1da15e
to
c0ea35a
Compare
Well, this now builds and I fixed the test (adjusted to changed enum). ¹of course there are ways, like using a CO/ControlProxy "isRubberBandV3Available" but that's ugly and hacky (even for my taste) and error-prone. |
Idea: |
Not a fan of hiding options for no apparent reason. How much more effort would it be to grey it out instead and provide a tooltip explaining why its not available? |
Since we do not dynamically link to V2 and V3 users with V2 have no chance to "ungray" the grayed out option. That's why I have proposed to hide it. If we want to use it as a teaser, we need at least a hint how to ungray it. The only case where wrongly selected is, if the user has selected it in an experimental build and starts Mixxx without V3. Currently the combo-box is empty, but it uses Rubberband Fast. Here we can actually switch back to Rubberband Fast, or inform the user that the selection is not available. This is really an edge case, not worth to code to much around it. IMHO What do you think? |
Sure, thats what I would've put in tooltip for the greyed out option. |
Again: if you have any solution how to do this without hazzle nad hacks, please present it. |
now the KeylockEngine enum always contains RUBBERBAND_FINER, thus the selector in Preferences > Sound Hardware will always show it, too.
c75e72c
to
447543f
Compare
In a test branch, I have tried to keep the bad Rubberband value, but since it switches automatically back to default, the value does not persist after another restart. I think the use case is, using Finer in the recent R3 build, test an older Mixxx and go back to the R3 build without loosing the selection of the Finer engine in preference. With 2.3, the combobox is empty in this case. I think we should display "Unknown (bad value)" for main R2 builds instead and hide the value if a valid value was selected. |
Here it is: ronso0#26 It displays now "Unknown, using Rubberband (better)" in case of R3 was selected but is not available in the running build. |
Is the rubberband library version a compile-time selection? If so, I would vote to hide the option in the UI. Having a grayed-out option in the prefs for a value which literally cannot be enabled by the user does not communicate anything useful. Other examples of the same approach:
|
(is this PR still a draft?) |
Co-authored-by: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com> Co-authored-by: ronso0 <ronso0@mixxx.org>
With commits from ronso0#26 this is now ready to roll! |
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.
I didn't want to put more work on you so I went ahead and implemented all my review suggestions for you: ronso0/pull/27
#27) refactor(prefs): improve keylockengine-related typesafety
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.
lgtm otherwise
would be nice to have two ✔️ before I hit merge : ) |
I can do a final test after the build issues are solved. |
Sorry. The suggestion I posted contained capitalization typos. Sent you a PR. |
…Defaults Co-authored-by: Swiftb0y <12380386+Swiftb0y@users.noreply.github.com>
e4c2530
to
bdebb6e
Compare
I don't understand what's wrong with pre-commit |
I think versioning issues. seems to me like |
@daschuer pre-commit issues are unrelated. Can you do your final test before merge? |
Just did a brief test and all works as expected. Thank you all for the good collaboration. |
@Swiftb0y merge? Your review is still red. |
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.
whoops, lgtm.
Thank you. |
Rubberband: switch between v2 and v3 at runtime
Rubberband: switch between v2 and v3 at runtime
Rubberband: switch between v2 and v3 at runtime
Rubberband: switch between v2 and v3 at runtime
Rubberband: switch between v2 and v3 at runtime
Based on @Swiftb0y's #4853
Ready for review, though draft since I'll rebase if necessary / when #4853 is merged.