Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/sanear.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Marsev <alex.marsev@gmail.com>2016-02-24 12:33:09 +0300
committerAlex Marsev <alex.marsev@gmail.com>2016-02-24 13:14:36 +0300
commitd54e5c262e39672e8156b377a86e0df6ec432ed0 (patch)
tree1a671ef5be7634117d785e2174cdc65b138e7227
parent41809d145a2a97d856000db8f9ca37a25ccac138 (diff)
Add AudioDevice::GetChannelCount() helper
And refactor.
-rw-r--r--src/AudioDevice.h1
-rw-r--r--src/AudioRenderer.cpp6
-rw-r--r--src/MyPropertyPage.cpp2
3 files changed, 5 insertions, 4 deletions
diff --git a/src/AudioDevice.h b/src/AudioDevice.h
index c131197..09f81c2 100644
--- a/src/AudioDevice.h
+++ b/src/AudioDevice.h
@@ -63,6 +63,7 @@ namespace SaneAudioRenderer
SharedWaveFormat GetWaveFormat() const { return m_backend->waveFormat; }
uint32_t GetRate() const { return m_backend->waveFormat->nSamplesPerSec; }
+ uint32_t GetChannelCount() const { return m_backend->waveFormat->nChannels; }
DspFormat GetDspFormat() const { return m_backend->dspFormat; }
uint32_t GetBufferDuration() const { return m_backend->bufferDuration; }
REFERENCE_TIME GetStreamLatency() const { return m_backend->deviceLatency; }
diff --git a/src/AudioRenderer.cpp b/src/AudioRenderer.cpp
index 19ee5d5..a6e1fd9 100644
--- a/src/AudioRenderer.cpp
+++ b/src/AudioRenderer.cpp
@@ -535,7 +535,7 @@ namespace SaneAudioRenderer
{
size_t silenceFrames = m_device->GetRate() * m_device->GetBufferDuration() / 5000; // Buffer / 5
- DspChunk chunk = DspChunk(m_device->GetDspFormat(), m_device->GetWaveFormat()->nChannels,
+ DspChunk chunk = DspChunk(m_device->GetDspFormat(), m_device->GetChannelCount(),
silenceFrames, m_device->GetRate());
ZeroMemory(chunk.GetData(), chunk.GetSize());
@@ -666,7 +666,7 @@ namespace SaneAudioRenderer
{
jitter = std::min(jitter, llMulDiv(m_device->GetBufferDuration(), OneSecond, 1000, 0));
- DspChunk chunk(m_device->GetDspFormat(), m_device->GetWaveFormat()->nChannels,
+ DspChunk chunk(m_device->GetDspFormat(), m_device->GetChannelCount(),
(size_t)llMulDiv(jitter, m_device->GetRate(), OneSecond, 0), m_device->GetRate());
if (!chunk.IsEmpty())
@@ -825,7 +825,7 @@ namespace SaneAudioRenderer
const auto inChannels = m_inputFormat->nChannels;
const auto inMask = DspMatrix::GetChannelMask(*m_inputFormat);
const auto outRate = m_device->GetRate();
- const auto outChannels = m_device->GetWaveFormat()->nChannels;
+ const auto outChannels = m_device->GetChannelCount();
const auto outMask = DspMatrix::GetChannelMask(*m_device->GetWaveFormat());
#ifdef SANEAR_GPL_PHASE_VOCODER
diff --git a/src/MyPropertyPage.cpp b/src/MyPropertyPage.cpp
index e5d9d8f..bfec796 100644
--- a/src/MyPropertyPage.cpp
+++ b/src/MyPropertyPage.cpp
@@ -171,7 +171,7 @@ namespace SaneAudioRenderer
std::wstring channelsInputField = (inputFormat && !bitstreaming) ? std::to_wstring(inputFormat->nChannels) +
L" (" + GetHexString(DspMatrix::GetChannelMask(*inputFormat)) + L")" : L"-";
- std::wstring channelsDeviceField = (pDevice && !bitstreaming) ? std::to_wstring(pDevice->GetWaveFormat()->nChannels) +
+ std::wstring channelsDeviceField = (pDevice && !bitstreaming) ? std::to_wstring(pDevice->GetChannelCount()) +
L" (" + GetHexString(DspMatrix::GetChannelMask(*pDevice->GetWaveFormat())) + L")" : L"-";
std::wstring channelsField = (channelsInputField == channelsDeviceField) ?
channelsInputField : channelsInputField + L" -> " + channelsDeviceField;