-
Notifications
You must be signed in to change notification settings - Fork 121
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
Rework playlist generation #275
Rework playlist generation #275
Conversation
66e850c
to
fc8bce3
Compare
84b0ea9
to
f54107f
Compare
Looks good so far! D [10167] ws[/ws][1] connect Core 1 register dump: Backtrace: 0x400e2351:0x3ffee4a0 0x400e3a2a:0x3ffee950 0x400e3ca7:0x3ffeebf0 0x400e3d73:0x3ffeecb0 0x402255fb:0x3ffeecd0 0x402270c1:0x3ffeecf0 0x40115d25:0x3ffeed40 0x40115d49:0x3ffeed80 0x4020aa7a:0x3ffeeda0 0x4020aaf9:0x3ffeedd0 0x4020b37e:0x3ffeedf0 #0 0x400e2351:0x3ffee4a0 in ArduinoJson::V6213PB2::detail::MemberProxy<ArduinoJson::V6213PB2::JsonObject, char const*>::getOrCreateData() const at .pio/libdeps/lolin_d32_pro_sdmmc_pe/ArduinoJson/src/ArduinoJson/Object/MemberProxy.hpp:54 I assume it's access to gPlayProperties.playlist->size() while playlist is null-pointer (not yet created) |
Yes you are right. Playlist was zeroed by setup() and the creation of a dummy playlist was (propably) lost while I rebased. This commit fixes the problem |
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.
LGTM!
8d9fa2e
to
6282d8e
Compare
6282d8e
to
aae3fcc
Compare
aae3fcc
to
19c3500
Compare
Rename freeMultiCharArray to freePlaylist and specialise it so that it can be used to destroy the content of a playlist. Move all playlist related functions into it's own header
Use std::vector instead of POD char* array so that we do not have to care about memory managment. We still have to take care of the strings in the playlist manually. Make x_malloc more forgiving by prefereing the PSRAM and not enforcing it.
Rework SdCard_pickRandomSubdirectory to fir into the new playlist generator.
a84ea5f
to
dea89a2
Compare
Tested & LGTM! |
Make the TrackQueueDispatcher aware of the new std::vector playlist. Adapt FreeRTOS queue to use Playlist pointers. Improve log output of sorting function.
Fix compile errors when accessing playlist std::vector. Rework the shuffle and sort function to use the std-lib.
Remove the numberOfTracks, since it's redundant with std::vector->size()
Make sure there is always a dummy playlist and move initialization of gPlayProperties into the AudioPlayer Task. Fix formatting issues and the review points - Add guards to prevent access to playlist if pointer is nullptr. This will be improved in PR 2 of 3 by encapsulating playlist and preventing direct access. - remove commented code parts - fix spelling
Comment the logging of invalid files to reduce the log spam. Add logging of the number of ignored files in the playlist generation.
dea89a2
to
6d6a357
Compare
Ah classic me. Typo is fixed. |
This PR updates the generation of the playlist. It changes the container from a char** array to a std::vector<char*> to reduce the housekeeping overhead.
It moves multiple functions to their modern implementations to use the functions provided by stdlib (f.e. randomizing and sorting the playlist).
This is the 1st of 3 PR to move the whole playlist handling to stdlib and modern pointer management.
This PR is not depending on any of the other 2 PRs
For the discussion see: https://forum.espuino.de/t/vorstellung-playlist-optimierung/1890/17