diff options
Diffstat (limited to 'servers/audio/audio_driver_dummy.h')
-rw-r--r-- | servers/audio/audio_driver_dummy.h | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/servers/audio/audio_driver_dummy.h b/servers/audio/audio_driver_dummy.h index 68b523e086..46dd2e1439 100644 --- a/servers/audio/audio_driver_dummy.h +++ b/servers/audio/audio_driver_dummy.h @@ -35,6 +35,7 @@ #include "core/os/mutex.h" #include "core/os/thread.h" +#include "core/templates/safe_refcount.h" class AudioDriverDummy : public AudioDriver { Thread thread; @@ -44,15 +45,18 @@ class AudioDriverDummy : public AudioDriver { static void thread_func(void *p_udata); - unsigned int buffer_frames; - unsigned int mix_rate; - SpeakerMode speaker_mode; + uint32_t buffer_frames = 4096; + int32_t mix_rate = -1; + SpeakerMode speaker_mode = SPEAKER_MODE_STEREO; int channels; - bool active; - bool thread_exited; - mutable bool exit_thread; + SafeFlag active; + SafeFlag exit_thread; + + bool use_threads = true; + + static AudioDriverDummy *singleton; public: const char *get_name() const { @@ -67,8 +71,18 @@ public: virtual void unlock(); virtual void finish(); - AudioDriverDummy() {} + void set_use_threads(bool p_use_threads); + void set_speaker_mode(SpeakerMode p_mode); + void set_mix_rate(int p_rate); + + uint32_t get_channels() const; + + void mix_audio(int p_frames, int32_t *p_buffer); + + static AudioDriverDummy *get_dummy_singleton() { return singleton; } + + AudioDriverDummy(); ~AudioDriverDummy() {} }; -#endif +#endif // AUDIO_DRIVER_DUMMY_H |