-
-
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
Fix cue points being assigned invalid value of -1.0 #11000
Conversation
Sister fix of #10998 |
verified this fixes the issue with my problem tracks. In very very very rare cases a user might have a cue point set at exactly -1.0 frame, in which case they should right click the track and select Reset / Cue Point and when they create it it will work correctly. |
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.
Great, that looks like a good minimum impact fix.
I have just tested to create a Cue point at a fractional position but without success.
Even though I have such fractional Cue points already in my library. Did we re-add rounding to a full frame when storing cue points at one point?
Got it: The column is set to int and it is read back as int mixxx/src/library/dao/cuedao.cpp Line 46 in 074c938
The maincue is written and read as double: mixxx/src/library/dao/trackdao.cpp Line 1170 in 074c938
mixxx/src/library/dao/trackdao.cpp Line 563 in 074c938
We need to check how a shifted cue is handled in a database round-trip. |
You mean at -0.5 frame = -1.0 sample, right? |
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.
The near -1 cue must not become -1 after reading back from the library.
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.
Code looks good, did not have time to test though.
Cue points are currently written as double and read as int. This PR fixes that so they are read back as doubles. mixxx/src/library/dao/cuedao.cpp Line 172 in b071d6e
|
The toInt was causing this. By changing it to doubles, this is fixed |
The DB schema says the column is an int. If we really want to store fractional cue positions in the DB, we need a schema migration IMHO. I know it works without it, because SQLite does not enforce column types by default, but marking the column as int and then storing a different type is really confusing IMHO. |
yeah I'm ok adding a db schema migration. I think that's out of scope for 2.3 though... I'd prefer to let the schema be broken in that version since it works fine, rather than surprise users with a schema difference in a "stable" version. Is that ok? |
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. The question of the schema migration is orthogonal to this PR, because we already store frictional cues in the in column. Here we only read and fix the wrong int rounding.
@Holzhaus: merge?
We have also the question whether a default is appropriated, moved from: CREATE TABLE IF NOT EXISTS cues (
...
position INTEGER DEFAULT -1 NOT NULL,
length INTEGER DEFAULT 0 NOT NULL,
... I think no, because we will never add a cue with an invalid position, or do I miss something? |
Reading the sqlite docs: https://www.sqlite.org/flextypegood.html The other issue that should also be fixed in this PR that the "length" column should be also read as double. |
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.
Please add a comment at schema.xml and apply the fix to "length" as well.
A good reason for the column migration would be the move from our stereo sample based format to an frame based format. Introducing another lstalkec egacy column for that would be odd. We have also discussed to use sample rate independent format ... Not sure about that though. |
sqlite does not support changing column type: so this migration would require:
Is that really worth the trouble? I think I would prefer to add annotations to the code. Since SQLite is well known for not having strict types, it doesn't seem like a big deal that this is wrong. |
With the update from 2.3 this now just includes the comment in the schema about double values, and the check to ensure cuepoints are not created at exactly -1.0 |
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, Thank you.
Since you have debased anyway, can you rebase this to main and get rid of the not working commit?
Also add a note to the db schema that positions should be doubles even though the schema was defined as Integer. Fixes mixxxdj#10993
Thank you. |
Fixes two issues in cue point creation:
Fixes #10993