Add command for clearing waveform to track's context menu#1197
Add command for clearing waveform to track's context menu#1197daschuer merged 5 commits intomixxxdj:masterfrom
Conversation
daschuer
left a comment
There was a problem hiding this comment.
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; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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()); |
There was a problem hiding this comment.
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())); |
There was a problem hiding this comment.
the track was just cleared above. Can we move this to slotTrackLoaded, to keep symmetry?
|
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': To clean up the track context menu, all AutoDJ entries could go to a submenu. |
|
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. |
| m_waveformWidget = nullptr; | ||
| } | ||
|
|
||
| void slotWaveformUpdated(); |
There was a problem hiding this comment.
Was there an issue with keeping this here? This needs to work for all waveform renderers, not just GLSL.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
Oh, okay then. Please add a comment explaining that.
|
@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. |
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 ;) |
|
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). |
|
I have addressed all the review comments, so I believe this is done. |
|
@daschuer Since there has been no activity here in the last 10 days, what is left to do to finish this PR? |
|
Ping @daschuer. Ready for merge? |
|
I hope I find time for his soon. |
|
LGTM, and works good as well :-) Thank you. |
| // 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()), |
There was a problem hiding this comment.
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).
|
@ninomp Am i mistaken how this feature is supposed to work? |
|
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. |
|
Thanks for the update, looking forward to the fix. |
This PR is aiming to fix https://bugs.launchpad.net/mixxx/+bug/1014449
This is a continuation of #841.