Conversation
| break; | ||
| case FOURTHIRDS: | ||
| // introduce two beats into every gap | ||
| scaleDouble(); |
There was a problem hiding this comment.
Maybe you can implement scaleQuadruple() and use it here instead of two calls to scaleDouble().
There was a problem hiding this comment.
of course, didn't look it up
There was a problem hiding this comment.
Personally I think two scaleDoubles are fine here (less code is usually better and this isn't performance critical so two passes are ok).
There was a problem hiding this comment.
Ah -- then two scaleDoubles it is. Sorry for misguidance.
|
Looks like the BeatMap tests aren't passing: |
|
Thank you for testing. I didn't because in mixxx both numerical and visual results are as expected. DOUBLE and TWOTHIRDS make sense, but I don't see how HALVE can succeed. And why FOURTHIRDS expects 80 from original 40... |
|
It seems that you forgot to write (implement) method |
|
Furthermore, concerning unit tests and limiting of BPM, I'm really not sure why is it like that. Sorry, you will have to wait for a more experienced Mixxx developer/contributor. |
Wow, what the heck? I'll fix this. |
Oh, nevermind -- these are all continuous changes to the beatgrid. So the halve succeeds since the double scaled the original BPM x2 then halving takes it back to the original bpm. |
| pMap->scale(Beats::THREEFOURTHS); | ||
| EXPECT_DOUBLE_EQ(bpm / 2, pMap->getBpm()); | ||
|
|
||
| pMap->scale(Beats::FOURTHIRDS); |
There was a problem hiding this comment.
So these two should be bpm * 2 / 3 and bpm. Please also update src/test/beatgridtest.cpp.
There was a problem hiding this comment.
Oh you could also re-order three-halves to come after two-thirds so that each pair cancels out.
There was a problem hiding this comment.
Applied these changes, but I'm not sure why it'll work.
Did the same in beatgridtest.cpp, but I didn't do a testbuild to check it
There was a problem hiding this comment.
Oookay, think I got it! Just to bes sure:
TEST(BeatGridTest, Scale) is (like?) and function and called, therein all pGrid->scale(Beats::XXXX) are applied one after another, return values are checked in between.
There was a problem hiding this comment.
Yea it's kind of confusing. Do you know how to run the tests locally?
Run scons with the test=1 flag. Then you should end up with a mixxx-test binary, so you can run ./mixxx-test to see if the tests pass. If you don't want to, then the pull request checks by AppVeyor and Travis will let us know if the tests pass anyway.
| scaleFourth(); | ||
| break; | ||
| case FOURTHIRDS: | ||
| if (getBpm() * 4 / 3 > getMaxBpm()) { |
There was a problem hiding this comment.
I think you can drop these checks (and the check on double)... I'm not sure why we have a max BPM setting for anything other than determining when the BPM detector has gone awry.
| EXPECT_DOUBLE_EQ(bpm * 2 / 3, pGrid->getBpm()); | ||
|
|
||
| pGrid->scale(Beats::THREEHALVES); | ||
| EXPECT_DOUBLE_EQ(bpm * 3 / 2, pGrid->getBpm()); |
There was a problem hiding this comment.
This should be
EXPECT_DOUBLE_EQ(bpm, pGrid->getBpm());
since scaling 3/2 after a 2/3 scale should cancel out
| EXPECT_DOUBLE_EQ(bpm * 3 / 2, pGrid->getBpm()); | ||
|
|
||
| pGrid->scale(Beats::THREEFOURTHS); | ||
| EXPECT_DOUBLE_EQ(bpm / 2, pGrid->getBpm()); |
There was a problem hiding this comment.
This should be
EXPECT_DOUBLE_EQ(bpm * 3 / 4, pGrid->getBpm());
| EXPECT_DOUBLE_EQ(bpm * 2 / 3, pMap->getBpm()); | ||
|
|
||
| pMap->scale(Beats::THREEHALVES); | ||
| EXPECT_DOUBLE_EQ(bpm * 3 / 2, pMap->getBpm()); |
| EXPECT_DOUBLE_EQ(bpm * 3 / 2, pMap->getBpm()); | ||
|
|
||
| pMap->scale(Beats::THREEFOURTHS); | ||
| EXPECT_DOUBLE_EQ(bpm / 2, pMap->getBpm()); |
| EXPECT_DOUBLE_EQ(bpm / 2, pMap->getBpm()); | ||
|
|
||
| pMap->scale(Beats::FOURTHIRDS); | ||
| EXPECT_DOUBLE_EQ(bpm * 4 / 3, pMap->getBpm()); |
rryan
left a comment
There was a problem hiding this comment.
Nice, looks good. Now we can wait on Travis to make sure the tests pass there.
|
Hm, doh - looks like you need to define scaleQuadruple in src/track/beatmap.h around line 103. |
|
I didn't even know this feature existed... Why not expose some or all of the buttons in the main GUI? |
|
@rryan Oh it was late, should have noticed myself. Fixed in a minute. |
Oh right, I didn't realize they were available from the mouse context menu as well. I meant in the currently playing deck... For example in Deere, when you click the current bpm number, it expands to give you a bunch of bpm related options. It makes sense to put them there... I'm pretty sure Traktor had this when I used it years ago. |
|
Would be useful. But I don't know how to create a CO from the above code. |
| int distance = it->frame_position() - prevBeat.frame_position(); | ||
| Beat beat; | ||
| for (i=1; i<=3, i++;) { | ||
| for (int i=1; i<=3, i++;) { |
There was a problem hiding this comment.
oops, should be:
for (int i = 1; i <= 3; i++) {
There was a problem hiding this comment.
yes, already fixed it after travis failed for the 3rd time ;)
The semicolon should be there at the end, shouldn't it? Ok, not in C++
fixing once more
There was a problem hiding this comment.
Previous conversions appear in the manual (p43). Necessary to update this after merge?
There was a problem hiding this comment.
Good point -- it would be great if you submit a PR to update the manual too!
https://github.com/mixxxdj/manual
|
Hope it's ready now |
| // Need to not accrue fractional frames. | ||
| int distance = it->frame_position() - prevBeat.frame_position(); | ||
| Beat beat; | ||
| for (int i=1; i<=3, i++) { |
There was a problem hiding this comment.
Not quite :). If you replace this line with exactly what I write it will work:
for (int i = 1; i <= 3; i++) {
There was a problem hiding this comment.
Damn..spaces!
Okay, once more. Appreciate your patience!
There was a problem hiding this comment.
The spaces are optional, but the initialization, the comparison, and the increment need to be separated with semicolons (not commas). Looks good now!
|
Looks like the tests are hanging -- I'll go ahead and merge then fix in master. Thanks @ronso0 ! |
|
Thank you. |
Fixing my wishlist bug https://bugs.launchpad.net/mixxx/+bug/1462350
Adding two conversions that one might guess when detected BPM is far from the user estimated BPM. Basically these are the two I came across when beat analysis was wrong on some Drumfunk/Breakbeat tracks. There could be numerous more, but as @daschuer points out: it's hard to know that one needs a 7/8 conversion. So these are sufficient, I suppose.