41 lines
880 B
C++
41 lines
880 B
C++
#pragma once
|
|
|
|
#include <memory>
|
|
#include <alsa/asoundlib.h>
|
|
|
|
#include "IAudioInterface.h"
|
|
|
|
#include "AudioDevice.h"
|
|
|
|
class AlsaInterface : public IAudioInterface
|
|
{
|
|
snd_pcm_t* mHandle;
|
|
snd_pcm_hw_params_t* mHardwareParams;
|
|
snd_pcm_uframes_t mPeriodSize;
|
|
|
|
public:
|
|
|
|
AlsaInterface();
|
|
|
|
~AlsaInterface();
|
|
|
|
static std::unique_ptr<AlsaInterface> Create();
|
|
|
|
void OpenDevice(const AudioDevicePtr& device) override;
|
|
|
|
void SetAccessType(const AudioDevicePtr& device);
|
|
|
|
void SetSampleFormat(const AudioDevicePtr& device);
|
|
|
|
void SetSampleRate(const AudioDevicePtr& device);
|
|
|
|
void SetPeriod(const AudioDevicePtr& device);
|
|
|
|
void SetBufferSize(const AudioDevicePtr& device);
|
|
|
|
void SetChannelNumber(const AudioDevicePtr& device);
|
|
|
|
void Play(const AudioDevicePtr& device) override;
|
|
};
|
|
|
|
using AlsaInterfacePtr = std::shared_ptr<AlsaInterface>;
|