-
Notifications
You must be signed in to change notification settings - Fork 0
/
player.h
53 lines (37 loc) · 958 Bytes
/
player.h
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
#ifndef PLAYER_H
#define PLAYER_H
#include <QObject>
#include <QMutex>
#include <QAudioOutput>
#include "playlist.h"
class Player : public QObject
{
Q_OBJECT
Q_PROPERTY(bool playing MEMBER _playing READ playing)
public:
explicit Player(Playlist* playlist, QObject* parent = nullptr);
bool playing() { return _playing; }
static QMutex mutex;
signals:
void songChange(QString songName);
void rowUpdate(int row, int pattern, int channels);
void playbackStarted();
void playbackPaused();
public slots:
void play();
void pause();
void nextTrack();
void previousTrack();
void setVolume(int volume);
void setLoop(bool loop);
void onCurrentIndexChanged(int from, int to);
private:
Playlist* _playlist;
bool _playing = false;
bool _loop = false;
QAudioOutput* _audioOutput = nullptr;
int _row = 0;
int _pattern = 0;
qreal _volume = 1.0;
};
#endif // PLAYER_H