2020-12-05 13:08:24 +01:00
|
|
|
#include "stdafx.h"
|
2020-02-15 23:36:20 +01:00
|
|
|
#include "AudioBackend.h"
|
|
|
|
|
#include "Emu/system_config.h"
|
|
|
|
|
|
2021-11-24 19:41:05 +01:00
|
|
|
AudioBackend::AudioBackend() {}
|
2020-02-15 23:36:20 +01:00
|
|
|
|
2020-06-20 02:44:32 +02:00
|
|
|
/*
|
|
|
|
|
* Helper methods
|
|
|
|
|
*/
|
|
|
|
|
u32 AudioBackend::get_sampling_rate() const
|
|
|
|
|
{
|
2021-11-24 19:41:05 +01:00
|
|
|
return static_cast<std::underlying_type_t<decltype(m_sampling_rate)>>(m_sampling_rate);
|
2020-06-20 02:44:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 AudioBackend::get_sample_size() const
|
|
|
|
|
{
|
2021-11-24 19:41:05 +01:00
|
|
|
return static_cast<std::underlying_type_t<decltype(m_sample_size)>>(m_sample_size);
|
2020-06-20 02:44:32 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
u32 AudioBackend::get_channels() const
|
|
|
|
|
{
|
2021-11-24 19:41:05 +01:00
|
|
|
return static_cast<std::underlying_type_t<decltype(m_channels)>>(m_channels);
|
2020-06-20 02:44:32 +02:00
|
|
|
}
|
|
|
|
|
|
2021-11-24 19:41:05 +01:00
|
|
|
bool AudioBackend::get_convert_to_s16() const
|
2020-06-20 02:44:32 +02:00
|
|
|
{
|
2021-11-24 19:41:05 +01:00
|
|
|
return m_sample_size == AudioSampleSize::S16;
|
2020-06-20 02:44:32 +02:00
|
|
|
}
|
|
|
|
|
|
2020-02-15 23:36:20 +01:00
|
|
|
bool AudioBackend::has_capability(u32 cap) const
|
|
|
|
|
{
|
|
|
|
|
return (cap & GetCapabilities()) == cap;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void AudioBackend::dump_capabilities(std::string& out) const
|
|
|
|
|
{
|
|
|
|
|
u32 count = 0;
|
2021-04-09 21:12:47 +02:00
|
|
|
const u32 capabilities = GetCapabilities();
|
2020-02-15 23:36:20 +01:00
|
|
|
|
|
|
|
|
if (capabilities & SET_FREQUENCY_RATIO)
|
|
|
|
|
{
|
|
|
|
|
fmt::append(out, "%sSET_FREQUENCY_RATIO", count > 0 ? " | " : "");
|
|
|
|
|
count++;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (count == 0)
|
|
|
|
|
{
|
|
|
|
|
fmt::append(out, "NONE");
|
|
|
|
|
}
|
|
|
|
|
}
|