summaryrefslogtreecommitdiff
path: root/drivers/xaudio2
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2020-05-14 13:23:58 +0200
committerRémi Verschelde <rverschelde@gmail.com>2020-05-14 16:54:55 +0200
commit0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a (patch)
treea27e497da7104dd0a64f98a04fa3067668735e91 /drivers/xaudio2
parent710b34b70227becdc652b4ae027fe0ac47409642 (diff)
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
Diffstat (limited to 'drivers/xaudio2')
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.cpp13
-rw-r--r--drivers/xaudio2/audio_driver_xaudio2.h2
2 files changed, 0 insertions, 15 deletions
diff --git a/drivers/xaudio2/audio_driver_xaudio2.cpp b/drivers/xaudio2/audio_driver_xaudio2.cpp
index d12ebf8d94..9ff1030165 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.cpp
+++ b/drivers/xaudio2/audio_driver_xaudio2.cpp
@@ -38,7 +38,6 @@ const char *AudioDriverXAudio2::get_name() const {
}
Error AudioDriverXAudio2::init() {
-
active = false;
thread_exited = false;
exit_thread = false;
@@ -85,19 +84,15 @@ Error AudioDriverXAudio2::init() {
}
void AudioDriverXAudio2::thread_func(void *p_udata) {
-
AudioDriverXAudio2 *ad = (AudioDriverXAudio2 *)p_udata;
while (!ad->exit_thread) {
-
if (!ad->active) {
-
for (int i = 0; i < AUDIO_BUFFERS; i++) {
ad->xaudio_buffer[i].Flags = XAUDIO2_END_OF_STREAM;
}
} else {
-
ad->lock();
ad->audio_server_process(ad->buffer_size, ad->samples_in);
@@ -105,7 +100,6 @@ void AudioDriverXAudio2::thread_func(void *p_udata) {
ad->unlock();
for (unsigned int i = 0; i < ad->buffer_size * ad->channels; i++) {
-
ad->samples_out[ad->current_buffer][i] = ad->samples_in[i] >> 16;
}
@@ -128,24 +122,20 @@ void AudioDriverXAudio2::thread_func(void *p_udata) {
}
void AudioDriverXAudio2::start() {
-
active = true;
HRESULT hr = source_voice->Start(0);
ERR_FAIL_COND_MSG(hr != S_OK, "Error starting XAudio2 driver. Error code: " + itos(hr) + ".");
}
int AudioDriverXAudio2::get_mix_rate() const {
-
return mix_rate;
}
AudioDriver::SpeakerMode AudioDriverXAudio2::get_speaker_mode() const {
-
return speaker_mode;
}
float AudioDriverXAudio2::get_latency() {
-
XAUDIO2_PERFORMANCE_DATA perf_data;
xaudio->GetPerformanceData(&perf_data);
if (perf_data.CurrentLatencyInSamples) {
@@ -156,20 +146,17 @@ float AudioDriverXAudio2::get_latency() {
}
void AudioDriverXAudio2::lock() {
-
if (!thread)
return;
mutex.lock();
}
void AudioDriverXAudio2::unlock() {
-
if (!thread)
return;
mutex.unlock();
}
void AudioDriverXAudio2::finish() {
-
if (!thread)
return;
diff --git a/drivers/xaudio2/audio_driver_xaudio2.h b/drivers/xaudio2/audio_driver_xaudio2.h
index 9182fa4172..7fc1bb428d 100644
--- a/drivers/xaudio2/audio_driver_xaudio2.h
+++ b/drivers/xaudio2/audio_driver_xaudio2.h
@@ -41,13 +41,11 @@
#include <xaudio2.h>
class AudioDriverXAudio2 : public AudioDriver {
-
enum {
AUDIO_BUFFERS = 2
};
struct XAudio2DriverVoiceCallback : public IXAudio2VoiceCallback {
-
HANDLE buffer_end_event;
XAudio2DriverVoiceCallback() :
buffer_end_event(CreateEvent(nullptr, FALSE, FALSE, nullptr)) {}