summaryrefslogtreecommitdiff
path: root/drivers/coreaudio
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/coreaudio
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/coreaudio')
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.cpp30
-rw-r--r--drivers/coreaudio/audio_driver_coreaudio.h44
2 files changed, 37 insertions, 37 deletions
diff --git a/drivers/coreaudio/audio_driver_coreaudio.cpp b/drivers/coreaudio/audio_driver_coreaudio.cpp
index c454da8e23..2c959bb07b 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.cpp
+++ b/drivers/coreaudio/audio_driver_coreaudio.cpp
@@ -158,7 +158,7 @@ Error AudioDriverCoreAudio::init() {
ERR_FAIL_COND_V(result != noErr, FAILED);
if (GLOBAL_GET("audio/driver/enable_input")) {
- return capture_init();
+ return init_input_device();
}
return OK;
}
@@ -287,7 +287,7 @@ bool AudioDriverCoreAudio::try_lock() {
}
void AudioDriverCoreAudio::finish() {
- capture_finish();
+ finish_input_device();
if (audio_unit) {
OSStatus result;
@@ -337,7 +337,7 @@ void AudioDriverCoreAudio::finish() {
}
}
-Error AudioDriverCoreAudio::capture_init() {
+Error AudioDriverCoreAudio::init_input_device() {
AudioComponentDescription desc;
memset(&desc, 0, sizeof(desc));
desc.componentType = kAudioUnitType_Output;
@@ -433,7 +433,7 @@ Error AudioDriverCoreAudio::capture_init() {
return OK;
}
-void AudioDriverCoreAudio::capture_finish() {
+void AudioDriverCoreAudio::finish_input_device() {
if (input_unit) {
lock();
@@ -471,7 +471,7 @@ void AudioDriverCoreAudio::capture_finish() {
}
}
-Error AudioDriverCoreAudio::capture_start() {
+Error AudioDriverCoreAudio::input_start() {
input_buffer_init(buffer_frames);
OSStatus result = AudioOutputUnitStart(input_unit);
@@ -482,7 +482,7 @@ Error AudioDriverCoreAudio::capture_start() {
return OK;
}
-Error AudioDriverCoreAudio::capture_stop() {
+Error AudioDriverCoreAudio::input_stop() {
if (input_unit) {
OSStatus result = AudioOutputUnitStop(input_unit);
if (result != noErr) {
@@ -647,20 +647,13 @@ String AudioDriverCoreAudio::get_output_device() {
return output_device_name;
}
-void AudioDriverCoreAudio::set_output_device(String output_device) {
- output_device_name = output_device;
+void AudioDriverCoreAudio::set_output_device(const String &p_name) {
+ output_device_name = p_name;
if (active) {
_set_device(output_device_name);
}
}
-void AudioDriverCoreAudio::set_input_device(const String &p_name) {
- input_device_name = p_name;
- if (active) {
- _set_device(input_device_name, true);
- }
-}
-
PackedStringArray AudioDriverCoreAudio::get_input_device_list() {
return _get_device_list(true);
}
@@ -669,6 +662,13 @@ String AudioDriverCoreAudio::get_input_device() {
return input_device_name;
}
+void AudioDriverCoreAudio::set_input_device(const String &p_name) {
+ input_device_name = p_name;
+ if (active) {
+ _set_device(input_device_name, true);
+ }
+}
+
#endif
AudioDriverCoreAudio::AudioDriverCoreAudio() {
diff --git a/drivers/coreaudio/audio_driver_coreaudio.h b/drivers/coreaudio/audio_driver_coreaudio.h
index 2b192e630e..67ff3f3efc 100644
--- a/drivers/coreaudio/audio_driver_coreaudio.h
+++ b/drivers/coreaudio/audio_driver_coreaudio.h
@@ -83,39 +83,39 @@ class AudioDriverCoreAudio : public AudioDriver {
UInt32 inBusNumber, UInt32 inNumberFrames,
AudioBufferList *ioData);
- Error capture_init();
- void capture_finish();
+ Error init_input_device();
+ void finish_input_device();
public:
- const char *get_name() const {
+ virtual const char *get_name() const override {
return "CoreAudio";
};
- virtual Error init();
- virtual void start();
- virtual int get_mix_rate() const;
- virtual SpeakerMode get_speaker_mode() const;
+ virtual Error init() override;
+ virtual void start() override;
+ virtual int get_mix_rate() const override;
+ virtual SpeakerMode get_speaker_mode() const override;
- virtual void lock();
- virtual void unlock();
- virtual void finish();
-
- virtual Error capture_start();
- virtual Error capture_stop();
-
- bool try_lock();
- void stop();
+ virtual void lock() override;
+ virtual void unlock() override;
+ virtual void finish() override;
#ifdef MACOS_ENABLED
- virtual PackedStringArray get_output_device_list();
- virtual String get_output_device();
- virtual void set_output_device(String output_device);
+ virtual PackedStringArray get_output_device_list() override;
+ virtual String get_output_device() override;
+ virtual void set_output_device(const String &p_name) override;
- virtual PackedStringArray get_input_device_list();
- virtual void set_input_device(const String &p_name);
- virtual String get_input_device();
+ virtual PackedStringArray get_input_device_list() override;
+ virtual String get_input_device() override;
+ virtual void set_input_device(const String &p_name) override;
#endif
+ virtual Error input_start() override;
+ virtual Error input_stop() override;
+
+ bool try_lock();
+ void stop();
+
AudioDriverCoreAudio();
~AudioDriverCoreAudio() {}
};