aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--aoblipplayer.cpp7
-rw-r--r--aoblipplayer.h4
-rw-r--r--aosfxplayer.cpp6
-rw-r--r--aosfxplayer.h4
4 files changed, 10 insertions, 11 deletions
diff --git a/aoblipplayer.cpp b/aoblipplayer.cpp
index c58e2cc9..5e3929e2 100644
--- a/aoblipplayer.cpp
+++ b/aoblipplayer.cpp
@@ -2,9 +2,9 @@
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
+ m_sfxplayer = new QSoundEffect;
m_parent = parent;
ao_app = p_ao_app;
- m_sfxplayer = new QMediaPlayer(m_parent, QMediaPlayer::Flag::LowLatency);
}
AOBlipPlayer::~AOBlipPlayer()
@@ -17,18 +17,17 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{
m_sfxplayer->stop();
QString f_path = ao_app->get_sounds_path() + p_sfx.toLower();
- m_sfxplayer->setMedia(QUrl::fromLocalFile(f_path));
+ m_sfxplayer->setSource(QUrl::fromLocalFile(f_path));
set_volume(m_volume);
}
void AOBlipPlayer::blip_tick()
{
- //m_sfxplayer->stop();
m_sfxplayer->play();
}
void AOBlipPlayer::set_volume(int p_value)
{
m_volume = p_value;
- m_sfxplayer->setVolume(p_value);
+ m_sfxplayer->setVolume(p_value / 100.0);
}
diff --git a/aoblipplayer.h b/aoblipplayer.h
index b4601962..c8a8cb6d 100644
--- a/aoblipplayer.h
+++ b/aoblipplayer.h
@@ -6,7 +6,7 @@
#include <QWidget>
#include <string.h>
#include <QDebug>
-#include <QMediaPlayer>
+#include <QSoundEffect>
class AOBlipPlayer
{
@@ -23,7 +23,7 @@ public:
private:
QWidget *m_parent;
AOApplication *ao_app;
- QMediaPlayer *m_sfxplayer;
+ QSoundEffect *m_sfxplayer;
int m_volume;
};
diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp
index c8e15937..69c1171e 100644
--- a/aosfxplayer.cpp
+++ b/aosfxplayer.cpp
@@ -5,7 +5,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
ao_app = p_ao_app;
- m_sfxplayer = new QMediaPlayer(m_parent, QMediaPlayer::Flag::LowLatency);
+ m_sfxplayer = new QSoundEffect();
}
AOSfxPlayer::~AOSfxPlayer()
@@ -38,7 +38,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout)
else
f_path = sound_path;
- m_sfxplayer->setMedia(QUrl::fromLocalFile(f_path));
+ m_sfxplayer->setSource(QUrl::fromLocalFile(f_path));
set_volume(m_volume);
m_sfxplayer->play();
@@ -52,5 +52,5 @@ void AOSfxPlayer::stop()
void AOSfxPlayer::set_volume(int p_value)
{
m_volume = p_value;
- m_sfxplayer->setVolume(p_value);
+ m_sfxplayer->setVolume(p_value / 100.0);
}
diff --git a/aosfxplayer.h b/aosfxplayer.h
index 4494b3e9..ab398e0c 100644
--- a/aosfxplayer.h
+++ b/aosfxplayer.h
@@ -6,7 +6,7 @@
#include <QWidget>
#include <string.h>
#include <QDebug>
-#include <QMediaPlayer>
+#include <QSoundEffect>
class AOSfxPlayer
{
@@ -21,7 +21,7 @@ public:
private:
QWidget *m_parent;
AOApplication *ao_app;
- QMediaPlayer *m_sfxplayer;
+ QSoundEffect *m_sfxplayer;
int m_volume = 0;
};