Reorganized project again.
This commit is contained in:
171
src/io/audio/BaseAudioDevice.cpp
Normal file
171
src/io/audio/BaseAudioDevice.cpp
Normal file
@@ -0,0 +1,171 @@
|
||||
#include "io/audio/BaseAudioDevice.h"
|
||||
|
||||
namespace ehs
|
||||
{
|
||||
BaseAudioDevice::BaseAudioDevice()
|
||||
: type(AudioDeviceType::ALL), dataType(DataType::SINT_8), bitDepth(0), sampleRate(0), channels(0),
|
||||
period(20000), latency(150000), maxFrames(0), streaming(false)
|
||||
{
|
||||
}
|
||||
|
||||
BaseAudioDevice::BaseAudioDevice(const BaseAudioDevice& device)
|
||||
: type(device.type), dataType(device.dataType), bitDepth(device.bitDepth), sampleRate(device.sampleRate),
|
||||
channels(device.channels), period(device.period), latency(device.latency), maxFrames(0), streaming(false)
|
||||
{
|
||||
}
|
||||
|
||||
BaseAudioDevice& BaseAudioDevice::operator=(const BaseAudioDevice& device)
|
||||
{
|
||||
if (this == &device)
|
||||
return *this;
|
||||
|
||||
type = device.type;
|
||||
dataType = device.dataType;
|
||||
bitDepth = device.bitDepth;
|
||||
sampleRate = device.sampleRate;
|
||||
channels = device.channels;
|
||||
period = device.period;
|
||||
latency = device.latency;
|
||||
maxFrames = device.maxFrames;
|
||||
streaming = false;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::Release()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseAudioDevice::OpenStream()
|
||||
{
|
||||
}
|
||||
|
||||
void BaseAudioDevice::CloseStream()
|
||||
{
|
||||
}
|
||||
|
||||
UInt_64 BaseAudioDevice::GetAvailFrames() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
Byte* BaseAudioDevice::Map(UInt_64* offset, UInt_64* frames)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::UnMap(const UInt_64 offset, const UInt_64 frames)
|
||||
{
|
||||
}
|
||||
|
||||
AudioDeviceType BaseAudioDevice::GetType() const
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::SetDataType(const DataType newDataType)
|
||||
{
|
||||
if (streaming)
|
||||
return;
|
||||
|
||||
dataType = newDataType;
|
||||
bitDepth = ToBitDepth(newDataType);
|
||||
}
|
||||
|
||||
DataType BaseAudioDevice::GetDataType() const
|
||||
{
|
||||
return dataType;
|
||||
}
|
||||
|
||||
UInt_8 BaseAudioDevice::GetByteDepth() const
|
||||
{
|
||||
return bitDepth / 8;
|
||||
}
|
||||
|
||||
UInt_16 BaseAudioDevice::GetBitDepth() const
|
||||
{
|
||||
return bitDepth;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::SetSampleRate(const UInt_32 newSampleRate)
|
||||
{
|
||||
if (streaming)
|
||||
return;
|
||||
|
||||
sampleRate = newSampleRate;
|
||||
}
|
||||
|
||||
UInt_32 BaseAudioDevice::GetSampleRate() const
|
||||
{
|
||||
return sampleRate;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::SetChannels(const UInt_32 newChannels)
|
||||
{
|
||||
if (streaming)
|
||||
return;
|
||||
|
||||
channels = newChannels;
|
||||
}
|
||||
|
||||
UInt_16 BaseAudioDevice::GetChannels() const
|
||||
{
|
||||
return channels;
|
||||
}
|
||||
|
||||
UInt_32 BaseAudioDevice::GetFrameSize() const
|
||||
{
|
||||
return bitDepth / 8 * channels;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::SetPeriod(const UInt_32 newPeriod)
|
||||
{
|
||||
if (streaming)
|
||||
return;
|
||||
|
||||
period = newPeriod;
|
||||
}
|
||||
|
||||
UInt_32 BaseAudioDevice::GetPeriod() const
|
||||
{
|
||||
return period;
|
||||
}
|
||||
|
||||
void BaseAudioDevice::SetLatency(const UInt_32 newLatency)
|
||||
{
|
||||
if (streaming)
|
||||
return;
|
||||
|
||||
latency = newLatency;
|
||||
}
|
||||
|
||||
UInt_32 BaseAudioDevice::GetLatency() const
|
||||
{
|
||||
return latency;
|
||||
}
|
||||
|
||||
UInt_64 BaseAudioDevice::GetMaxFrames() const
|
||||
{
|
||||
return maxFrames;
|
||||
}
|
||||
|
||||
bool BaseAudioDevice::IsStreaming() const
|
||||
{
|
||||
return streaming;
|
||||
}
|
||||
|
||||
bool BaseAudioDevice::IsValid() const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
BaseAudioDevice BaseAudioDevice::GetDefault(const AudioDeviceType type)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
||||
Array<BaseAudioDevice> BaseAudioDevice::Get(const AudioDeviceType type, const AudioDeviceState state)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user