Repository navigation
Expand file tree
/
Copy pathbookmark_play_callback.cpp
More file actions
139 lines (101 loc) · 2.5 KB
/
Copy pathbookmark_play_callback.cpp
File metadata and controls
139 lines (101 loc) · 2.5 KB
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#include "bookmark_core.h"
#include "bookmark_automatic.h"
#include "bookmark_play_callback.h"
using namespace glb;
namespace {
// stop
void bm_play_callback::on_playback_stop(play_control::t_stop_reason p_reason) {
if (!cfg_monitor.get()) {
return;
}
if (p_reason == play_control::stop_reason_shutting_down) {
if (cfg_autosave_on_quit.get()) {
g_bmAuto.updateDummy(nullptr);
}
}
else {
if (g_bmAuto.getDummy().isRadio()) {
//.. reset in time event
}
else {
if (p_reason != play_control::t_stop_reason::stop_reason_starting_another) {
g_bmAuto.ResetRestoredDummy();
}
}
g_bmAuto.resetDummyAll();
g_bmAuto.updateDummy(nullptr);
}
}
// new track
void bm_play_callback::on_playback_new_track(metadb_handle_ptr p_track) {
if (!cfg_monitor.get()) {
return;
}
if (g_bmAuto.getDyna()) {
FB2K_console_print_v("New dyna track event...");
}
else {
FB2K_console_print_v("New track event...");
}
if (g_wnd_bookmark_pref) {
SendMessage(g_wnd_bookmark_pref, UMSG_NEW_TRACK, NULL, NULL);
}
if (g_bmAuto.getDyna()) {
g_bmAuto.resetDummyKeepDyna();
}
else {
g_bmAuto.resetDummyAll();
}
g_bmAuto.updateDummy(nullptr);
//todo: remove m_updating from updateDummy()
g_bmAuto.Reset_Updating();
g_bmAuto.setDyna(false);
auto bm = g_bmAuto.getDummy();
g_bmAuto.ResetRestoredDummyTime();
if (g_wnd_preferences) {
SendMessage(g_wnd_preferences, UMSG_NEW_TRACK, NULL, NULL);
}
return;
}
// seek
void bm_play_callback::on_playback_seek(double p_time) {
if (!cfg_monitor.get()) {
return;
}
if (is_cfg_Bookmarking() && is_cfg_LapseEnabled()) {
//
g_bmAuto.cancelUpdating();
//
}
}
// time
void bm_play_callback::on_playback_time(double p_time) {
if (!cfg_monitor.get()) {
return;
}
g_bmAuto.updateDummyTime();
}
void bm_play_callback::on_playback_dynamic_info_track(const file_info& p_info) {
if (!cfg_monitor.get()) {
return;
}
FB2K_console_print_v("Dynamic info arrived...");
if (!g_bmAuto.checkDummyIsRadio()) {
return;
}
{
auto playback_control_ptr = playback_control::get();
metadb_handle_ptr track_current;
//Identify current track
bool bnowPlaying = playback_control_ptr->get_now_playing(track_current);
if (bnowPlaying) {
g_bmAuto.setDyna(true);
//
on_playback_new_track(track_current);
//
}
}
}
}
// S T A T I C P L A Y - C A L L B A C K
static service_factory_single_t<bm_play_callback> g_play_callback_static_factory;