Skip to content

AutoDJProcessor refactoring and split into separate files - #16050

Open
fonsargo wants to merge 17 commits into
mixxxdj:mainfrom
fonsargo:autodj-refactoring
Open

AutoDJProcessor refactoring and split into separate files#16050
fonsargo wants to merge 17 commits into
mixxxdj:mainfrom
fonsargo:autodj-refactoring

Conversation

@fonsargo

Copy link
Copy Markdown
Contributor

This MR is all refactorings from #13183 carefully cherry-picked by me. I also removed some leftovers from new feature, so this MR doesn't contain anything new at all.

Main changes:

  • Add new abstractions like TrackOrDeckAttributes, FadeableTrackOrDeckAttributes, TrackAttributes
  • Extract logic from calculateTransition() to calculateTransitionImpl()
  • Rename some variables
  • Fix spelling and grammar errors

cr7pt0gr4ph7 and others added 10 commits February 17, 2026 21:57
This is a first step in generalizing the transition logic in
AutoDJProcessor to enable it to also be applied to tracks in
the queue instead of just the current decks.
This is another step in generalizing the transition logic
in AutoDJProcessor to enable calculating transition times
for the whole queue.
This is the final step in generalizing the core transition timing
logic in AutoDJProcessor, so that it can be applied to a whole
playlist instead of just the current decks.

@acolombier acolombier left a comment

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.

Thank you for turning the situation around!
I have shared a first pass of review and will let @daschuer do the final one as he raised elements of the rebased PR.

Comment thread src/library/autodj/track/deckattributes.h Outdated
Comment thread src/library/autodj/track/deckattributes.h Outdated
Comment thread src/library/autodj/track/deckattributes.h Outdated
Comment thread src/library/autodj/track/deckattributes.cpp Outdated
ControlProxy m_trackSamples;
ControlProxy m_sampleRate;
ControlProxy m_rateRatio;
BaseTrackPlayer* m_pPlayer;

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.

We aim to avoid fat pointer, is there any chance to use smart pointer? Note that you may also consider our parented_ptr wrapper that ensure that fat pointer are at least parented, and thus would be deallocated when their parent is released.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

To be honest I don't know how to answer to this question. The object is created and parented in PlayerManager.
I am not the owner of its lifetime. However if we want to avoid pointer here, then it requires a lot of refactoring.

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.

Right, that makes sense. In this case you can use parented_ptr. The crux of it is here. It is basically a thin layer, which will help us to catch memory leak in case in changes is done in PlayerManager.
For you, it should change anything: you can dereference it like a pointer and nothing will happen to it (e.g auto dealloc)

Just the following change should be enough to use this wrapper:

Suggested change
BaseTrackPlayer* m_pPlayer;
parented_ptr<BaseTrackPlayer> m_pPlayer;

@fonsargo fonsargo Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Check, got it! I changed fat pointer to parented ptr as you suggested and replaced

return m_pPlayer != nullptr ? m_pPlayer->getLoadedTrack() : TrackPointer();

with

return m_pPlayer ? m_pPlayer->getLoadedTrack() : TrackPointer();

in DeckAttributes::getLoadedTrack(). I think it should work.

Comment thread src/library/autodj/track/fadeabletrackordeckattributes.h Outdated
Comment thread src/library/autodj/track/trackattributes.h Outdated
Comment thread src/library/autodj/autodjconstants.h Outdated
Comment thread src/library/autodj/autodjprocessor.cpp
@acolombier
acolombier requested a review from daschuer February 27, 2026 19:38

@acolombier acolombier left a comment

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.

Thanks for addressing the feedback - I spotted one miss on my end.

Comment thread src/library/autodj/autodjprocessor.h Outdated
Comment on lines +168 to +169
FadeableTrackOrDeckAttributes& fromTrack,
FadeableTrackOrDeckAttributes& toTrack,

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.

Let's apply the const-correctness principle here too.

Suggested change
FadeableTrackOrDeckAttributes& fromTrack,
FadeableTrackOrDeckAttributes& toTrack,
const FadeableTrackOrDeckAttributes& fromTrack,
const FadeableTrackOrDeckAttributes& toTrack,

In case you need them to remain mutable, you should keep the fat pointers

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Changed it back to fat pointers according to the const-correctness principle.

@fonsargo

Copy link
Copy Markdown
Contributor Author

I've fixed compile error for other platforms (somehow on Windows it worked fine), however now I see that build is failing for Android 15 (before that it was green 🤔 ). Any suggestions how to fix it?

@btoplak

btoplak commented Apr 8, 2026

Copy link
Copy Markdown

I've fixed compile error for other platforms (somehow on Windows it worked fine), however now I see that build is failing for Android 15 (before that it was green 🤔 ). Any suggestions how to fix it?

I can't promise anything cause I'm busy rn, but if I get some free time this weekend I'll download your fork and try to build it, maybe I get some ideas...

@fonsargo

fonsargo commented Apr 9, 2026

Copy link
Copy Markdown
Contributor Author

@btoplak I guess it's not connected with the changes, maybe I just need to rebase the branch. I'll try it when I have some time

@github-actions

Copy link
Copy Markdown

This PR is marked as stale because it has been open 90 days with no activity.

@github-actions github-actions Bot added the stale Stale issues that haven't been updated for a long time. label Jul 11, 2026
@cr7pt0gr4ph7

cr7pt0gr4ph7 commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

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

Labels

autodj build library stale Stale issues that haven't been updated for a long time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants