|
|
@ -80,6 +80,10 @@ auto AudioState::emitPlaybackUpdate(bool paused) -> void { |
|
|
|
current.first->start_offset.value_or(0); |
|
|
|
current.first->start_offset.value_or(0); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (position) { |
|
|
|
|
|
|
|
// Update position if the duration has been long enough
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
PlaybackUpdate event{ |
|
|
|
PlaybackUpdate event{ |
|
|
|
.current_track = current.first, |
|
|
|
.current_track = current.first, |
|
|
|
.track_position = position, |
|
|
|
.track_position = position, |
|
|
@ -374,6 +378,27 @@ void AudioState::react(const OutputModeChanged& ev) { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
auto AudioState::updateSavedPosition(std::string uri, uint32_t position) |
|
|
|
|
|
|
|
-> void { |
|
|
|
|
|
|
|
sServices->bg_worker().Dispatch<void>([=]() { |
|
|
|
|
|
|
|
auto db = sServices->database().lock(); |
|
|
|
|
|
|
|
if (!db) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
auto id = db->getTrackID(uri); |
|
|
|
|
|
|
|
if (!id) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
auto track = db->getTrack(*id); |
|
|
|
|
|
|
|
if (!track) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
database::TrackData data = track->data(); |
|
|
|
|
|
|
|
data.last_position = position; |
|
|
|
|
|
|
|
db->setTrackData(*id, data); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
auto AudioState::commitVolume() -> void { |
|
|
|
auto AudioState::commitVolume() -> void { |
|
|
|
auto mode = sServices->nvs().OutputMode(); |
|
|
|
auto mode = sServices->nvs().OutputMode(); |
|
|
|
auto vol = sOutput->GetVolume(); |
|
|
|
auto vol = sOutput->GetVolume(); |
|
|
|