diff options
| -rw-r--r-- | pacman-c++/actor.cpp | 7 | ||||
| -rw-r--r-- | pacman-c++/audioplayer.cpp | 8 | ||||
| -rw-r--r-- | pacman-c++/audioplayer.h | 1 | ||||
| -rw-r--r-- | pacman-c++/pacman.qrc | 6 | ||||
| -rw-r--r-- | pacman-c++/sound/waka_waka.ogg | bin | 9649 -> 21874 bytes |
5 files changed, 18 insertions, 4 deletions
diff --git a/pacman-c++/actor.cpp b/pacman-c++/actor.cpp index cd59c1e..5ccc339 100644 --- a/pacman-c++/actor.cpp +++ b/pacman-c++/actor.cpp | |||
| @@ -163,12 +163,17 @@ void Actor::move(Actor::Movement direction) | |||
| 163 | 163 | ||
| 164 | if (direction != Actor::None) | 164 | if (direction != Actor::None) |
| 165 | { | 165 | { |
| 166 | m_moving->start(); | ||
| 167 | if (m_local && AudioPlayer::self()->state() != Phonon::PlayingState) | 166 | if (m_local && AudioPlayer::self()->state() != Phonon::PlayingState) |
| 168 | { | 167 | { |
| 168 | AudioPlayer::self()->clearQueue(); | ||
| 169 | AudioPlayer::self()->play(AudioPlayer::WakaWaka); | 169 | AudioPlayer::self()->play(AudioPlayer::WakaWaka); |
| 170 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); | 170 | AudioPlayer::self()->enqueue(AudioPlayer::WakaWaka); |
| 171 | } | 171 | } |
| 172 | m_moving->start(); | ||
| 173 | } | ||
| 174 | else | ||
| 175 | { | ||
| 176 | AudioPlayer::self()->stop(); | ||
| 172 | } | 177 | } |
| 173 | } | 178 | } |
| 174 | 179 | ||
diff --git a/pacman-c++/audioplayer.cpp b/pacman-c++/audioplayer.cpp index 5e9ede7..d3d2ff6 100644 --- a/pacman-c++/audioplayer.cpp +++ b/pacman-c++/audioplayer.cpp | |||
| @@ -72,6 +72,7 @@ void AudioPlayer::play(AudioPlayer::Sound sound) | |||
| 72 | m_player->play(); | 72 | m_player->play(); |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | |||
| 75 | void AudioPlayer::enqueue(AudioPlayer::Sound sound) | 76 | void AudioPlayer::enqueue(AudioPlayer::Sound sound) |
| 76 | { | 77 | { |
| 77 | if (!m_working) | 78 | if (!m_working) |
| @@ -79,6 +80,13 @@ void AudioPlayer::enqueue(AudioPlayer::Sound sound) | |||
| 79 | m_player->enqueue(Phonon::MediaSource(m_sounds[sound])); | 80 | m_player->enqueue(Phonon::MediaSource(m_sounds[sound])); |
| 80 | } | 81 | } |
| 81 | 82 | ||
| 83 | void AudioPlayer::clearQueue() | ||
| 84 | { | ||
| 85 | if (!m_working) | ||
| 86 | return; | ||
| 87 | m_player->clearQueue(); | ||
| 88 | } | ||
| 89 | |||
| 82 | Phonon::State AudioPlayer::state() | 90 | Phonon::State AudioPlayer::state() |
| 83 | { | 91 | { |
| 84 | return m_player->state(); | 92 | return m_player->state(); |
diff --git a/pacman-c++/audioplayer.h b/pacman-c++/audioplayer.h index 55f1b92..e5344e7 100644 --- a/pacman-c++/audioplayer.h +++ b/pacman-c++/audioplayer.h | |||
| @@ -33,6 +33,7 @@ public: | |||
| 33 | void setMuted(bool mute = true); | 33 | void setMuted(bool mute = true); |
| 34 | void play(Sound sound); | 34 | void play(Sound sound); |
| 35 | void enqueue(Sound sound); | 35 | void enqueue(Sound sound); |
| 36 | void clearQueue(); | ||
| 36 | Phonon::State state(); | 37 | Phonon::State state(); |
| 37 | 38 | ||
| 38 | signals: | 39 | signals: |
diff --git a/pacman-c++/pacman.qrc b/pacman-c++/pacman.qrc index 98b495d..44f76d9 100644 --- a/pacman-c++/pacman.qrc +++ b/pacman-c++/pacman.qrc | |||
| @@ -19,9 +19,9 @@ | |||
| 19 | <file alias="actor4icon">pics/actor4icon.png</file> | 19 | <file alias="actor4icon">pics/actor4icon.png</file> |
| 20 | </qresource> | 20 | </qresource> |
| 21 | <qresource prefix="/sound"> | 21 | <qresource prefix="/sound"> |
| 22 | <file alias="sound2">sound/waka_waka.ogg</file> | ||
| 23 | <file alias="sound4">sound/die.ogg</file> | ||
| 24 | <file alias="sound3">sound/eating_cherry.ogg</file> | ||
| 25 | <file alias="sound1">sound/intro.ogg</file> | 22 | <file alias="sound1">sound/intro.ogg</file> |
| 23 | <file alias="sound2">sound/waka_waka2.ogg</file> | ||
| 24 | <file alias="sound3">sound/eating_cherry.ogg</file> | ||
| 25 | <file alias="sound4">sound/die.ogg</file> | ||
| 26 | </qresource> | 26 | </qresource> |
| 27 | </RCC> | 27 | </RCC> |
diff --git a/pacman-c++/sound/waka_waka.ogg b/pacman-c++/sound/waka_waka.ogg index a2b879f..f499611 100644 --- a/pacman-c++/sound/waka_waka.ogg +++ b/pacman-c++/sound/waka_waka.ogg | |||
| Binary files differ | |||
