61 lines
1.3 KiB
C++
61 lines
1.3 KiB
C++
#pragma once
|
|
|
|
#include "ehs/EHS.h"
|
|
#include "BaseAudioDevice.h"
|
|
|
|
#include <spa/param/audio/format-utils.h>
|
|
#include <pipewire/pipewire.h>
|
|
#include <pipewire/loop.h>
|
|
#include <pipewire/context.h>
|
|
#include <pipewire/stream.h>
|
|
#include <pipewire/keys.h>
|
|
|
|
namespace ehs
|
|
{
|
|
class EHS_LIB_IO AudioDevice : public BaseAudioDevice
|
|
{
|
|
private:
|
|
static Array<AudioDevice> 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<AudioDevice> Get(AudioDeviceType type, AudioDeviceState state);
|
|
};
|
|
}
|