Change sound backend from Qt to miniaudio (#4334)

Thanks Greenlandicsmiley, Nerixyz, Yoitsu, and helmak for helping debug & test this

* Remove QMediaPlayer includes

* Prefer local path when generating the sound path

* Update changelog entry number

* Disable pitch & spatialization control
This commit is contained in:
pajlada
2023-01-29 10:36:25 +01:00
committed by GitHub
parent adf58d2770
commit 4958d08036
16 changed files with 354 additions and 64 deletions
@@ -5,6 +5,7 @@
#include "common/Outcome.hpp"
#include "common/QLogging.hpp"
#include "controllers/notifications/NotificationModel.hpp"
#include "controllers/sound/SoundController.hpp"
#include "messages/Message.hpp"
#include "providers/twitch/api/Helix.hpp"
#include "providers/twitch/TwitchIrcServer.hpp"
@@ -21,7 +22,6 @@
#include <QDesktopServices>
#include <QDir>
#include <QMediaPlayer>
#include <QUrl>
#include <unordered_set>
@@ -97,25 +97,13 @@ void NotificationController::removeChannelNotification(
}
void NotificationController::playSound()
{
static auto player = new QMediaPlayer;
static QUrl currentPlayerUrl;
QUrl highlightSoundUrl =
getSettings()->notificationCustomSound
? QUrl::fromLocalFile(
getSettings()->notificationPathSound.getValue())
: QUrl("qrc:/sounds/ping2.wav");
// Set media if the highlight sound url has changed, or if media is buffered
if (currentPlayerUrl != highlightSoundUrl ||
player->mediaStatus() == QMediaPlayer::BufferedMedia)
{
player->setMedia(highlightSoundUrl);
currentPlayerUrl = highlightSoundUrl;
}
player->play();
getApp()->sound->play(highlightSoundUrl);
}
NotificationModel *NotificationController::createModel(QObject *parent,