summaryrefslogtreecommitdiffstats
path: root/pacman-c++/audio.h
diff options
context:
space:
mode:
authormanuel <manuel@mausz.at>2011-04-14 02:37:31 +0200
committermanuel <manuel@mausz.at>2011-04-14 02:37:31 +0200
commitb18385a95f25e13c767244b494f31bd4fc238143 (patch)
treeaf389057a2d4a03565f70186d7c1d2e49b95828f /pacman-c++/audio.h
parent3d20638fa8e295271ce38953ad1c657d9275bd99 (diff)
downloadfoop-b18385a95f25e13c767244b494f31bd4fc238143.tar.gz
foop-b18385a95f25e13c767244b494f31bd4fc238143.tar.bz2
foop-b18385a95f25e13c767244b494f31bd4fc238143.zip
encapsulate gapless audioplayer commit from yesterday into an own class (gaplessaudioplayer)
added two new menu entrys: toggle sound + toggle ambient sound (2. very useful!)
Diffstat (limited to 'pacman-c++/audio.h')
-rw-r--r--pacman-c++/audio.h39
1 files changed, 35 insertions, 4 deletions
diff --git a/pacman-c++/audio.h b/pacman-c++/audio.h
index 49d29a9..3e76f50 100644
--- a/pacman-c++/audio.h
+++ b/pacman-c++/audio.h
@@ -25,6 +25,8 @@ namespace Sound
25 }; 25 };
26}; 26};
27 27
28/* --------------------------------------------------------------- */
29
28class AudioPlayer 30class AudioPlayer
29 : public Phonon::MediaObject 31 : public Phonon::MediaObject
30{ 32{
@@ -46,32 +48,61 @@ public:
46 bool isWorking() const; 48 bool isWorking() const;
47 void setMuted(bool mute = true); 49 void setMuted(bool mute = true);
48 bool isMuted() const; 50 bool isMuted() const;
49 void setLoop(QFile *sound);
50 void setLoop(Sound::Type sound); 51 void setLoop(Sound::Type sound);
51 void play(); 52 void play();
52 void play(Sound::Type sound); 53 void play(Sound::Type sound);
53 54
54private: 55protected:
55 void test(QFile *testsound); 56 void test(QFile *testsound);
57 void setLoop(QFile *sound);
56 58
57public slots: 59public slots:
58 void loopEnqueue(); 60 void loopEnqueue();
59 61
60private slots: 62protected slots:
61 void testFinished(); 63 void testFinished();
62 void stateChanged_ex(Phonon::State newstate, Phonon::State oldstate); 64 void stateChanged_ex(Phonon::State newstate, Phonon::State oldstate);
63 65
64private: 66protected:
65 bool m_working; 67 bool m_working;
66 QFile *m_loopsound; 68 QFile *m_loopsound;
67 Phonon::AudioOutput *m_output; 69 Phonon::AudioOutput *m_output;
68}; 70};
69 71
72/* --------------------------------------------------------------- */
73
74class GaplessAudioPlayer
75 : public QObject
76{
77 Q_OBJECT
78
79public:
80 GaplessAudioPlayer(Sound::Type sound, qint32 mark, QObject *parent = 0);
81 bool isWorking() const;
82 void setMuted(bool mute = true);
83 bool isMuted() const;
84 void play();
85 void pause();
86
87protected slots:
88 void startPlayer1();
89 void startPlayer2();
90
91protected:
92 bool m_working;
93 Sound::Type m_sound;
94 AudioPlayer *m_player1;
95 AudioPlayer *m_player2;
96};
97
98/* --------------------------------------------------------------- */
99
70class AudioManager 100class AudioManager
71 : public QObject 101 : public QObject
72{ 102{
73 Q_OBJECT 103 Q_OBJECT
74 friend class AudioPlayer; 104 friend class AudioPlayer;
105 friend class GaplessAudioPlayer;
75 106
76public: 107public:
77 AudioManager(); 108 AudioManager();