blob: dd128c5a75a45c12799a6d1b79a503eb4d79c945 (
plain)
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
|
#ifndef AUDIOPLAYER_H
#define AUDIOPLAYER_H
#include <QObject>
#include <QList>
#include <QFile>
#include <phonon/phononnamespace.h>
namespace Phonon
{
class MediaObject;
class AudioOutput;
}
class AudioPlayer
: public QObject
{
Q_OBJECT
public:
enum Sound {
Intro = 0,
WakaWaka,
EatingCherry,
Die
};
public:
AudioPlayer();
static AudioPlayer *self();
bool isWorking();
void stop();
void setMuted(bool mute = true);
void play(Sound sound);
void enqueue(Sound sound);
Phonon::State state();
signals:
void finished();
private:
void test();
void preload();
private slots:
void finished_p();
void stateChanged_p(Phonon::State newstate, Phonon::State oldstate);
void testFinished();
private:
bool m_working;
Phonon::MediaObject *m_player;
Phonon::AudioOutput *m_output;
static AudioPlayer *m_instance;
QList<QFile *> m_sounds;
};
#endif // AUDIOPLAYER_H
|