From eee682bf0d603b0afe9dc2e41bf971669cea225d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 17 Aug 2018 01:34:22 +0200 Subject: Fixed an issue with the audio output change not registering. --- aosfxplayer.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 6ad59ba..c090be1 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -27,6 +27,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char) set_volume(m_volume); + BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); BASS_ChannelPlay(m_stream, false); } -- cgit From d314b8dd07f72d94724c3902258dfb2641d3435c Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sun, 19 Aug 2018 09:37:34 +0200 Subject: Moved includes out of the CPP files into the header files. Reimplementation of `30a87d23c9c63bed072b3460e7482075dc530b2c` from the old origin. --- aosfxplayer.cpp | 4 ---- 1 file changed, 4 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index c090be1..667005d 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -1,9 +1,5 @@ #include "aosfxplayer.h" -#include - -#include - AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; -- cgit From 91ad46eea043673b188f5b5d4be49d66e0b7ba0d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Fri, 24 Aug 2018 15:51:28 +0200 Subject: Fixed a Windows bug where there was no way to get back to the default audio device. --- aosfxplayer.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 667005d..df26ddf 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -23,7 +23,8 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char) set_volume(m_volume); - BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); + if (ao_app->get_audio_output_device() != "Default") + BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); BASS_ChannelPlay(m_stream, false); } -- cgit From fe955d692350cd3bac192721c09d8fdd445afc5d Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 17:32:20 +0200 Subject: Removed the dependency on `bass.dll`. This is merely a reimplementation of Gameboyprinter's changes on the main thing. The only thing that's different from that one is that the options menu has had its audio device removed, too. --- aosfxplayer.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index df26ddf..972cd74 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -4,12 +4,19 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; + m_sfxplayer = new QSoundEffect(); } -void AOSfxPlayer::play(QString p_sfx, QString p_char) +AOSfxPlayer::~AOSfxPlayer() { - BASS_ChannelStop(m_stream); + m_sfxplayer->stop(); + m_sfxplayer->deleteLater(); +} + +void AOSfxPlayer::play(QString p_sfx, QString p_char) +{ + m_sfxplayer->stop(); p_sfx = p_sfx.toLower(); QString f_path; @@ -19,26 +26,19 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char) 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); - if (ao_app->get_audio_output_device() != "Default") - BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); - 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(p_value / 100.0); } -- cgit From 1124d6b073546bacd58bce640bbcc08db4f8b341 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Tue, 4 Sep 2018 20:39:08 +0200 Subject: `QMediaPlayer` instead of `QSoundEffect` for SFX and blips. Maybe temporary. --- aosfxplayer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 972cd74..9089aec 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -4,7 +4,7 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; - m_sfxplayer = new QSoundEffect(); + m_sfxplayer = new QMediaPlayer(m_parent, QMediaPlayer::Flag::LowLatency); } AOSfxPlayer::~AOSfxPlayer() @@ -26,7 +26,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char) else f_path = ao_app->get_sounds_path() + p_sfx; - m_sfxplayer->setSource(QUrl::fromLocalFile(f_path)); + m_sfxplayer->setMedia(QUrl::fromLocalFile(f_path)); set_volume(m_volume); m_sfxplayer->play(); @@ -40,5 +40,5 @@ void AOSfxPlayer::stop() void AOSfxPlayer::set_volume(int p_value) { m_volume = p_value; - m_sfxplayer->setVolume(p_value / 100.0); + m_sfxplayer->setVolume(p_value); } -- cgit From 12727fcf7f0684f916290113da4a76c331fadce9 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Wed, 5 Sep 2018 02:07:23 +0200 Subject: `misc` folder given purpose as the 'default' for shouts and chatboxes. - Default bubbles. - Default shout sounds. - Custom chatbox. - Custom colours for the chatbox. - No need to have duplicate files of bubbles and shouts all over the character folders. --- aosfxplayer.cpp | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 9089aec..c8e1593 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -1,4 +1,5 @@ #include "aosfxplayer.h" +#include "file_functions.h" AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { @@ -14,17 +15,28 @@ AOSfxPlayer::~AOSfxPlayer() } -void AOSfxPlayer::play(QString p_sfx, QString p_char) +void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { m_sfxplayer->stop(); p_sfx = p_sfx.toLower(); - QString f_path; + QString misc_path = ""; + QString char_path = ""; + QString sound_path = ao_app->get_sounds_path() + p_sfx; + if (shout != "") + misc_path = ao_app->get_base_path() + "misc/" + shout + "/" + p_sfx; if (p_char != "") - f_path = ao_app->get_character_path(p_char) + p_sfx; + char_path = ao_app->get_character_path(p_char) + p_sfx; + + QString f_path; + + if (file_exists(char_path)) + f_path = char_path; + else if (file_exists(misc_path)) + f_path = misc_path; else - f_path = ao_app->get_sounds_path() + p_sfx; + f_path = sound_path; m_sfxplayer->setMedia(QUrl::fromLocalFile(f_path)); set_volume(m_volume); -- cgit From 3a1d202363df5a6d5c5e2148736ec0308aed5d7e Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 01:37:11 +0200 Subject: Revert "`QMediaPlayer` instead of `QSoundEffect` for SFX and blips." This reverts commit 1124d6b073546bacd58bce640bbcc08db4f8b341. --- aosfxplayer.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index c8e1593..69c1171 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); } -- cgit From c1c042b93d0d0550bd1dfb3cc17f3209135a26c0 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Sat, 15 Sep 2018 01:42:44 +0200 Subject: Revert "Removed the dependency on `bass.dll`." This reverts commit fe955d692350cd3bac192721c09d8fdd445afc5d. --- aosfxplayer.cpp | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 69c1171..65da686 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -5,19 +5,12 @@ AOSfxPlayer::AOSfxPlayer(QWidget *parent, AOApplication *p_ao_app) { m_parent = parent; ao_app = p_ao_app; - m_sfxplayer = new QSoundEffect(); } -AOSfxPlayer::~AOSfxPlayer() -{ - m_sfxplayer->stop(); - m_sfxplayer->deleteLater(); -} - - void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) { - m_sfxplayer->stop(); + BASS_ChannelStop(m_stream); + p_sfx = p_sfx.toLower(); QString misc_path = ""; @@ -38,19 +31,26 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) else f_path = sound_path; - m_sfxplayer->setSource(QUrl::fromLocalFile(f_path)); + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + set_volume(m_volume); - m_sfxplayer->play(); + if (ao_app->get_audio_output_device() != "Default") + BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); + BASS_ChannelPlay(m_stream, false); } void AOSfxPlayer::stop() { - m_sfxplayer->stop(); + BASS_ChannelStop(m_stream); } void AOSfxPlayer::set_volume(int p_value) { m_volume = p_value; - m_sfxplayer->setVolume(p_value / 100.0); + + float volume = p_value / 100.0f; + + BASS_ChannelSetAttribute(m_stream, BASS_ATTRIB_VOL, volume); + } -- cgit From 8ffdd2afb84ec483160f156d24cf786165a9506c Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 16 Nov 2018 02:01:08 +0100 Subject: refactored path functions and added support for case-sensitive filesystems --- aosfxplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index cc2f383..03a3ac5 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -19,7 +19,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char) p_sfx = p_sfx.toLower(); QString f_path; if (p_char != "") - f_path = ao_app->get_character_path(p_char) + p_sfx; + f_path = ao_app->get_character_path(p_char, p_sfx); else f_path = ao_app->get_sounds_path() + p_sfx; -- cgit From ee4b9acfeb1a860cf67957548c544ff893ce71bb Mon Sep 17 00:00:00 2001 From: David Skoland Date: Fri, 16 Nov 2018 02:37:57 +0100 Subject: fixed get_sounds_path as well + nuked the last unneccessary tolower calls --- aosfxplayer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 03a3ac5..575e91f 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -16,12 +16,12 @@ AOSfxPlayer::~AOSfxPlayer() void AOSfxPlayer::play(QString p_sfx, QString p_char) { m_sfxplayer->stop(); - p_sfx = p_sfx.toLower(); + p_sfx = p_sfx; 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; + f_path = ao_app->get_sounds_path(p_sfx); m_sfxplayer->setSource(QUrl::fromLocalFile(f_path)); set_volume(m_volume); -- cgit From 9727acc974db4442787ce5d681dd4a7b55d6a713 Mon Sep 17 00:00:00 2001 From: oldmud0 Date: Mon, 10 Dec 2018 15:10:31 -0600 Subject: Re-add missing BASS_StreamCreateFile line --- aosfxplayer.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index d5b5a9e..84a8eb3 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -27,6 +27,8 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) else f_path = sound_path; + m_stream = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_STREAM_AUTOFREE | BASS_UNICODE | BASS_ASYNCFILE); + set_volume(m_volume); if (ao_app->get_audio_output_device() != "Default") -- cgit From 1c6afdce99811525bd703a526041691070b03274 Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 13 Dec 2018 11:38:21 +0100 Subject: Fixed a bug where there would be no sound on Windows during the first start. --- aosfxplayer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'aosfxplayer.cpp') diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp index 84a8eb3..90e458e 100644 --- a/aosfxplayer.cpp +++ b/aosfxplayer.cpp @@ -31,7 +31,7 @@ void AOSfxPlayer::play(QString p_sfx, QString p_char, QString shout) set_volume(m_volume); - if (ao_app->get_audio_output_device() != "Default") + if (ao_app->get_audio_output_device() != "default") BASS_ChannelSetDevice(m_stream, BASS_GetDevice()); BASS_ChannelPlay(m_stream, false); } -- cgit