From 1a6c940ed9d7f6136da0e13148314072665342c5 Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 10 May 2011 22:28:58 +0200 Subject: - 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 --- pacman-c++/phononplayer/phononplayer.h | 71 ++++++++++++++++++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 pacman-c++/phononplayer/phononplayer.h (limited to 'pacman-c++/phononplayer/phononplayer.h') 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 @@ +#ifndef PHONONPLAYER_H +#define PHONONPLAYER_H + +#include "audio.h" +#include +#include +#include +#include +#include + +class PhononPlayerFactory + : public QObject, public AudioPlayerFactory +{ + Q_OBJECT + Q_INTERFACES(AudioPlayerFactory) + +public: + virtual AudioPlayer *create(QObject *parent = 0); +}; + +/* --------------------------------------------------------------- */ + +class PhononPlayer + : public AudioPlayer +{ + Q_OBJECT + friend class AudioManager; + +private: + class Sleeper + : public QThread + { + public: + static void sleep(unsigned long secs); + static void msleep(unsigned long msecs); + static void usleep(unsigned long usecs); + }; + +public: + PhononPlayer(QObject *parent = 0); + virtual bool isWorking() const; + virtual void setMuted(bool mute = true); + virtual bool isMuted() const; + virtual void play(); + virtual void play(Sound::Type sound); + virtual bool isPlaying(); + virtual void enqueue(Sound::Type sound); + virtual void pause(); + virtual bool isPaused(); + virtual void stop(); + virtual bool isStopped(); + virtual void clear(); + virtual void clearQueue(); + virtual void setPrefinishMark(qint32 msecToEnd); + +protected: + void test(QFile *testsound, qint32 length); + +protected slots: + virtual void prefinishMarkReached_ex(qint32 mark); + void finished_ex(); + void testFinished(); + void stateChanged_ex(Phonon::State newstate, Phonon::State oldstate); + +protected: + bool m_working; + Phonon::MediaObject *m_player; + Phonon::AudioOutput *m_output; +}; + +#endif // PHONONPLAYER_H -- cgit v1.2.3