From 0be6d925dc3c6413bce7a3ccb49631b8e4a6e67a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Verschelde?= Date: Thu, 14 May 2020 13:23:58 +0200 Subject: 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. --- drivers/wasapi/audio_driver_wasapi.cpp | 27 --------------------------- drivers/wasapi/audio_driver_wasapi.h | 1 - 2 files changed, 28 deletions(-) (limited to 'drivers/wasapi') diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp index 1fc01ce76e..707e55cfcb 100644 --- a/drivers/wasapi/audio_driver_wasapi.cpp +++ b/drivers/wasapi/audio_driver_wasapi.cpp @@ -139,7 +139,6 @@ public: static CMMNotificationClient notif_client; Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_capture, bool reinit) { - WAVEFORMATEX *pwfex; IMMDeviceEnumerator *enumerator = nullptr; IMMDevice *device = nullptr; @@ -311,7 +310,6 @@ Error AudioDriverWASAPI::audio_device_init(AudioDeviceWASAPI *p_device, bool p_c } Error AudioDriverWASAPI::init_render_device(bool reinit) { - Error err = audio_device_init(&audio_output, false, reinit); if (err != OK) return err; @@ -350,7 +348,6 @@ Error AudioDriverWASAPI::init_render_device(bool reinit) { } Error AudioDriverWASAPI::init_capture_device(bool reinit) { - Error err = audio_device_init(&audio_input, true, reinit); if (err != OK) return err; @@ -366,7 +363,6 @@ Error AudioDriverWASAPI::init_capture_device(bool reinit) { } Error AudioDriverWASAPI::audio_device_finish(AudioDeviceWASAPI *p_device) { - if (p_device->active) { if (p_device->audio_client) { p_device->audio_client->Stop(); @@ -383,17 +379,14 @@ Error AudioDriverWASAPI::audio_device_finish(AudioDeviceWASAPI *p_device) { } Error AudioDriverWASAPI::finish_render_device() { - return audio_device_finish(&audio_output); } Error AudioDriverWASAPI::finish_capture_device() { - return audio_device_finish(&audio_input); } Error AudioDriverWASAPI::init() { - mix_rate = GLOBAL_DEF_RST("audio/mix_rate", DEFAULT_MIX_RATE); Error err = init_render_device(); @@ -410,17 +403,14 @@ Error AudioDriverWASAPI::init() { } int AudioDriverWASAPI::get_mix_rate() const { - return mix_rate; } AudioDriver::SpeakerMode AudioDriverWASAPI::get_speaker_mode() const { - return get_speaker_mode_by_total_channels(channels); } Array AudioDriverWASAPI::audio_device_get_list(bool p_capture) { - Array list; IMMDeviceCollection *devices = nullptr; IMMDeviceEnumerator *enumerator = nullptr; @@ -468,12 +458,10 @@ Array AudioDriverWASAPI::audio_device_get_list(bool p_capture) { } Array AudioDriverWASAPI::get_device_list() { - return audio_device_get_list(false); } String AudioDriverWASAPI::get_device() { - lock(); String name = audio_output.device_name; unlock(); @@ -482,7 +470,6 @@ String AudioDriverWASAPI::get_device() { } void AudioDriverWASAPI::set_device(String device) { - lock(); audio_output.new_device = device; unlock(); @@ -550,13 +537,11 @@ void AudioDriverWASAPI::write_sample(WORD format_tag, int bits_per_sample, BYTE } void AudioDriverWASAPI::thread_func(void *p_udata) { - AudioDriverWASAPI *ad = (AudioDriverWASAPI *)p_udata; uint32_t avail_frames = 0; uint32_t write_ofs = 0; while (!ad->exit_thread) { - uint32_t read_frames = 0; uint32_t written_frames = 0; @@ -583,19 +568,16 @@ void AudioDriverWASAPI::thread_func(void *p_udata) { ad->start_counting_ticks(); if (avail_frames > 0 && ad->audio_output.audio_client) { - UINT32 cur_frames; bool invalidated = false; HRESULT hr = ad->audio_output.audio_client->GetCurrentPadding(&cur_frames); if (hr == S_OK) { - // Check how much frames are available on the WASAPI buffer UINT32 write_frames = MIN(ad->buffer_frames - cur_frames, avail_frames); if (write_frames > 0) { BYTE *buffer = nullptr; hr = ad->audio_output.render_client->GetBuffer(write_frames, &buffer); if (hr == S_OK) { - // We're using WASAPI Shared Mode so we must convert the buffer if (ad->channels == ad->audio_output.channels) { for (unsigned int i = 0; i < write_frames * ad->channels; i++) { @@ -766,7 +748,6 @@ void AudioDriverWASAPI::thread_func(void *p_udata) { } void AudioDriverWASAPI::start() { - if (audio_output.audio_client) { HRESULT hr = audio_output.audio_client->Start(); if (hr != S_OK) { @@ -778,17 +759,14 @@ void AudioDriverWASAPI::start() { } void AudioDriverWASAPI::lock() { - mutex.lock(); } void AudioDriverWASAPI::unlock() { - mutex.unlock(); } void AudioDriverWASAPI::finish() { - if (thread) { exit_thread = true; Thread::wait_to_finish(thread); @@ -802,7 +780,6 @@ void AudioDriverWASAPI::finish() { } Error AudioDriverWASAPI::capture_start() { - Error err = init_capture_device(); if (err != OK) { ERR_PRINT("WASAPI: init_capture_device error"); @@ -819,7 +796,6 @@ Error AudioDriverWASAPI::capture_start() { } Error AudioDriverWASAPI::capture_stop() { - if (audio_input.active) { audio_input.audio_client->Stop(); audio_input.active = false; @@ -831,19 +807,16 @@ Error AudioDriverWASAPI::capture_stop() { } void AudioDriverWASAPI::capture_set_device(const String &p_name) { - lock(); audio_input.new_device = p_name; unlock(); } Array AudioDriverWASAPI::capture_get_device_list() { - return audio_device_get_list(true); } String AudioDriverWASAPI::capture_get_device() { - lock(); String name = audio_input.device_name; unlock(); diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h index 2fcf8936fa..41ff7c9895 100644 --- a/drivers/wasapi/audio_driver_wasapi.h +++ b/drivers/wasapi/audio_driver_wasapi.h @@ -42,7 +42,6 @@ #include class AudioDriverWASAPI : public AudioDriver { - class AudioDeviceWASAPI { public: IAudioClient *audio_client = nullptr; -- cgit v1.2.3