Sayonara Player
PlayManager.h
1/* PlayManager.h */
2
3/* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4 *
5 * This file is part of sayonara player
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#ifndef PLAY_MANAGER_H
22#define PLAY_MANAGER_H
23
24#include "Utils/Pimpl.h"
25
26#include <QObject>
27
28#include <memory>
29
35 public QObject
36{
37 Q_OBJECT
38
39 signals:
40
45 void sigStreamFinished(const MetaData& old_md);
46
50 void sigPlaystateChanged(PlayState);
51
55 void sigNext();
56
61 void sigWakeup();
62
67
71 void sigStopped();
72
77 void sigSeekedRelative(double percent);
78
83 void sigSeekedRelativeMs(MilliSeconds ms);
84
89 void sigSeekedAbsoluteMs(MilliSeconds ms);
90
95 void sigPositionChangedMs(MilliSeconds ms);
96
102
103 void sigCurrentMetadataChanged();
104
109 void sigTrackIndexChanged(int idx);
110
116
117 void sigBitrateChanged();
118
123
130 void sigRecording(bool b);
131
136 void sigBuffering(int b);
137
142 void sigVolumeChanged(int vol);
143
148 void sigMuteChanged(bool b);
149
150 void sigError(const QString& message);
151
152 public slots:
156 virtual void play() = 0;
157
161 virtual void wakeUp() = 0;
162
166 virtual void playPause() = 0;
167
171 virtual void pause() = 0;
172
176 virtual void previous() = 0;
177
181 virtual void next() = 0;
182
186 virtual void stop() = 0;
187
194 virtual void record(bool b) = 0;
195
200 virtual void seekRelative(double percent) = 0;
201
206 virtual void seekAbsoluteMs(MilliSeconds ms) = 0;
207
212 virtual void seekRelativeMs(MilliSeconds ms) = 0;
213
220 virtual void setCurrentPositionMs(MilliSeconds ms) = 0;
221
226 virtual void changeCurrentTrack(const MetaData& md, int trackIdx) = 0;
227
232 virtual void changeCurrentMetadata(const MetaData& md) = 0;
233
237 virtual void setTrackReady() = 0;
238 virtual void setTrackFinished() = 0;
239
244 virtual void buffering(int progress) = 0;
245
249 virtual void volumeUp() = 0;
250
254 virtual void volumeDown() = 0;
255
260 virtual void setVolume(int vol) = 0;
261
266 virtual void setMute(bool b) = 0;
267
271 virtual void toggleMute() = 0;
272
279 virtual void changeDuration(MilliSeconds ms) = 0;
280
281 virtual void changeBitrate(Bitrate br) = 0;
282
287 virtual void error(const QString& message) = 0;
288
289 public:
290 PlayManager(QObject* parent) : QObject(parent) {};
291 virtual ~PlayManager() = default;
292
297 virtual PlayState playstate() const = 0;
298
303 virtual MilliSeconds currentPositionMs() const = 0;
304
305 virtual MilliSeconds currentTrackPlaytimeMs() const = 0;
306
311 virtual MilliSeconds initialPositionMs() const = 0;
312
317 virtual MilliSeconds durationMs() const = 0;
318
319 virtual Bitrate bitrate() const = 0;
320
325 virtual const MetaData& currentTrack() const = 0;
326
331 virtual int volume() const = 0;
332
337 virtual bool isMuted() const = 0;
338
342 virtual void shutdown() = 0;
343};
344
345#endif
The MetaData class.
Definition: MetaData.h:47
Global handler for current playback state (Singleton)
Definition: PlayManager.h:36
void sigDurationChangedMs()
duration of track has changed
void sigMuteChanged(bool b)
emitted when mute state has changed
void sigVolumeChanged(int vol)
emitted when volume has changed
virtual void buffering(int progress)=0
notifiy, that track is in buffering state currently
virtual PlayState playstate() const =0
get current play state
void sigNext()
next track was triggered
void sigSeekedRelativeMs(MilliSeconds ms)
relative seeking was triggered
void sigRecording(bool b)
recording is requested
void sigWakeup()
This signal is sent when the playstate changed from stopped to play.
virtual void seekAbsoluteMs(MilliSeconds ms)=0
seek absolute
void sigStopped()
stop was triggered
void sigPlaystateChanged(PlayState)
emitted, when PlayState was changed
virtual void changeCurrentMetadata(const MetaData &md)=0
change_track
void sigPlaylistFinished()
playlist has finished
virtual void playPause()=0
toggle play/pause
virtual void seekRelative(double percent)=0
seek relative
virtual void wakeUp()=0
Emit wake up signal after stopping state.
virtual bool isMuted() const =0
query mute status
virtual void stop()=0
stop playback
virtual void volumeUp()=0
increase volume by 5
virtual void setCurrentPositionMs(MilliSeconds ms)=0
set current position of track This method does not seek. Just tells the playmanager where the current...
virtual void changeCurrentTrack(const MetaData &md, int trackIdx)=0
change current track
void sigSeekedAbsoluteMs(MilliSeconds ms)
absolute seeking was triggered
virtual void pause()=0
pause track, if currently playing
virtual void setVolume(int vol)=0
set volume
virtual void setTrackReady()=0
notify, that track is ready for playback
virtual void shutdown()=0
Shutdown the computer.
virtual const MetaData & currentTrack() const =0
get current track
virtual MilliSeconds initialPositionMs() const =0
get position in milliseconds where track will start
void sigStreamFinished(const MetaData &old_md)
emitted when a streamed track has finished
virtual void previous()=0
change to previous track
virtual void error(const QString &message)=0
Some playback error occured.
virtual void seekRelativeMs(MilliSeconds ms)=0
seekRelativeMs
virtual void setMute(bool b)=0
mute/unmute
void sigSeekedRelative(double percent)
relative seeking was triggered
void sigPrevious()
previous track was triggered
virtual void play()=0
Start playing if there's a track.
virtual void record(bool b)=0
request recording (see also sig_record(bool b))
virtual void next()=0
change to next track
void sigPositionChangedMs(MilliSeconds ms)
position in track has changed
virtual void volumeDown()=0
decrease volume by 5
void sigCurrentTrackChanged(const MetaData &md)
track has changed
void sigTrackIndexChanged(int idx)
track has changed
virtual void changeDuration(MilliSeconds ms)=0
Change the duration. This is usually called when the Engine sends a duration changed signal....
virtual MilliSeconds currentPositionMs() const =0
get current position in milliseconds
virtual int volume() const =0
get current volume
virtual MilliSeconds durationMs() const =0
get duration of track
virtual void toggleMute()=0
If already muted, then unmute. If unmuted, then mute it.
void sigBuffering(int b)
emitted when currently in buffering state