summaryrefslogtreecommitdiff
path: root/platform/web
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 /platform/web
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 'platform/web')
-rw-r--r--platform/web/audio_driver_web.cpp8
-rw-r--r--platform/web/audio_driver_web.h14
-rw-r--r--platform/web/godot_audio.h4
-rw-r--r--platform/web/js/libs/library_godot_audio.js12
4 files changed, 20 insertions, 18 deletions
diff --git a/platform/web/audio_driver_web.cpp b/platform/web/audio_driver_web.cpp
index a5234627d1..1d7b96d707 100644
--- a/platform/web/audio_driver_web.cpp
+++ b/platform/web/audio_driver_web.cpp
@@ -166,18 +166,18 @@ void AudioDriverWeb::finish() {
}
}
-Error AudioDriverWeb::capture_start() {
+Error AudioDriverWeb::input_start() {
lock();
input_buffer_init(buffer_length);
unlock();
- if (godot_audio_capture_start()) {
+ if (godot_audio_input_start()) {
return FAILED;
}
return OK;
}
-Error AudioDriverWeb::capture_stop() {
- godot_audio_capture_stop();
+Error AudioDriverWeb::input_stop() {
+ godot_audio_input_stop();
lock();
input_buffer.clear();
unlock();
diff --git a/platform/web/audio_driver_web.h b/platform/web/audio_driver_web.h
index f3afbdbb92..be13935bd9 100644
--- a/platform/web/audio_driver_web.h
+++ b/platform/web/audio_driver_web.h
@@ -77,12 +77,12 @@ public:
virtual void start() final;
virtual void finish() final;
- virtual float get_latency() override;
virtual int get_mix_rate() const override;
virtual SpeakerMode get_speaker_mode() const override;
+ virtual float get_latency() override;
- virtual Error capture_start() override;
- virtual Error capture_stop() override;
+ virtual Error input_start() override;
+ virtual Error input_stop() override;
static void resume();
@@ -111,10 +111,12 @@ protected:
virtual void finish_driver() override;
public:
- virtual const char *get_name() const override { return "AudioWorklet"; }
+ virtual const char *get_name() const override {
+ return "AudioWorklet";
+ }
- void lock() override;
- void unlock() override;
+ virtual void lock() override;
+ virtual void unlock() override;
};
#endif // AUDIO_DRIVER_WEB_H
diff --git a/platform/web/godot_audio.h b/platform/web/godot_audio.h
index d7bff078f8..c6f92161fa 100644
--- a/platform/web/godot_audio.h
+++ b/platform/web/godot_audio.h
@@ -43,8 +43,8 @@ extern int godot_audio_has_script_processor();
extern int godot_audio_init(int *p_mix_rate, int p_latency, void (*_state_cb)(int), void (*_latency_cb)(float));
extern void godot_audio_resume();
-extern int godot_audio_capture_start();
-extern void godot_audio_capture_stop();
+extern int godot_audio_input_start();
+extern void godot_audio_input_stop();
// Worklet
typedef int32_t GodotAudioState[4];
diff --git a/platform/web/js/libs/library_godot_audio.js b/platform/web/js/libs/library_godot_audio.js
index 68348a3962..1993d66310 100644
--- a/platform/web/js/libs/library_godot_audio.js
+++ b/platform/web/js/libs/library_godot_audio.js
@@ -186,17 +186,17 @@ const GodotAudio = {
}
},
- godot_audio_capture_start__proxy: 'sync',
- godot_audio_capture_start__sig: 'i',
- godot_audio_capture_start: function () {
+ godot_audio_input_start__proxy: 'sync',
+ godot_audio_input_start__sig: 'i',
+ godot_audio_input_start: function () {
return GodotAudio.create_input(function (input) {
input.connect(GodotAudio.driver.get_node());
});
},
- godot_audio_capture_stop__proxy: 'sync',
- godot_audio_capture_stop__sig: 'v',
- godot_audio_capture_stop: function () {
+ godot_audio_input_stop__proxy: 'sync',
+ godot_audio_input_stop__sig: 'v',
+ godot_audio_input_stop: function () {
if (GodotAudio.input) {
const tracks = GodotAudio.input['mediaStream']['getTracks']();
for (let i = 0; i < tracks.length; i++) {