Skip to content

Commit

Permalink
[Web] Restore ScriptAudioWorkletFallback
Browse files Browse the repository at this point in the history
  • Loading branch information
Faless committed Dec 10, 2024
1 parent a372214 commit 634d848
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions platform/web/audio_driver_web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,8 @@ void AudioDriverWorklet::_capture_callback(int p_pos, int p_samples) {
driver->_audio_driver_capture(p_pos, p_samples);
}

#endif // THREADS_ENABLED

/// ScriptProcessorNode implementation
AudioDriverScriptProcessor *AudioDriverScriptProcessor::singleton = nullptr;

Expand All @@ -497,5 +499,3 @@ Error AudioDriverScriptProcessor::create(int &p_buffer_samples, int p_channels)
void AudioDriverScriptProcessor::start(float *p_out_buf, int p_out_buf_size, float *p_in_buf, int p_in_buf_size) {
godot_audio_script_start(p_in_buf, p_in_buf_size, p_out_buf, p_out_buf_size, &_process_callback);
}

#endif // THREADS_ENABLED
5 changes: 2 additions & 3 deletions platform/web/audio_driver_web.h
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,8 @@ class AudioDriverWorklet : public AudioDriverWeb {
AudioDriverWorklet() { singleton = this; }
};

#endif // THREADS_ENABLED

class AudioDriverScriptProcessor : public AudioDriverWeb {
private:
static void _process_callback();
Expand All @@ -178,7 +180,6 @@ class AudioDriverScriptProcessor : public AudioDriverWeb {
protected:
virtual Error create(int &p_buffer_size, int p_output_channels) override;
virtual void start(float *p_out_buf, int p_out_buf_size, float *p_in_buf, int p_in_buf_size) override;
virtual void finish_driver() override;

public:
virtual const char *get_name() const override { return "ScriptProcessor"; }
Expand All @@ -191,6 +192,4 @@ class AudioDriverScriptProcessor : public AudioDriverWeb {
AudioDriverScriptProcessor() { singleton = this; }
};

#endif // THREADS_ENABLED

#endif // AUDIO_DRIVER_WEB_H
1 change: 1 addition & 0 deletions platform/web/os_web.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,7 @@ OS_Web::OS_Web() {

if (AudioDriverWeb::is_available()) {
audio_drivers.push_back(memnew(AudioDriverWorklet));
audio_drivers.push_back(memnew(AudioDriverScriptProcessor));
}
for (AudioDriverWeb *audio_driver : audio_drivers) {
AudioDriverManager::add_driver(audio_driver);
Expand Down

0 comments on commit 634d848

Please sign in to comment.