#ifndef AUDIOPLAYER_H #define AUDIOPLAYER_H #include #include #include #include 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() const; void stop(); void setMuted(bool mute = true); bool isMuted() const; void play(Sound sound); void clear(); void enqueue(Sound sound); void clearQueue() const; Phonon::State state(); signals: void finished(); void aboutToFinish(); void mutedChanged(bool muted); private: void test(); void preload(); private slots: void finished_p(); void aboutToFinish_p(); void stateChanged_p(Phonon::State newstate, Phonon::State oldstate); void mutedChanged_p(bool muted); void testFinished(); private: bool m_working; Phonon::MediaObject *m_player; Phonon::AudioOutput *m_output; static AudioPlayer *m_instance; QList m_sounds; }; #endif // AUDIOPLAYER_H