summaryrefslogtreecommitdiffstats
path: root/pacman-c++/phononplayer/phononplayer.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-05-10 22:28:58 +0200
committermanuel <manuel@mausz.at>2011-05-10 22:28:58 +0200
commit1a6c940ed9d7f6136da0e13148314072665342c5 (patch)
tree467b259d966ea1ddf9f66440066f57cf3eed68c4 /pacman-c++/phononplayer/phononplayer.h
parentcc1bb779661217171418adb0ddbd1ce01815463b (diff)
downloadfoop-1a6c940ed9d7f6136da0e13148314072665342c5.tar.gz
foop-1a6c940ed9d7f6136da0e13148314072665342c5.tar.bz2
foop-1a6c940ed9d7f6136da0e13148314072665342c5.zip
- refactorized audio once more: audio is now a plugin which gets loaded at runtime
- thus server has no dependency to phonon any more - remove client dependency to qtnetwork - fix enet deinitialization on windows
Diffstat (limited to 'pacman-c++/phononplayer/phononplayer.h')
-rw-r--r--pacman-c++/phononplayer/phononplayer.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/pacman-c++/phononplayer/phononplayer.h b/pacman-c++/phononplayer/phononplayer.h
new file mode 100644
index 0000000..ca56726
--- /dev/null
+++ b/pacman-c++/phononplayer/phononplayer.h
@@ -0,0 +1,71 @@
1#ifndef PHONONPLAYER_H
2#define PHONONPLAYER_H
3
4#include "audio.h"
5#include <QObject>
6#include <QFile>
7#include <QThread>
8#include <phonon/MediaObject>
9#include <phonon/AudioOutput>
10
11class PhononPlayerFactory
12 : public QObject, public AudioPlayerFactory
13{
14 Q_OBJECT
15 Q_INTERFACES(AudioPlayerFactory)
16
17public:
18 virtual AudioPlayer *create(QObject *parent = 0);
19};
20
21/* --------------------------------------------------------------- */
22
23class PhononPlayer
24 : public AudioPlayer
25{
26 Q_OBJECT
27 friend class AudioManager;
28
29private:
30 class Sleeper
31 : public QThread
32 {
33 public:
34 static void sleep(unsigned long secs);
35 static void msleep(unsigned long msecs);
36 static void usleep(unsigned long usecs);
37 };
38
39public:
40 PhononPlayer(QObject *parent = 0);
41 virtual bool isWorking() const;
42 virtual void setMuted(bool mute = true);
43 virtual bool isMuted() const;
44 virtual void play();
45 virtual void play(Sound::Type sound);
46 virtual bool isPlaying();
47 virtual void enqueue(Sound::Type sound);
48 virtual void pause();
49 virtual bool isPaused();
50 virtual void stop();
51 virtual bool isStopped();
52 virtual void clear();
53 virtual void clearQueue();
54 virtual void setPrefinishMark(qint32 msecToEnd);
55
56protected:
57 void test(QFile *testsound, qint32 length);
58
59protected slots:
60 virtual void prefinishMarkReached_ex(qint32 mark);
61 void finished_ex();
62 void testFinished();
63 void stateChanged_ex(Phonon::State newstate, Phonon::State oldstate);
64
65protected:
66 bool m_working;
67 Phonon::MediaObject *m_player;
68 Phonon::AudioOutput *m_output;
69};
70
71#endif // PHONONPLAYER_H