#pragma once #include "ehs/EHS.h" #include "BaseAudioDevice.h" #include #include #include #include #include #include namespace ehs { class EHS_LIB_IO AudioDevice : public BaseAudioDevice { private: static Array devices; static AudioDevice defOut; static AudioDevice defIn; UInt_32 id; Str_8 name; pw_loop *loop; pw_context *context; pw_core *core; pw_stream *stream; static void RegistryEventGlobal(void *user_data, UInt_32 id, UInt_32 permissions, const char *type, UInt_32 version, const spa_dict *props); static void RegistryEventGlobalRemove(void *user_data, UInt_32 id); public: ~AudioDevice() override; AudioDevice(); AudioDevice(AudioDevice&& device) noexcept; AudioDevice(const AudioDevice& device); AudioDevice& operator=(AudioDevice&& device) noexcept; AudioDevice& operator=(const AudioDevice& device); void Release() override; void OpenStream() override; void CloseStream() override; UInt_64 SendStream(void *data, UInt_64 size) override; bool IsValid() const override; static AudioDevice GetDefault(AudioDeviceType type); static Array Get(AudioDeviceType type, AudioDeviceState state); }; }