-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathPlaybackTracer.cpp
More file actions
34 lines (29 loc) · 842 Bytes
/
PlaybackTracer.cpp
File metadata and controls
34 lines (29 loc) · 842 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "config.h"
#include "stdafx.h"
#include "utils.h"
#include "PlaybackTracer.h"
#include "DbAlbumCollection.h"
#include "Engine.h"
#include "EngineThread.h"
void PlaybackTracer::delay(double extra_time) {
delayTimer.emplace(cfgCoverFollowDelay + extra_time, [&] {
this->thread.send<EM::Run>([&] {
if (cfgCoverFollowsPlayback)
moveToNowPlaying();
delayTimer.reset();
});
});
}
void PlaybackTracer::moveToNowPlaying() {
this->thread.runInMainThread([&] {
metadb_handle_ptr nowPlaying;
if (playback_control_v2::get()->get_now_playing(nowPlaying)) {
this->thread.send<EM::MoveToCurrentTrack>(nowPlaying);
}
});
}
void PlaybackTracer::onPlaybackNewTrack(metadb_handle_ptr /*p_track*/) {
if (!cfgCoverFollowsPlayback || delayTimer.has_value())
return;
moveToNowPlaying();
}