stuff-from-scratch/src/audio/AudioDevice.cpp
2021-03-29 21:31:24 +01:00

71 lines
1 KiB
C++

#include "AudioDevice.h"
AudioDevice::AudioDevice()
: mName("plughw:1,0"),
mSampleRate(44100),
mNumChannels(2),
mPeriod(2),
mBufferSize()
{
}
AudioDevice::~AudioDevice()
{
}
std::unique_ptr<AudioDevice> AudioDevice::Create()
{
return std::make_unique<AudioDevice>();
}
void AudioDevice::SetNumChannels(unsigned numChannels)
{
mNumChannels = numChannels;
}
void AudioDevice::SetPeriod(unsigned period)
{
mPeriod = period;
}
void AudioDevice::SetBufferSize(std::size_t bufferSize)
{
mBufferSize = bufferSize;
}
unsigned AudioDevice::GetNumChannels() const
{
return mNumChannels;
}
unsigned AudioDevice::GetPeriod() const
{
return mPeriod;
}
std::size_t AudioDevice::GetBufferSize() const
{
return mBufferSize;
}
void AudioDevice::SetSampleRate(unsigned rate)
{
mSampleRate = rate;
}
unsigned AudioDevice::GetSampleRate() const
{
return mSampleRate;
}
void AudioDevice::SetName(const std::string& name)
{
mName = name;
}
std::string AudioDevice::GetName() const
{
return mName;
}