Skip to content
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

"duration" is an integer, should be double #8229

Closed
mixxxbot opened this issue Aug 22, 2022 · 16 comments
Closed

"duration" is an integer, should be double #8229

mixxxbot opened this issue Aug 22, 2022 · 16 comments

Comments

@mixxxbot
Copy link
Collaborator

Reported by: DJChloe
Date: 2015-09-18T09:18:56Z
Status: Fix Released
Importance: Wishlist
Launchpad Issue: lp1497183
Tags: easy, metadata


Summary :
The Mixxx control value "duration" gives a rounded integer value

We need :
the actual "duration" value as a real number (400 milliseconds difference is 1 beat !)

"duration should be equal to =track_samples/track_sample_rate/2 (real value) "/2" because stereo

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-18T10:13:39Z


As a workaround, you can use
"track_samples" and "track_samplerate"

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-24T18:30:15Z


If you like, you can fix it your self.

int getDuration() const;

you can make it a double, all ControlObjects are double anyway.
But you need to track where this value is used and if the fractions of a second didn’t do bad things.

Our general bugfix workflow is described here:
http://www.mixxx.org/wiki/doku.php/bugfix_workflow

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-27T20:27:43Z


hum, something clear is missing here daniel :
http://www.mixxx.org/wiki/doku.php/bugfix_workflow

are you sure it is the good link ?

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-27T21:12:10Z


Majors problems for me :

  1. a bit lost in the Mixx code
  2. I did not program in C since ages. I am a Delphi developper girl
  3. I am not used to gitub

Hey, I have some limits :/

Anyway, I will try to understand everything, but the bugfix workflow page is gone somewhere in the Twilight Zone ! :D

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-27T21:27:30Z


hannnnnn.... I understood something reading the source code !!!!
The duration given is the duration given by the tags of the file , wich is an integer.

Soooo it's better to leave as it is.

But what is interesting and not dociumented is that we have a property available : "Channels", that provide us the info to know if our track is Stereo or not.

Therefore we can return a real value for the duration like that :
real_duration==track_samples/track_sample_rate/channels

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-27T21:28:08Z


The page was hijacked, now the original content is back.

Majors problems for me ....

If you still have fun to take these challenges, go ahead, I will try to give you a help if yo ask.

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-27T21:50:24Z


Thank you Daniel, but they are not priorities since they can be get around without problem.
In my list of bug I have one very serious, and 3 that are a bit annoying :

The very serious one is this one (and I think it is urgent and critical since it can resolve a bunch of issues that might be related to it) :
https://bugs.launchpad.net/mixxx/+bug/1499738

The two annoying :
https://bugs.launchpad.net/mixxx/+bug/1498868 (those two permitted me to discover the serious one)
https://bugs.launchpad.net/mixxx/+bug/1498960

https://bugs.launchpad.net/mixxx/+bug/1498134 (this one is diferent, but can get around)

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-27T21:55:35Z


After the track is loaded, to the player, TrackInfo::m_duration is updated with the real value, which is sample precise. The "duration" ControlObject is set from this real value. A ControlObject is always of type double, so it might make sense to use double precision here. But as said, we need to make sure not to introduce any regression.
And if you have an other workaround ....

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-27T22:25:48Z


Yes, the workaround is that in midi scripting we have accesss to the track_samples and track_sample_rate value

We could expose the Channels value without any drawback for everything else, so that we could get in MIDI scripting our value like that :


MyController.getduration = function(group) {
       var track_samples         = engine.getValue(group,"track_samples");
       var track_sample_rate = engine.getValue(group,"track_samplerate");
       var track_channels       = engine.getValue(group,"channels"); 
	return  track_samples/track_sample_rate/channels; 
};

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-28T07:29:18Z


Yes, this will work for me as well. We should call it "track_channels", since a deck has currently always two channels.
And even without the channel value, you should be able to guess the value of channels.

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-09-28T13:16:20Z


"And even without the channel value, you should be able to guess the value of channels."

Ho yes we can guess the value of channel, 99% of the time it will be Stereo.
But for the 1% left, the Midi script is not able to guess that the provided track is mono.

For mp3, I don't know if Mono audio exist (I think not), but for PCM wav file, yes, for sure.

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-09-28T18:33:25Z


If "duration" is 3:30 and "track_samples / track_sample_rate / 2" is 1:15:3 we have a mono track. :-)

@mixxxbot
Copy link
Collaborator Author

Commented by: DJChloe
Date: 2015-11-16T10:14:33Z


This is good! Nice trick!

@mixxxbot
Copy link
Collaborator Author

Commented by: daschuer
Date: 2015-11-16T11:06:59Z


Taglib 1.10 supports finer duration values. We should update Mixxx accordingly.

@mixxxbot
Copy link
Collaborator Author

Commented by: uklotzde
Date: 2016-06-25T08:22:07Z


#970

@mixxxbot
Copy link
Collaborator Author

Issue closed with status Fix Released.

@mixxxbot mixxxbot transferred this issue from another repository Aug 24, 2022
@mixxxbot mixxxbot added this to the 2.1.0 milestone Aug 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant