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
Enhance precision of track duration #970
Conversation
Requires TagLib v1.10 or newer.
Ubuntu 14.04 only provides TagLib 1.9.x
m_nextTransitionTime = math_min(m_iTransitionTime, | ||
fromTrackDuration / 2); | ||
m_nextTransitionTime = math_min(m_transitionTime, | ||
fromTrackDuration / 2.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.
A Pentium is able to divide a float by an integer. No need for .0 here.
pTrackMetadata->setBitrate(audioProperties.bitrate()); | ||
#if TAGLIB_HAS_LENGTH_IN_MILLISECONDS | ||
double duration = audioProperties.lengthInMilliseconds() / 1000.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.
ähh * 1000.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.
ups :-*
Thank you for adopting this. Even though a sqlite column is marked at int, you are able to store a real value. I have just checked. You are able to store 90.5 in the old duration column. It is read as 91 in current Mixxx. If you store 90.49 it is read as 90. The question is, can't we just ignore the "interger recommendation" and continue the original duration column? What do you think? |
I think it's safe to ignore the integer recommendation -- SQLite wouldn't be able to change that without breaking backwards compatibility so we don't have to worry that they will in the future I think. It would be nice to not have the deprecated column. |
For newly created DB files use the correct type for the schema. Existing DB files are backwards compatible according to the documentation: https://www.sqlite.org/datatype3.html "Any column in an SQLite version 3 database, except an INTEGER PRIMARY KEY column, may be used to store a value of any storage class."
Thanks for the hint, Daniel! Let's reuse the existing column, it's even https://www.sqlite.org/datatype3.html On 25.06.2016 19:33, Daniel Schürmann wrote:
|
@@ -1279,7 +1279,7 @@ TrackPointer TrackDAO::getTrackFromDB(TrackId trackId) const { | |||
{ "rating", setTrackRating }, | |||
{ "comment", setTrackComment }, | |||
{ "url", setTrackUrl }, | |||
{ "duration", setTrackDuration }, | |||
{ "duration_real", setTrackDuration }, |
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.
leftover
That was fast :-) Thank you very much! LGTM |
I believe this work-around is no longer necessary after this bug was fixed: https://bugs.launchpad.net/mixxx/+bug/1497183 in mixxxdj#970
I believe this work-around is no longer necessary after this bug was fixed: https://bugs.launchpad.net/mixxx/+bug/1497183 in mixxxdj#970
I believe this work-around is no longer necessary after this bug was fixed: https://bugs.launchpad.net/mixxx/+bug/1497183 in mixxxdj#970
Launchpad
https://bugs.launchpad.net/mixxx/+bug/1497183
Track Property
Changed the data type of this property. In JavaScript it's a number and and control objects are always double.
DB Column
Since the existing DB column 'duration' cannot be deleted a new column 'duration_real' that gets it's default value from 'duration' is added. Both columns are written, but only the new column is read.
Util Classes
I've moved the formatting of duration values into util/duration.h. The header util/time.h caused naming conflicts with system headers when included in track/track.h. I don't wanted to fix this now. We should think about enclosing more classes in namespace 'mixxx'. I've used 'Mixxx' in the past, but lower case names are more common for C++. The namespace fixes will be part of a following PR