catchup with cspot "official" - release

This commit is contained in:
philippe44
2023-10-08 17:15:14 -07:00
parent 61f58f9a52
commit 8280bc4903
5 changed files with 56 additions and 49 deletions

View File

@@ -1,3 +1,6 @@
2023-10.07
- catchup with official cspot
2023-10-06
- fix cspot PREV on first track, NEXT on last track and normal ending
- use DMA_AUTO for SPI

View File

@@ -101,8 +101,7 @@ class BellLogger : public bell::AbstractLogger {
gmt_time = localtime(&now_time);
std::cout << std::put_time(gmt_time, "[%H:%M:%S") << '.'
<< std::setfill('0') << std::setw(3) << nowMs.count() << "] ";
}
else {
} else {
gmt_time = gmtime(&now_time);
std::cout << std::put_time(gmt_time, "[%Y-%m-%d %H:%M:%S") << '.'
<< std::setfill('0') << std::setw(3) << nowMs.count() << "] ";

View File

@@ -32,7 +32,8 @@ struct TrackReference;
class TrackPlayer : bell::Task {
public:
// Callback types
typedef std::function<void(std::shared_ptr<QueuedTrack>, bool)> TrackLoadedCallback;
typedef std::function<void(std::shared_ptr<QueuedTrack>, bool)>
TrackLoadedCallback;
typedef std::function<size_t(uint8_t*, size_t, std::string_view)>
DataCallback;
typedef std::function<void()> EOFCallback;

View File

@@ -31,8 +31,10 @@ SpircHandler::SpircHandler(std::shared_ptr<cspot::Context> ctx) {
}
};
auto trackLoadedCallback = [this](std::shared_ptr<QueuedTrack> track, bool paused = false) {
playbackState->setPlaybackState(paused ? PlaybackState::State::Paused : PlaybackState::State::Playing);
auto trackLoadedCallback = [this](std::shared_ptr<QueuedTrack> track,
bool paused = false) {
playbackState->setPlaybackState(paused ? PlaybackState::State::Paused
: PlaybackState::State::Playing);
playbackState->updatePositionMs(track->requestedPosition);
this->notify();

View File

@@ -531,8 +531,10 @@ bool TrackQueue::skipTrack(SkipDirection dir, bool expectNotify) {
std::scoped_lock lock(tracksMutex);
if (dir == SkipDirection::PREV) {
uint64_t position = !playbackState->innerFrame.state.has_position_ms ? 0 :
playbackState->innerFrame.state.position_ms +
uint64_t position =
!playbackState->innerFrame.state.has_position_ms
? 0
: playbackState->innerFrame.state.position_ms +
ctx->timeProvider->getSyncedTimestamp() -
playbackState->innerFrame.state.position_measured_at;