Skip to content

Adjust ReplayGain: Allow user to update the replaygain value based on a deck pregain value.#4031

Merged
uklotzde merged 10 commits intomixxxdj:mainfrom
ywwg:update-replaygain
Jul 28, 2021
Merged

Adjust ReplayGain: Allow user to update the replaygain value based on a deck pregain value.#4031
uklotzde merged 10 commits intomixxxdj:mainfrom
ywwg:update-replaygain

Conversation

@ywwg
Copy link
Copy Markdown
Member

@ywwg ywwg commented Jun 28, 2021

Currently accessible by right clicking loaded decks, including preview deck.

Also accessible through a new a new per-deck control pushbutton: "[ChannelX]", "update_replaygain_from_pregain". When pressed, the pregain of the associated deck is applied to the replaygain value.

@github-actions github-actions Bot added the ui label Jun 28, 2021
@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jun 28, 2021

Thanks for working on this! This feature has been at the back of my to-do list for a long time. WTrackMenu is also used for the right click menu of the library where multiple tracks can be selected. So I think the first commit should be removed and the second one rebased.

@Be-ing Be-ing requested a review from uklotzde June 28, 2021 22:34
@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jun 28, 2021

As for the UI, I think adding this to WTrackMenu is okay, but I'd primarily want to use it by mapping a ControlPushButton on a controller.

Copy link
Copy Markdown
Member

@daschuer daschuer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, in general it looks good. I have added some findings.

Comment thread src/mixer/basetrackplayer.cpp Outdated
Comment thread src/track/track.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
@daschuer
Copy link
Copy Markdown
Member

That does not work if the replay gain value has been reset before.

Comment thread src/mixer/basetrackplayer.cpp
@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 19, 2021

WTrackMenu is also used for the right click menu of the library where multiple tracks can be selected.

in cases where more than one track is selected, TrackModel is set. Currently m_trackPointerList is only initialized in code in a single place, inside loadTrack:

    m_trackPointerList = TrackPointerList{pTrack};

It is never initialized from another list, or ranged, etc. Therefore it's never used by more than one track.

@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 19, 2021

As for the UI, I think adding this to WTrackMenu is okay, but I'd primarily want to use it by mapping a ControlPushButton on a controller.

A track can be loaded in more than one deck -- either the button would have to be per-deck, or we would have to guess which pregain the user meant to use as a reference. How would you want to bind the button?

@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jul 19, 2021

Give each deck a ControlPushButton.

@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jul 19, 2021

in cases where more than one track is selected, TrackModel is set.

Ah, in that case m_trackIndexList is used rather than m_trackPointerList, so I think it may be okay to replace m_trackPointerList with a singular TrackPointer. I'd like to hear @uklotzde's thoughts on this.

Comment thread src/track/replaygain.h Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
@uklotzde
Copy link
Copy Markdown
Contributor

uklotzde commented Jul 19, 2021

in cases where more than one track is selected, TrackModel is set.

Ah, in that case m_trackIndexList is used rather than m_trackPointerList, so I think it may be okay to replace m_trackPointerList with a singular TrackPointer. I'd like to hear @uklotzde's thoughts on this.

I wonder why this over-engineering has not been detected yet?! It should better be changed in a separate, preliminary PR.

@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 19, 2021

I wonder why this over-engineering has not been detected yet?! It should better be changed in a separate, preliminary PR.

is the commit wrong as-is? It will be annoying to strip out of this PR, but I'd like to have an actual reason to do so.

@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jul 19, 2021

is the commit wrong as-is? It will be annoying to strip out of this PR, but I'd like to have an actual reason to do so.

I agree, let's not be pedantic about splitting up the PR. As long as it's in a cleanly separate commit I think it's fine.

@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 19, 2021

The Real Problem™ is that wtrackmenu should not store important state in one of two places (a model or a pointer). So I could understand this commit as being unnecessary / wasted effort if someone else is going to go through and clean up the file to be consistent. HOWEVER, the change as written is strictly an improvement -- it removes a lot of unused / dead code and leaves things in a more understandable state.

@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 19, 2021

@Be-ing I added pushbuttons, can you test to see if they work as you hope?

@coveralls
Copy link
Copy Markdown

coveralls commented Jul 20, 2021

Pull Request Test Coverage Report for Build 1071599741

  • 25 of 70 (35.71%) changed or added relevant lines in 3 files are covered.
  • 20 unchanged lines in 4 files lost coverage.
  • Overall coverage increased (+0.01%) to 28.624%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/mixer/basetrackplayer.cpp 17 22 77.27%
src/widget/wtrackmenu.cpp 0 40 0.0%
Files with Coverage Reduction New Missed Lines %
src/engine/cachingreader/cachingreaderworker.cpp 2 63.48%
src/widget/wtrackmenu.cpp 2 0%
src/mixxxapplication.cpp 7 75.0%
src/engine/cachingreader/cachingreader.cpp 9 71.38%
Totals Coverage Status
Change from base Build 1065232258: 0.01%
Covered Lines: 20104
Relevant Lines: 70234

💛 - Coveralls

m_pPitchAdjust = make_parented<ControlProxy>(getGroup(), "pitch_adjust", this);

m_pUpdateReplayGainFromDeckGain = std::make_unique<ControlPushButton>(
ConfigKey(getGroup(), "update_replaygain_from_pregain"));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is quite a verbose name for a ControlObject... how about just update_replaygain... or set_replaygain? store_replaygain?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like the name. Our other CO names are often extremely ambiguous (so this PR introduces inconsistency 😅). You suggestions sound like I can set a the replaygain value directly, not like a button CO that takes only 1 and 0.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah I don't know how to make it shorter and include the ideas of both the deck pregain and the track replaygain. "apply_pregain_to_replaygain" ?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see how to remove any more words without making it confusing, and I don't think we have any limitations on CO name length

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't thought of any better name, so... 🤷 I won't object to merging this over finding a better name.

@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jul 20, 2021

This works, yay! I used it to manually set the ReplayGain for a track which I remembered to play way louder than others. The automatic reset of the gain knob to unity was surprising at first but I think it makes sense.

@Be-ing Be-ing closed this Jul 20, 2021
@Be-ing
Copy link
Copy Markdown
Contributor

Be-ing commented Jul 20, 2021

Auuuugh the "close and comment" strikes again...

@Be-ing Be-ing reopened this Jul 20, 2021
@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Jul 20, 2021

yaij, finally a co for this!
I don't have unmapped buttons anymore so I'll probably map it to Shift+gain knob: the first incoming value triggers the gain adoption (within 2 seconds following values are ignored), then I center the knob, release shift. voila, replay gain adjusted, knob sync'ed.

@ywwg ywwg requested review from daschuer and uklotzde July 21, 2021 02:59
@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 21, 2021

I believe all comments are addressed

@ronso0
Copy link
Copy Markdown
Member

ronso0 commented Jul 21, 2021

@ywwg Please document the behaviour and the new CO in the PR decription.
Later on we also need to add it to the manual https://manual.mixxx.org/2.4/en/chapters/appendix/mixxx_controls.html#decks-preview-decks-and-samplers

Comment thread src/widget/wtrackmenu.cpp
Comment thread src/widget/wtrackmenu.cpp
Comment thread src/widget/wtrackmenu.cpp Outdated
Comment thread src/widget/wtrackmenu.cpp Outdated
@ywwg ywwg force-pushed the update-replaygain branch from 3f74538 to a7a49d0 Compare July 21, 2021 21:36
Comment thread src/track/track.h Outdated
Comment thread src/widget/wtrackmenu.h Outdated
@uklotzde
Copy link
Copy Markdown
Contributor

Merge now or after the manual has been updated?

@uklotzde
Copy link
Copy Markdown
Contributor

@ywwg Please create and link a PR for the manual, then we can merge.

@Holzhaus
Copy link
Copy Markdown
Member

Not a blocker for merge, but coveralls points out that a bunch of lines are not covered by any test:

  • 4 of 70 (5.71%) changed or added relevant lines in 3 files are covered.
  • 116 unchanged lines in 6 files lost coverage..
  • Overall coverage decreased (-0.005%) to 28.621%

Would be nice to add a test for this.

@ywwg ywwg added the changelog This PR should be included in the changelog label Jul 27, 2021
@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 27, 2021

Added a test. Manual PR: mixxxdj/manual#417

@ywwg
Copy link
Copy Markdown
Member Author

ywwg commented Jul 28, 2021

PR appears to be approved -- who wants to merge?

@uklotzde
Copy link
Copy Markdown
Contributor

Thank you! LGTM

@uklotzde uklotzde merged commit 460f3a8 into mixxxdj:main Jul 28, 2021
@uklotzde
Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog This PR should be included in the changelog code quality ui

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants