Default dur from presetCycleTime.
This commit is contained in:
parent
c58ad64a28
commit
f632ef0de8
@ -35,6 +35,7 @@ void shufflePlaylist() {
|
|||||||
DEBUG_PRINTLN(F("Playlist shuffle."));
|
DEBUG_PRINTLN(F("Playlist shuffle."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void unloadPlaylist() {
|
void unloadPlaylist() {
|
||||||
if (playlistEntries != nullptr) {
|
if (playlistEntries != nullptr) {
|
||||||
delete[] playlistEntries;
|
delete[] playlistEntries;
|
||||||
@ -45,6 +46,7 @@ void unloadPlaylist() {
|
|||||||
DEBUG_PRINTLN(F("Playlist unloaded."));
|
DEBUG_PRINTLN(F("Playlist unloaded."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void loadPlaylist(JsonObject playlistObj) {
|
void loadPlaylist(JsonObject playlistObj) {
|
||||||
unloadPlaylist();
|
unloadPlaylist();
|
||||||
|
|
||||||
@ -52,6 +54,7 @@ void loadPlaylist(JsonObject playlistObj) {
|
|||||||
playlistLen = presets.size();
|
playlistLen = presets.size();
|
||||||
if (playlistLen == 0) return;
|
if (playlistLen == 0) return;
|
||||||
if (playlistLen > 100) playlistLen = 100;
|
if (playlistLen > 100) playlistLen = 100;
|
||||||
|
|
||||||
playlistEntries = new PlaylistEntry[playlistLen];
|
playlistEntries = new PlaylistEntry[playlistLen];
|
||||||
if (playlistEntries == nullptr) return;
|
if (playlistEntries == nullptr) return;
|
||||||
|
|
||||||
@ -70,7 +73,7 @@ void loadPlaylist(JsonObject playlistObj) {
|
|||||||
} else {
|
} else {
|
||||||
for (int dur : durations) {
|
for (int dur : durations) {
|
||||||
if (it >= playlistLen) break;
|
if (it >= playlistLen) break;
|
||||||
playlistEntries[it].dur = dur;
|
playlistEntries[it].dur = (dur > 0) ? dur : presetCycleTime;
|
||||||
it++;
|
it++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -117,16 +120,13 @@ void handlePlaylist() {
|
|||||||
// playlist roll-over
|
// playlist roll-over
|
||||||
if (!playlistIndex) {
|
if (!playlistIndex) {
|
||||||
// playlistRepeat < 0 => endless loop
|
// playlistRepeat < 0 => endless loop
|
||||||
if (playlistRepeat > 0) playlistRepeat--; // decrease repeat count on each index reset if not an endless playlist
|
if (playlistRepeat > 0) playlistRepeat--; // decrease repeat count on each index reset if not an endless playlist
|
||||||
if (playlistRepeat < -1) { // playlistRepeat < -1 => with shuffling presets
|
if (playlistRepeat < -1) shufflePlaylist(); // shuffle playlist and start over
|
||||||
shufflePlaylist(); // shuffle playlist and start over
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jsonTransitionOnce = true;
|
jsonTransitionOnce = true;
|
||||||
transitionDelayTemp = playlistEntries[playlistIndex].tr * 100;
|
transitionDelayTemp = playlistEntries[playlistIndex].tr * 100;
|
||||||
playlistEntryDur = playlistEntries[playlistIndex].dur;
|
playlistEntryDur = playlistEntries[playlistIndex].dur;
|
||||||
if (playlistEntryDur == 0) playlistEntryDur = 10;
|
|
||||||
applyPreset(playlistEntries[playlistIndex].preset);
|
applyPreset(playlistEntries[playlistIndex].preset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user