diff --git a/src/blacksound/share/sounds/callsignmentioned.wav b/src/blacksound/share/sounds/callsignmentioned.wav new file mode 100644 index 000000000..afea3f1b3 Binary files /dev/null and b/src/blacksound/share/sounds/callsignmentioned.wav differ diff --git a/src/blacksound/share/sounds/pttclick.wav b/src/blacksound/share/sounds/pttclick.wav new file mode 100644 index 000000000..786109ae9 Binary files /dev/null and b/src/blacksound/share/sounds/pttclick.wav differ diff --git a/src/blacksound/soundgenerator.cpp b/src/blacksound/soundgenerator.cpp index c24ab726d..3d48590a2 100644 --- a/src/blacksound/soundgenerator.cpp +++ b/src/blacksound/soundgenerator.cpp @@ -486,7 +486,7 @@ namespace BlackSound CSoundGenerator::playSelcal(volume, selcal, CSoundGenerator::findClosestOutputDevice(audioDevice)); } - void CSoundGenerator::playNotificationSound(int volume, CNotificationSounds::Notification notification) + void CSoundGenerator::playNotificationSound(int volume, CNotificationSounds::NotificationFlag notification) { QMediaPlayer *mediaPlayer = CSoundGenerator::mediaPlayer(); if (mediaPlayer->state() == QMediaPlayer::PlayingState) return; @@ -500,15 +500,19 @@ namespace BlackSound success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/login.wav")) && success; success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/logoff.wav")) && success; success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/privatemessage.wav")) && success; + success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/callsignmentioned.wav")) && success; success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/voiceroomjoined.wav")) && success; success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/voiceroomleft.wav")) && success; + success = playlist->addMedia(QUrl::fromLocalFile(CDirectoryUtils::soundFilesDirectory() + "/pttclick.wav")) && success; Q_ASSERT(success); playlist->setPlaybackMode(QMediaPlaylist::CurrentItemOnce); mediaPlayer->setPlaylist(playlist); } - if (notification == CNotificationSounds::NotificationsLoadSounds) return; - int index = static_cast(notification); + if (notification == CNotificationSounds::LoadSounds) { return; } + if (notification == CNotificationSounds::NoNotifications) { return; } + + const int index = qRound(std::log2(static_cast(notification))); playlist->setCurrentIndex(index); mediaPlayer->setVolume(volume); // 0-100 mediaPlayer->play(); diff --git a/src/blacksound/soundgenerator.h b/src/blacksound/soundgenerator.h index 2768d069d..7d8122abc 100644 --- a/src/blacksound/soundgenerator.h +++ b/src/blacksound/soundgenerator.h @@ -169,7 +169,7 @@ namespace BlackSound //! Play notification //! \param volume 0-100 //! \param notification - static void playNotificationSound(int volume, BlackMisc::Audio::CNotificationSounds::Notification notification); + static void playNotificationSound(int volume, BlackMisc::Audio::CNotificationSounds::NotificationFlag notification); //! For debugging purposes static void printAllQtSoundDevices(QTextStream &qtout);