diff options
Diffstat (limited to 'Swift/QtUI/QtSoundPlayer.cpp')
-rw-r--r-- | Swift/QtUI/QtSoundPlayer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/Swift/QtUI/QtSoundPlayer.cpp b/Swift/QtUI/QtSoundPlayer.cpp index 387c6f3..63f76f0 100644 --- a/Swift/QtUI/QtSoundPlayer.cpp +++ b/Swift/QtUI/QtSoundPlayer.cpp @@ -16,10 +16,11 @@ namespace Swift { QtSoundPlayer::QtSoundPlayer(ApplicationPathProvider* applicationPathProvider) : applicationPathProvider(applicationPathProvider) { } -void QtSoundPlayer::playSound(SoundEffect sound) { +void QtSoundPlayer::playSound(SoundEffect sound, const std::string& soundResource) { + switch (sound) { case MessageReceived: - playSound("/sounds/message-received.wav"); + playSound(soundResource.empty() ? "/sounds/message-received.wav" : soundResource); break; } } @@ -29,6 +30,9 @@ void QtSoundPlayer::playSound(const std::string& soundResource) { if (boost::filesystem::exists(resourcePath)) { QSound::play(resourcePath.string().c_str()); } + else if (boost::filesystem::exists(soundResource)) { + QSound::play(soundResource.c_str()); + } else { std::cerr << "Unable to find sound: " << soundResource << std::endl; } |