Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions src/per/sai.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class SaiHandle::Impl
SaiHandle::Result StopDmaTransfer();

// Utility functions
float GetSampleRate();
constexpr float GetSampleRate();
size_t GetBlockSize();
float GetBlockRate();

Expand Down Expand Up @@ -333,17 +333,9 @@ SaiHandle::Result SaiHandle::Impl::StopDmaTransfer()
return Result::OK;
}

float SaiHandle::Impl::GetSampleRate()
constexpr float SaiHandle::Impl::GetSampleRate()
{
switch(config_.sr)
{
case Config::SampleRate::SAI_8KHZ: return 8000.f;
case Config::SampleRate::SAI_16KHZ: return 16000.f;
case Config::SampleRate::SAI_32KHZ: return 32000.f;
case Config::SampleRate::SAI_48KHZ: return 48000.f;
case Config::SampleRate::SAI_96KHZ: return 96000.f;
default: return 48000.f;
}
return config_.sr;
}
size_t SaiHandle::Impl::GetBlockSize()
{
Expand Down
12 changes: 6 additions & 6 deletions src/per/sai.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,13 @@ class SaiHandle
};

/** Rate at which samples will be streaming to/from the device. */
enum class SampleRate
enum SampleRate : int
{
SAI_8KHZ,
SAI_16KHZ,
SAI_32KHZ,
SAI_48KHZ,
SAI_96KHZ,
SAI_8KHZ = 8000,
SAI_16KHZ = 16000,
SAI_32KHZ = 32000,
SAI_48KHZ = 48000,
SAI_96KHZ = 96000,
};

/** Bit Depth that the hardware expects to be transferred to/from the device. */
Expand Down