-
-
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
Visualize distance to a key when pitch shifting #215
Conversation
…in a QPair object
…displaying the same value for both loaded tracks. Haven't figured out how to solve this
Thank you for the pull request. The visual_key is connected via skins Currently there is only one CO display connection allowed. So you may introduce a separate Key distance widget or just introduce a new "visual_key_float" or just make "visual_key" a float. If we are sure we don't need the discrete key value, I would go the way to add th fraction of a key to the visual_key. This would clean up the code a lot. But be care full if overflows occurs. There was a related discussion in #47 @rryan, do we the integer nature of visual_key? |
From the programmatic point of view having a spitted CO for value and fraction break the atomic nature of the CO, because you cant be sure if the two values read from the CO belong together. |
I am not our skin artist, but IMHO we should remove the parentheses and separate key and cent by a space. |
This PR uncovers an other issue: It is very hard to set the pitch slider to a full key. |
visual_key should remain an integer -- the overflow issues aren't worth complicating things. WKey is a dedicated key display widget so it's fine to (e.g. just like WNumberPos and WNumberRate) use multiple controls. You could introduce a float tonic control and a bool major/minor control for use in this widget. |
IMHO the overflow issue is not that hard, so my vote is for add a "visual_key_float" this keeps the atomic nature of the data. For a possible interpretation see #47 (comment) |
What should I further do to this PR? As @daschuer suggested, maybe we should remove the parentheses. Here are some possible formats. |
The atomic update issue isn't worth worrying about. These controls are typically used for display. If that was really an issue then the key control shouldn't exist at all and client code should just calculate the effective key directly from file_key and pitch. |
As for formatting, the widget should support a format string so the skinner controls it. |
Rendering the cents as text isn't worth the pixels for such a low-value piece of information -- @badescunicu what about coloring the background or painting a bar across the widget that indicates how close you are? |
Actually, WKey shouldn't do this by default or at least it should be disable-able via the skin. Any skin with high production value isn't going to put this in there as text and will want a visual way to represent it. In order to do that, we need a potmeter CO that represents the distance to the key (not a key + fraction CO, just the -1 to 1 fraction). That way you can create a WDisplay widget to represent the distance and put a WKey widget positioned over it to render the key text. |
(key_changes_scaled > 0 ? 0.5 : -0.5)); | ||
|
||
return scaleKeySteps(key, key_changes); | ||
// Distance to the nearest key in cents | ||
int cents = static_cast<int>((key_changes_scaled - key_changes) * 100); |
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.
Instead of providing cents and rounding off the precision I think you should just keep this as a fraction in floating point.
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.
(because units and round-off should be decided by the caller of this utility function)
Hi Nicu, sorry for the discussion here. We should have clarify this in the bug report. But we must get a conclusion now. First the answer to your question: I like the last version most. RJs: Potentiometer Idea might be the best solution but is also the most work. For this we really need the a pure distance CO like your "visual_key_distance". Proposal:
All other Ideas should be issued in a separate bug and pull request. @RJ and @badescunicu Is this Ok? |
Not sure what you mean -- it's like 3 lines of code.
That's it. Now skinners can make |
Or really, it's -0.5 to 0.5 because whenever the value is greater than 0.5 it wraps around. |
Eh, no please don't. Units and formatting is a display concern. If WKey will have the option to show cents, it should calculate them there. |
I don't believe it's worth the pixels and given the resolution of our detector it's over-promising to the user to tell them that we know the cents here. @esbrandt will likely want the display option to indicate with a subtle overlay or some kind. Kind of like the phase meter in Traktor. |
Ooh, I'm actually imagining a circular key distance meter that wraps around WKey. That would look cool :). |
+1 |
Hmm, i really don't have my mind made up here. But maybe i`mistaken what this PR actually does. On Mar 31, 2014, at 6:25 PM, RJ Ryan notifications@github.com wrote:
|
So display the circle of fifth? On Mar 31, 2014, at 6:39 PM, kain88-de notifications@github.com wrote:
|
@esbrandt -- for some context: In master today:
This PR should add a control that tells you the current distance (either -0.5 to 0.5 out of tune from the current closest key, where 0 is right in tune). That way, you could use WDisplay to make a series of pixmaps that represent the range -0.5 to 0.5. I'm thinking of a transparent image with a grey circle slice -- like the knobs in Shade. 0 is repesented as no displaying color. If you are out of tune the amount out of tune is represented by the circle (as in Shade, the amount the knob is turned is represented by the circle). A WKey widget could be centered in the same position as the WDisplay widget but on top of it so that the key text is drawn in the center of the circle. This would not waste any additional pixels but still inform you of the distance away from the current closest key. |
Yes, of cause. Once we have a "visual_key_distance" CO of potentiometer nature it is done for
This is also fine. Actually the unit is "Key" or "semitone" (100c) in this case. By the way: What is the reason for -0.5 to 0.5 (100c) Scale)? For me the 1c scale is more natural. |
OK guys , we are running out of time, and Nicu needs a conclusion. The is still nothing against my first proposal as intermediate step, isn't it? If this is wrong, we need a new proposal! |
A cent isn't really meaningful in equal-temperament. It's simply a scaling of a ratio by 100 -- a per-cent. If we're not going to show cents in our UI, why should a CO be measured in them? But I really don't care if it's -0.5 to 0.5 or -50 to 50. It just feels arbitrary when you effectively have a ratio to multiply it by 100. I don't think anything beyond the CO is necessary for the official Mixxx skins but an XML option to WKey to show the distance in cents is fine. |
From what I've understood, I have to turn EngineKeyDistance into a ControlPotmeter and keep the cents value as a double, as @rryan suggested here (#215 (comment)). However, I'm not sure what I should change in wkey.cpp. |
Yes, right. |
…nce and store the cent difference as a double
I did the back end modifications. Let me know what I should do on the WKey side. |
@badescunicu looks good! The last thing is that WKey should take an option in it's setup() method. (Over-ride it from WLabel but make sure to call
And then all the skinner will have to do is put a: |
Now it is configurable from the skin. I have noticed an issue: if the name of the track is too long, it overlaps with WKey widget. But I suppose it is all a matter of skin configuration. |
Hi Nicu, sorry for the delay. I have just tested your branch and it works fine. The only thing is that the display is jumpy, in case it changes from one decimal place to two and in case it changes from C to Cb. Do you have an idea to solve? (IMHO this is not an issue to delay the merge) Unfortunately your branch conflicts with master. After you have solved this we can merge. Would you mind to edit this for the new schema? Thank you very much. |
I have fixed the conflicts. However I don't have the rights to edit the wiki. Should I register for an account and edit the schema and control table? |
If you register an account, at the Wiki, you should be able to edit it. |
Visualize distance to a key when pitch shifting
Launchpad link: https://bugs.launchpad.net/mixxx/+bug/1258624