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

Add command for clearing waveform to track's context menu #1197

Merged
merged 5 commits into from
Mar 30, 2017

Conversation

ninomp
Copy link
Contributor

@ninomp ninomp commented Feb 27, 2017

This PR is aiming to fix https://bugs.launchpad.net/mixxx/+bug/1014449

This is a continuation of #841.

Copy link
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 for coming back to this.
Your changes are looking reasonable.
Is the original issue from https://github.com/mixxxdj/mixxx/pull/841gone by the new strategy?

Did you consider the situation if the analysis is running during clear?

} else {
// Null waveform pointer means waveform was cleared.
if (m_pWaveformSourceImage) {
delete m_pWaveformSourceImage;
Copy link
Member

Choose a reason for hiding this comment

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

The ownership of m_pWaveformSourceImage is unclear. This is not your fault, but we should fix it here, because this PR builds on top of this situation.
I think the best solution is to move m_pWaveformSourceImage into the inherited classes and put it into a std::unique_ptr
this WOverview should have a abstract virtual void invalidateImage() = 0, that is then implemented in the Inherited classes to actually clear the Image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have decided to take a (slightly) different approach with this and make this QImage statically allocated (like m_waveformImageScaled is). I hope you don't mind. 😃

if (!pTrack) {
continue;
}
analysisDao.deleteAnalysesForTrack(pTrack->getId());
Copy link
Member

Choose a reason for hiding this comment

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

Will this delete the all analysis data?
I think we should rethink the use-cases for "ClearWaveform" and name this feature accordingly.
IMHO clearing all analysis makes sense if the use-case is, that the track samples have changed.
In this case all position related data is invalid.
What will happen with cue points?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Uhm Well, by looking at the AnalysisDao code, AnalysisDao is used just for storing waveforms, so this indeed is only clearing track's waveforms.


void WWaveformViewer::slotWaveformUpdated() {
if (m_waveformWidget) {
m_waveformWidget->setTrack(m_waveformWidget->getTrackInfo());
Copy link
Member

Choose a reason for hiding this comment

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

What dos this line? Can we replace it by a member function with a nice name?


if (pNewTrack) {
connect(pNewTrack.get(), SIGNAL(waveformUpdated()),
this, SLOT(slotWaveformUpdated()));
Copy link
Member

Choose a reason for hiding this comment

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

the track was just cleared above. Can we move this to slotTrackLoaded, to keep symmetry?

@Be-ing
Copy link
Contributor

Be-ing commented Mar 5, 2017

The track context menu is already enormous. Let's not add anything else to it. Perhaps this should go in the track Properties dialog somewhere.

@ronso0
Copy link
Member

ronso0 commented Mar 5, 2017

The track context menu is already enormous. Let's not add anything else to it. Perhaps this should go in the track Properties dialog somewhere.

I see what you mean, but here's a use case where it would be great to have 'Clear Waveform' button handy, maybe below 'Reset Replay Gain':
I have a large library where most of the tracks were analyzed by mixxx <=2.0, so I stumble across displaced waveforms quite often. It would be easy to throw those tracks into a temporary crate, then mark all & click "Clear Waveform" instead of going to each tracks Properties.

To clean up the track context menu, all AutoDJ entries could go to a submenu.
'Reset Play Count' could go to track Properties, I'd say.

@Be-ing
Copy link
Contributor

Be-ing commented Mar 6, 2017

I understand your point about the usefulness of having this in the track context menu. I think the context menu could be cleaned up by moving what is in each divider into a submenu.

@@ -49,8 +49,6 @@ private slots:
m_waveformWidget = nullptr;
}

void slotWaveformUpdated();
Copy link
Contributor

@Be-ing Be-ing Mar 6, 2017

Choose a reason for hiding this comment

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

Was there an issue with keeping this here? This needs to work for all waveform renderers, not just GLSL.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The thing is that only GLSL renderer was suffering from the issue of not updating the waveform (that is the issue from #841 I couldn't solve then).

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh, okay then. Please add a comment explaining that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done in 399d6c9.

@ninomp
Copy link
Contributor Author

ninomp commented Mar 6, 2017

@daschuer Yes, I have managed to solve the issue from #841. The problem was that WOverview was keeping the old waveform rendered in its m_pWaveformSourceImage and GLSLWaveformRendererSignal was keeping the old waveform in texture.

I tested the scenario of clearing the waveform while analyzer is running. Mixxx does not crash and waveform remains cleared after the analysis is over. I believe this behavior is acceptable. What do you think?

@Be-ing @ronso0 I agree that track context menu is crowded, but I am unsure about which actions to move to sub-menu or track properties dialog.

@ronso0
Copy link
Member

ronso0 commented Mar 6, 2017

I agree that track context menu is crowded, but I am unsure about which actions to move to sub-menu or track properties dialog.

As I said, I'd vote to keep "Clear Waveforms" in context menu for now. A general clean-up could be discussed in another PR, I suppose there are diverse opinions on what's important and what's not ;)

@Be-ing
Copy link
Contributor

Be-ing commented Mar 6, 2017

After this is merged I'll work on cleaning up the context menu and bringing it up when right clicking on WTrackProperty (title and artist text).

@ninomp
Copy link
Contributor Author

ninomp commented Mar 10, 2017

I have addressed all the review comments, so I believe this is done.

@ninomp
Copy link
Contributor Author

ninomp commented Mar 20, 2017

@daschuer Since there has been no activity here in the last 10 days, what is left to do to finish this PR?

@Be-ing
Copy link
Contributor

Be-ing commented Mar 29, 2017

Ping @daschuer. Ready for merge?

@daschuer
Copy link
Member

I hope I find time for his soon.

@daschuer
Copy link
Member

LGTM, and works good as well :-) Thank you.

@daschuer daschuer merged commit e6112fa into mixxxdj:master Mar 30, 2017
// When the track's waveform has been changed (or cleared), it is necessary
// to update (or delete) the texture containing the waveform which was
// uploaded to GPU. Otherwise, previous waveform will be shown.
connect(pTrack.get(), SIGNAL(waveformUpdated()),
Copy link
Member

Choose a reason for hiding this comment

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

What about disconnecting the signal? I think this means clearing a track also reloads the texture for all decks it was loaded in (even if a new track has replaced it).

@esbrandt
Copy link
Contributor

@ninomp
Does this work with latest master?
The Clear waveform just clears the waveform if the track is playing in a deck. Nothing is written to the database, even on shutdown.
I´d expect this feature to delete the cached waveform file from the disk, and to clear the database entry for the waveform.

Am i mistaken how this feature is supposed to work?
Thanks for clarification

@ninomp
Copy link
Contributor Author

ninomp commented Jun 30, 2017

HI @esbrandt. Yes, that is how this is supposed to work. I have just checked and I can confirm that this is not working like it is supposed to. I will try to fix it. Thank you for warning.

@Be-ing
Copy link
Contributor

Be-ing commented Jun 30, 2017

I presume that is a regression caused by the recent work on the database connection handling and analyzers:
#1276, #1282, #1285, #1289

@esbrandt
Copy link
Contributor

Thanks for the update, looking forward to the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants