aboutsummaryrefslogtreecommitdiff
path: root/src/aoblipplayer.cpp
diff options
context:
space:
mode:
authoroldmud0 <oldmud0@users.noreply.github.com>2020-05-22 17:02:32 -0500
committeroldmud0 <oldmud0@users.noreply.github.com>2020-05-22 17:02:32 -0500
commit156a760ebab6839c53f9c613881f0937e814414a (patch)
treefd9fafecd25fbd66f0e4f8101f856c8cf68b790e /src/aoblipplayer.cpp
parentd89a4370a753f6e1da22349866b1b00f638884a6 (diff)
Full revert to tag 2.6.2
Due to a countless number of changes made to the core that were not fully understood, tested, or documented, it was decided to roll everything back to the last known stable version (2.6.2). Changes dropped include: - Witness needed - Shake - Frame SFX - Multiple custom objections - Multithreaded thumbnail generation - Looping - Various translation additions - "Mirror IC" - Color in IC log - An invocation of clang-format Next time, work together and split your big fork into independently testable feature branches.
Diffstat (limited to 'src/aoblipplayer.cpp')
-rw-r--r--src/aoblipplayer.cpp58
1 files changed, 29 insertions, 29 deletions
diff --git a/src/aoblipplayer.cpp b/src/aoblipplayer.cpp
index 7d598b5f..4dfb895c 100644
--- a/src/aoblipplayer.cpp
+++ b/src/aoblipplayer.cpp
@@ -1,6 +1,6 @@
#include "aoblipplayer.h"
-#if defined(BASSAUDIO) // Using bass.dll for the blips
+#if defined(BASSAUDIO) //Using bass.dll for the blips
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
@@ -11,14 +11,14 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{
QString f_path = ao_app->get_sounds_path(p_sfx);
- for (int n_stream = 0; n_stream < 5; ++n_stream) {
+ for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
+ {
BASS_StreamFree(m_stream_list[n_stream]);
- m_stream_list[n_stream] = BASS_StreamCreateFile(
- FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
+ m_stream_list[n_stream] = BASS_StreamCreateFile(FALSE, f_path.utf16(), 0, 0, BASS_UNICODE | BASS_ASYNCFILE);
}
- set_volume_internal(m_volume);
+ set_volume(m_volume);
}
void AOBlipPlayer::blip_tick()
@@ -34,21 +34,18 @@ void AOBlipPlayer::blip_tick()
BASS_ChannelPlay(f_stream, false);
}
-void AOBlipPlayer::set_volume(qreal p_value)
+void AOBlipPlayer::set_volume(int p_value)
{
- m_volume = p_value / 100;
- set_volume_internal(m_volume);
-}
+ m_volume = p_value;
-void AOBlipPlayer::set_volume_internal(qreal p_value)
-{
- float volume = p_value;
+ float volume = p_value / 100.0f;
- for (int n_stream = 0; n_stream < 5; ++n_stream) {
+ for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
+ {
BASS_ChannelSetAttribute(m_stream_list[n_stream], BASS_ATTRIB_VOL, volume);
}
}
-#elif defined(QTAUDIO) // Using Qt's QSoundEffect class
+#elif defined(QTAUDIO) //Using Qt's QSoundEffect class
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
@@ -59,16 +56,17 @@ void AOBlipPlayer::set_blips(QString p_sfx)
{
QString f_path = ao_app->get_sounds_path(p_sfx);
- for (int n_stream = 0; n_stream < 5; ++n_stream) {
+ for (int n_stream = 0 ; n_stream < 5 ; ++n_stream)
+ {
m_blips.setSource(QUrl::fromLocalFile(f_path));
}
- set_volume_internal(m_volume);
+ set_volume(m_volume);
}
void AOBlipPlayer::blip_tick()
{
- m_cycle++;
+ int f_cycle = m_cycle++;
if (m_cycle == 5)
m_cycle = 0;
@@ -76,28 +74,30 @@ void AOBlipPlayer::blip_tick()
m_blips.play();
}
-void AOBlipPlayer::set_volume(qreal p_value)
-{
- m_volume = p_value / 100;
- set_volume_internal(m_volume);
-}
-
-void AOBlipPlayer::set_volume_internal(qreal p_value)
+void AOBlipPlayer::set_volume(int p_value)
{
+ m_volume = p_value;
m_blips.setVolume(m_volume);
}
-#else // No audio
+#else //No audio
AOBlipPlayer::AOBlipPlayer(QWidget *parent, AOApplication *p_ao_app)
{
m_parent = parent;
ao_app = p_ao_app;
}
-void AOBlipPlayer::set_blips(QString p_sfx) {}
+void AOBlipPlayer::set_blips(QString p_sfx)
+{
+
+}
+
+void AOBlipPlayer::blip_tick()
+{
-void AOBlipPlayer::blip_tick() {}
+}
-void AOBlipPlayer::set_volume(qreal p_value) {}
+void AOBlipPlayer::set_volume(int p_value)
+{
-void AOBlipPlayer::set_volume_internal(qreal p_value) {}
+}
#endif