summaryrefslogtreecommitdiff
path: root/drivers/wasapi
diff options
context:
space:
mode:
authorEmmanouil Papadeas <manoschool@yahoo.gr>2023-02-08 17:40:15 +0200
committerRémi Verschelde <rverschelde@gmail.com>2023-02-09 11:02:00 +0100
commitc36460060ea434158c2069d696880cbaf4431123 (patch)
tree79e045ef1939b8daad696cc0a074778f9c61ae53 /drivers/wasapi
parentd69809cab603cae9f525768337affe5e12e454a8 (diff)
Further refactoring to AudioDriver implementations after #69120.
- Rename all instances of `capture_start()` and `capture_end()` to their new names. Fixes #72892. - More internal renames to match what was started in #69120. - Use `override` consistently so that such refactoring bugs can be caught. - Harmonize the order of definition of the overridden virtual methods in each audio driver. - Harmonize prototype for `set_output_device` and `set_input_device`. Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Diffstat (limited to 'drivers/wasapi')
-rw-r--r--drivers/wasapi/audio_driver_wasapi.cpp16
-rw-r--r--drivers/wasapi/audio_driver_wasapi.h39
2 files changed, 29 insertions, 26 deletions
diff --git a/drivers/wasapi/audio_driver_wasapi.cpp b/drivers/wasapi/audio_driver_wasapi.cpp
index 42a2b85200..72ec0c19ab 100644
--- a/drivers/wasapi/audio_driver_wasapi.cpp
+++ b/drivers/wasapi/audio_driver_wasapi.cpp
@@ -634,9 +634,9 @@ String AudioDriverWASAPI::get_output_device() {
return name;
}
-void AudioDriverWASAPI::set_output_device(String output_device) {
+void AudioDriverWASAPI::set_output_device(const String &p_name) {
lock();
- audio_output.new_device = output_device;
+ audio_output.new_device = p_name;
unlock();
}
@@ -964,12 +964,6 @@ Error AudioDriverWASAPI::input_stop() {
return FAILED;
}
-void AudioDriverWASAPI::set_input_device(const String &p_name) {
- lock();
- audio_input.new_device = p_name;
- unlock();
-}
-
PackedStringArray AudioDriverWASAPI::get_input_device_list() {
return audio_device_get_list(true);
}
@@ -982,6 +976,12 @@ String AudioDriverWASAPI::get_input_device() {
return name;
}
+void AudioDriverWASAPI::set_input_device(const String &p_name) {
+ lock();
+ audio_input.new_device = p_name;
+ unlock();
+}
+
AudioDriverWASAPI::AudioDriverWASAPI() {
samples_in.clear();
}
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h
index bf18ba8c99..367c30607a 100644
--- a/drivers/wasapi/audio_driver_wasapi.h
+++ b/drivers/wasapi/audio_driver_wasapi.h
@@ -94,27 +94,30 @@ class AudioDriverWASAPI : public AudioDriver {
PackedStringArray audio_device_get_list(bool p_input);
public:
- virtual const char *get_name() const {
+ virtual const char *get_name() const override {
return "WASAPI";
}
- virtual Error init();
- virtual void start();
- virtual int get_mix_rate() const;
- virtual float get_latency();
- virtual SpeakerMode get_speaker_mode() const;
- virtual PackedStringArray get_output_device_list();
- virtual String get_output_device();
- virtual void set_output_device(String output_device);
- virtual void lock();
- virtual void unlock();
- virtual void finish();
-
- virtual Error input_start();
- virtual Error input_stop();
- virtual PackedStringArray get_input_device_list();
- virtual void set_input_device(const String &p_name);
- virtual String get_input_device();
+ virtual Error init() override;
+ virtual void start() override;
+ virtual int get_mix_rate() const override;
+ virtual SpeakerMode get_speaker_mode() const override;
+ virtual float get_latency() override;
+
+ virtual void lock() override;
+ virtual void unlock() override;
+ virtual void finish() override;
+
+ virtual PackedStringArray get_output_device_list() override;
+ virtual String get_output_device() override;
+ virtual void set_output_device(const String &p_name) override;
+
+ virtual Error input_start() override;
+ virtual Error input_stop() override;
+
+ virtual PackedStringArray get_input_device_list() override;
+ virtual String get_input_device() override;
+ virtual void set_input_device(const String &p_name) override;
AudioDriverWASAPI();
};