diff options
Diffstat (limited to 'drivers/wasapi/audio_driver_wasapi.h')
-rw-r--r-- | drivers/wasapi/audio_driver_wasapi.h | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/drivers/wasapi/audio_driver_wasapi.h b/drivers/wasapi/audio_driver_wasapi.h index f3ee5976eb..3d94f3ba49 100644 --- a/drivers/wasapi/audio_driver_wasapi.h +++ b/drivers/wasapi/audio_driver_wasapi.h @@ -43,35 +43,63 @@ class AudioDriverWASAPI : public AudioDriver { - HANDLE event; - IAudioClient *audio_client; - IAudioRenderClient *render_client; + class AudioDeviceWASAPI { + public: + IAudioClient *audio_client; + IAudioRenderClient *render_client; + IAudioCaptureClient *capture_client; + bool active; + + WORD format_tag; + WORD bits_per_sample; + unsigned int channels; + unsigned int frame_size; + + String device_name; + String new_device; + + AudioDeviceWASAPI() { + audio_client = NULL; + render_client = NULL; + capture_client = NULL; + active = false; + format_tag = 0; + bits_per_sample = 0; + channels = 0; + frame_size = 0; + device_name = "Default"; + new_device = "Default"; + } + }; + + AudioDeviceWASAPI audio_input; + AudioDeviceWASAPI audio_output; + Mutex *mutex; Thread *thread; - String device_name; - String new_device; - - WORD format_tag; - WORD bits_per_sample; - Vector<int32_t> samples_in; - unsigned int buffer_size; unsigned int channels; - unsigned int wasapi_channels; int mix_rate; int buffer_frames; bool thread_exited; mutable bool exit_thread; - bool active; - _FORCE_INLINE_ void write_sample(AudioDriverWASAPI *ad, BYTE *buffer, int i, int32_t sample); + static _FORCE_INLINE_ void write_sample(WORD format_tag, int bits_per_sample, BYTE *buffer, int i, int32_t sample); + static _FORCE_INLINE_ int32_t read_sample(WORD format_tag, int bits_per_sample, BYTE *buffer, int i); static void thread_func(void *p_udata); - Error init_device(bool reinit = false); - Error finish_device(); + Error init_render_device(bool reinit = false); + Error init_capture_device(bool reinit = false); + + Error finish_render_device(); + Error finish_capture_device(); + + Error audio_device_init(AudioDeviceWASAPI *p_device, bool p_capture, bool reinit); + Error audio_device_finish(AudioDeviceWASAPI *p_device); + Array audio_device_get_list(bool p_capture); public: virtual const char *get_name() const { @@ -89,6 +117,12 @@ public: virtual void unlock(); virtual void finish(); + virtual Error capture_start(); + virtual Error capture_stop(); + virtual Array capture_get_device_list(); + virtual void capture_set_device(const String &p_name); + virtual String capture_get_device(); + AudioDriverWASAPI(); }; |