aboutsummaryrefslogtreecommitdiff
path: root/aosfxplayer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'aosfxplayer.cpp')
-rw-r--r--aosfxplayer.cpp18
1 files changed, 6 insertions, 12 deletions
diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp
index 35c7c4e..4a772e0 100644
--- a/aosfxplayer.cpp
+++ b/aosfxplayer.cpp
@@ -2,41 +2,35 @@
AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app)
{
+ m_sfxplayer = new QSoundEffect;
m_parent = parent;
ao_app = p_ao_app;
}
void AOSfxPlayer::play(QString p_sfx, QString p_char)
{
- BASS_ChannelStop(m_stream);
-
+ m_sfxplayer->stop();
p_sfx = p_sfx.toLower();
-
QString f_path;
-
if (p_char != "")
f_path = ao_app->get_character_path(p_char) + p_sfx;
else
f_path = ao_app->get_sounds_path() + p_sfx;
- m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE);
-
+ m_sfxplayer->setSource(QUrl::fromLocalFile(f_path));
set_volume(m_volume);
- BASS_ChannelPlay(m_stream, false);
+ m_sfxplayer->play();
}
void AOSfxPlayer::stop()
{
- BASS_ChannelStop(m_stream);
+ m_sfxplayer->stop();
}
void AOSfxPlayer::set_volume(int p_value)
{
m_volume = p_value;
-
float volume = p_value / 100.0f;
-
- BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume);
-
+ m_sfxplayer->setVolume(qreal(volume));
}