aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCerapter <cerap@protonmail.com>2018-08-17 01:34:22 +0200
committerCerapter <cerap@protonmail.com>2018-08-17 01:34:22 +0200
commiteee682bf0d603b0afe9dc2e41bf971669cea225d (patch)
tree4e67b818c125b6be3e791646c2a79866a2277985
parentaee3099d9b1ce0fb1e2521612d8f4eb07b323e4a (diff)
Fixed an issue with the audio output change not registering.
-rw-r--r--aoapplication.cpp29
-rw-r--r--aoblipplayer.cpp1
-rw-r--r--aomusicplayer.cpp1
-rw-r--r--aosfxplayer.cpp1
-rw-r--r--courtroom.cpp20
5 files changed, 21 insertions, 31 deletions
diff --git a/aoapplication.cpp b/aoapplication.cpp
index b8db52e3..0133765a 100644
--- a/aoapplication.cpp
+++ b/aoapplication.cpp
@@ -48,21 +48,6 @@ void AOApplication::construct_lobby()
discord->state_lobby();
w_lobby->show();
-
- // Change the default audio output device to be the one the user has given
- // in his config.ini file for now.
- int a = 0;
- BASS_DEVICEINFO info;
-
- for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
- {
- if (get_audio_output_device() == info.name)
- {
- BASS_SetDevice(a);
- qDebug() << info.name << "was set as the default audio output device.";
- break;
- }
- }
}
void AOApplication::destruct_lobby()
@@ -125,20 +110,6 @@ QString AOApplication::get_cccc_version_string()
void AOApplication::reload_theme()
{
current_theme = read_theme();
-
- // This may not be the best place for it, but let's read the audio output device just in case.
- int a = 0;
- BASS_DEVICEINFO info;
-
- for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
- {
- if (get_audio_output_device() == info.name)
- {
- BASS_SetDevice(a);
- qDebug() << info.name << "was set as the default audio output device.";
- break;
- }
- }
}
void AOApplication::set_favorite_list()
diff --git a/aoblipplayer.cpp b/aoblipplayer.cpp
index f2124533..5669a12b 100644
--- a/aoblipplayer.cpp
+++ b/aoblipplayer.cpp
@@ -33,6 +33,7 @@ void AOBlipPlayer::blip_tick()
HSTREAM f_stream = m_stream_list[f_cycle];
+ BASS_ChannelSetDevice(f_stream, BASS_GetDevice());
BASS_ChannelPlay(f_stream, false);
}
diff --git a/aomusicplayer.cpp b/aomusicplayer.cpp
index a9a9baf1..3246fc29 100644
--- a/aomusicplayer.cpp
+++ b/aomusicplayer.cpp
@@ -25,6 +25,7 @@ void AOMusicPlayer::play(QString p_song)
this->set_volume(m_volume);
+ BASS_ChannelSetDevice(m_stream, BASS_GetDevice());
BASS_ChannelPlay(m_stream, false);
}
diff --git a/aosfxplayer.cpp b/aosfxplayer.cpp
index 6ad59bae..c090be16 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);
}
diff --git a/courtroom.cpp b/courtroom.cpp
index 6e855f36..3dd0c4fc 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -20,8 +20,24 @@ Courtroom::Courtroom(AOApplication *p_ao_app) : QMainWindow()
ao_app = p_ao_app;
//initializing sound device
- BASS_Init(-1, 48000, BASS_DEVICE_LATENCY, 0, NULL);
- BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
+
+
+ // Change the default audio output device to be the one the user has given
+ // in his config.ini file for now.
+ int a = 0;
+ BASS_DEVICEINFO info;
+
+ for (a = 0; BASS_GetDeviceInfo(a, &info); a++)
+ {
+ if (ao_app->get_audio_output_device() == info.name)
+ {
+ BASS_SetDevice(a);
+ BASS_Init(a, 48000, BASS_DEVICE_LATENCY, 0, NULL);
+ BASS_PluginLoad("bassopus.dll", BASS_UNICODE);
+ qDebug() << info.name << "was set as the default audio output device.";
+ break;
+ }
+ }
keepalive_timer = new QTimer(this);
keepalive_timer->start(60000);