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
path: root/src
diff options
context:
space:
mode:
authorAlex Marsev <alex.marsev@gmail.com>2014-12-02 21:34:50 +0300
committerAlex Marsev <alex.marsev@gmail.com>2014-12-02 21:36:12 +0300
commite58f8b4f26fd12cd1312bb8a5513679b16a3854f (patch)
treed0fbe846a575f9594da63008c244b3b45ffca990 /src
parent640b50e2c57310f592de7b25a7a58f825e6dcb57 (diff)
Add Processors field to status page
Diffstat (limited to 'src')
-rw-r--r--src/AudioRenderer.cpp36
-rw-r--r--src/AudioRenderer.h1
-rw-r--r--src/DspBalance.cpp5
-rw-r--r--src/DspBalance.h4
-rw-r--r--src/DspCrossfeed.cpp5
-rw-r--r--src/DspCrossfeed.h3
-rw-r--r--src/DspDither.cpp5
-rw-r--r--src/DspDither.h3
-rw-r--r--src/DspLimiter.cpp5
-rw-r--r--src/DspLimiter.h3
-rw-r--r--src/DspMatrix.cpp5
-rw-r--r--src/DspMatrix.h3
-rw-r--r--src/DspRate.cpp5
-rw-r--r--src/DspRate.h3
-rw-r--r--src/DspTempo.cpp5
-rw-r--r--src/DspTempo.h3
-rw-r--r--src/DspVolume.cpp5
-rw-r--r--src/DspVolume.h4
-rw-r--r--src/MyFilter.cpp2
-rw-r--r--src/MyPropertyPage.cpp18
-rw-r--r--src/MyPropertyPage.h3
21 files changed, 121 insertions, 5 deletions
diff --git a/src/AudioRenderer.cpp b/src/AudioRenderer.cpp
index 8bf4c15..24b2363 100644
--- a/src/AudioRenderer.cpp
+++ b/src/AudioRenderer.cpp
@@ -271,6 +271,42 @@ namespace SaneAudioRenderer
return std::make_unique<AudioDevice>(m_device);
}
+ std::vector<std::wstring> AudioRenderer::GetActiveProcessors()
+ {
+ CAutoLock objectLock(this);
+
+ std::vector<std::wstring> ret;
+
+ if (m_inputFormatInitialized && m_deviceInitialized)
+ {
+ if (m_dspMatrix.Active())
+ ret.emplace_back(m_dspMatrix.Name());
+
+ if (m_dspRate.Active())
+ ret.emplace_back(m_dspRate.Name());
+
+ if (m_dspTempo.Active())
+ ret.emplace_back(m_dspTempo.Name());
+
+ if (m_dspCrossfeed.Active())
+ ret.emplace_back(m_dspCrossfeed.Name());
+
+ if (m_dspVolume.Active())
+ ret.emplace_back(m_dspVolume.Name());
+
+ if (m_dspBalance.Active())
+ ret.emplace_back(m_dspBalance.Name());
+
+ if (m_dspLimiter.Active())
+ ret.emplace_back(m_dspLimiter.Name());
+
+ if (m_dspDither.Active())
+ ret.emplace_back(m_dspDither.Name());
+ }
+
+ return ret;
+ }
+
DspChunk AudioRenderer::PreProcess(IMediaSample* pSample, const AM_SAMPLE2_PROPERTIES& sampleProps)
{
CAutoLock objectLock(this);
diff --git a/src/AudioRenderer.h b/src/AudioRenderer.h
index 4b68ad0..b09ff3a 100644
--- a/src/AudioRenderer.h
+++ b/src/AudioRenderer.h
@@ -45,6 +45,7 @@ namespace SaneAudioRenderer
std::unique_ptr<WAVEFORMATEXTENSIBLE> GetInputFormat();
std::unique_ptr<AudioDevice> GetDeviceFormat();
+ std::vector<std::wstring> GetActiveProcessors();
private:
diff --git a/src/DspBalance.cpp b/src/DspBalance.cpp
index 01e5b86..109d6fe 100644
--- a/src/DspBalance.cpp
+++ b/src/DspBalance.cpp
@@ -5,6 +5,11 @@
namespace SaneAudioRenderer
{
+ bool DspBalance::Active()
+ {
+ return m_renderer.GetBalance() != 0.0f;
+ }
+
void DspBalance::Process(DspChunk& chunk)
{
float balance = m_renderer.GetBalance();
diff --git a/src/DspBalance.h b/src/DspBalance.h
index 4074eb7..8d0d9c5 100644
--- a/src/DspBalance.h
+++ b/src/DspBalance.h
@@ -14,6 +14,10 @@ namespace SaneAudioRenderer
DspBalance(const DspBalance&) = delete;
DspBalance& operator=(const DspBalance&) = delete;
+ std::wstring Name() { return L"Balance"; }
+
+ bool Active();
+
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspCrossfeed.cpp b/src/DspCrossfeed.cpp
index b95c0d5..0b19b58 100644
--- a/src/DspCrossfeed.cpp
+++ b/src/DspCrossfeed.cpp
@@ -16,6 +16,11 @@ namespace SaneAudioRenderer
}
}
+ bool DspCrossfeed::Active()
+ {
+ return m_active;
+ }
+
void DspCrossfeed::Process(DspChunk& chunk)
{
if (m_active && !chunk.IsEmpty())
diff --git a/src/DspCrossfeed.h b/src/DspCrossfeed.h
index 76b0a99..769c600 100644
--- a/src/DspCrossfeed.h
+++ b/src/DspCrossfeed.h
@@ -14,7 +14,10 @@ namespace SaneAudioRenderer
DspCrossfeed(const DspCrossfeed&) = delete;
DspCrossfeed& operator=(const DspCrossfeed&) = delete;
+ std::wstring Name() { return L"Crossfeed"; }
+
void Initialize(bool enable, uint32_t rate, uint32_t channels, DWORD mask);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspDither.cpp b/src/DspDither.cpp
index b90a99d..8bc92b4 100644
--- a/src/DspDither.cpp
+++ b/src/DspDither.cpp
@@ -10,6 +10,11 @@ namespace SaneAudioRenderer
m_error2 = {};
}
+ bool DspDither::Active()
+ {
+ return m_active;
+ }
+
void DspDither::Process(DspChunk& chunk)
{
// TODO: handle >18 channels situation gracefully (both here and in DspMixer)
diff --git a/src/DspDither.h b/src/DspDither.h
index 3a9a13b..95469b9 100644
--- a/src/DspDither.h
+++ b/src/DspDither.h
@@ -12,7 +12,10 @@ namespace SaneAudioRenderer
DspDither(const DspDither&) = delete;
DspDither& operator=(const DspDither&) = delete;
+ std::wstring Name() { return L"Dither"; }
+
void Initialize(DspFormat outputFormat);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspLimiter.cpp b/src/DspLimiter.cpp
index 02fadd1..8bc5b6e 100644
--- a/src/DspLimiter.cpp
+++ b/src/DspLimiter.cpp
@@ -37,6 +37,11 @@ namespace SaneAudioRenderer
m_peaks.clear();
}
+ bool DspLimiter::Active()
+ {
+ return !m_buffer.empty();
+ }
+
void DspLimiter::Process(DspChunk& chunk)
{
if (chunk.IsEmpty())
diff --git a/src/DspLimiter.h b/src/DspLimiter.h
index aa4b8c2..2537c08 100644
--- a/src/DspLimiter.h
+++ b/src/DspLimiter.h
@@ -12,7 +12,10 @@ namespace SaneAudioRenderer
DspLimiter(const DspLimiter&) = delete;
DspLimiter& operator=(const DspLimiter&) = delete;
+ std::wstring Name() { return L"Limiter"; }
+
void Initialize(uint32_t rate, bool exclusive);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspMatrix.cpp b/src/DspMatrix.cpp
index 5301983..dafea2b 100644
--- a/src/DspMatrix.cpp
+++ b/src/DspMatrix.cpp
@@ -221,6 +221,11 @@ namespace SaneAudioRenderer
m_outputChannels = outputChannels;
}
+ bool DspMatrix::Active()
+ {
+ return !!m_matrix;
+ }
+
void DspMatrix::Process(DspChunk& chunk)
{
if (m_matrix && !chunk.IsEmpty())
diff --git a/src/DspMatrix.h b/src/DspMatrix.h
index f02ab18..2a93950 100644
--- a/src/DspMatrix.h
+++ b/src/DspMatrix.h
@@ -12,8 +12,11 @@ namespace SaneAudioRenderer
DspMatrix(const DspMatrix&) = delete;
DspMatrix& operator=(const DspMatrix&) = delete;
+ std::wstring Name() { return L"Matrix"; }
+
void Initialize(uint32_t inputChannels, DWORD inputMask,
uint32_t outputChannels, DWORD outputMask);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspRate.cpp b/src/DspRate.cpp
index b062bbf..dc778fe 100644
--- a/src/DspRate.cpp
+++ b/src/DspRate.cpp
@@ -24,6 +24,11 @@ namespace SaneAudioRenderer
}
}
+ bool DspRate::Active()
+ {
+ return !!m_soxr;
+ }
+
void DspRate::Process(DspChunk& chunk)
{
if (m_soxr && !chunk.IsEmpty())
diff --git a/src/DspRate.h b/src/DspRate.h
index 2d83fd3..b7e39c3 100644
--- a/src/DspRate.h
+++ b/src/DspRate.h
@@ -15,7 +15,10 @@ namespace SaneAudioRenderer
DspRate& operator=(const DspRate&) = delete;
~DspRate();
+ std::wstring Name() { return L"Rate"; }
+
void Initialize(uint32_t inputRate, uint32_t outputRate, uint32_t channels);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspTempo.cpp b/src/DspTempo.cpp
index 6976b9f..9dc9dae 100644
--- a/src/DspTempo.cpp
+++ b/src/DspTempo.cpp
@@ -27,6 +27,11 @@ namespace SaneAudioRenderer
}
}
+ bool DspTempo::Active()
+ {
+ return m_active;
+ }
+
void DspTempo::Process(DspChunk& chunk)
{
if (m_active && !chunk.IsEmpty())
diff --git a/src/DspTempo.h b/src/DspTempo.h
index 63ef3c6..44bd464 100644
--- a/src/DspTempo.h
+++ b/src/DspTempo.h
@@ -14,7 +14,10 @@ namespace SaneAudioRenderer
DspTempo(const DspTempo&) = delete;
DspTempo& operator=(const DspTempo&) = delete;
+ std::wstring Name() { return L"Tempo"; }
+
void Initialize(float tempo, uint32_t rate, uint32_t channels);
+ bool Active();
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/DspVolume.cpp b/src/DspVolume.cpp
index 5e5ce4d..6dae992 100644
--- a/src/DspVolume.cpp
+++ b/src/DspVolume.cpp
@@ -10,6 +10,11 @@ namespace SaneAudioRenderer
m_exclusive = exclusive;
}
+ bool DspVolume::Active()
+ {
+ return !m_exclusive || m_renderer.GetVolume() != 1.0f;
+ }
+
void DspVolume::Process(DspChunk& chunk)
{
float volume = std::min(m_renderer.GetVolume(), m_exclusive ? 1.0f : 0.98f);
diff --git a/src/DspVolume.h b/src/DspVolume.h
index 995f11c..78edf6e 100644
--- a/src/DspVolume.h
+++ b/src/DspVolume.h
@@ -14,7 +14,11 @@ namespace SaneAudioRenderer
DspVolume(const DspVolume&) = delete;
DspVolume& operator=(const DspVolume&) = delete;
+ std::wstring Name() { return L"Volume"; }
+
void Initialize(bool exclusive);
+ bool Active();
+
void Process(DspChunk& chunk);
void Finish(DspChunk& chunk);
diff --git a/src/MyFilter.cpp b/src/MyFilter.cpp
index 12711a7..9d40694 100644
--- a/src/MyFilter.cpp
+++ b/src/MyFilter.cpp
@@ -123,7 +123,7 @@ namespace SaneAudioRenderer
CAutoLock rendererLock(m_renderer.get());
auto inputFormat = m_renderer->GetInputFormat();
auto devicetFormat = m_renderer->GetDeviceFormat();
- pPage = new MyPropertyPage(inputFormat.get(), devicetFormat.get());
+ pPage = new MyPropertyPage(inputFormat.get(), devicetFormat.get(), m_renderer->GetActiveProcessors());
}
catch (std::bad_alloc&)
{
diff --git a/src/MyPropertyPage.cpp b/src/MyPropertyPage.cpp
index fe3cbc5..e041ba2 100644
--- a/src/MyPropertyPage.cpp
+++ b/src/MyPropertyPage.cpp
@@ -100,7 +100,8 @@ namespace SaneAudioRenderer
}
}
- MyPropertyPage::MyPropertyPage(const WAVEFORMATEXTENSIBLE* pInputFormat, const AudioDevice* pDeviceFormat)
+ MyPropertyPage::MyPropertyPage(const WAVEFORMATEXTENSIBLE* pInputFormat, const AudioDevice* pDeviceFormat,
+ std::vector<std::wstring> processors)
: CUnknown("Audio Renderer Property Page", nullptr)
{
std::wstring exclusiveField = (pDeviceFormat ? (pDeviceFormat->exclusive ? L"Yes" : L"No") : L"-");
@@ -126,6 +127,17 @@ namespace SaneAudioRenderer
std::wstring rateField = (rateInputField == rateDeviceField) ?
rateInputField : rateInputField + L" -> " + rateDeviceField;
+ std::wstring processorsField;
+ for (const auto& s : processors)
+ {
+ if (!processorsField.empty())
+ processorsField += L", ";
+
+ processorsField += s;
+ }
+ if (processorsField.empty())
+ processorsField = L"-";
+
WriteDialogHeader(m_dialogData, L"MS Shell Dlg", 8);
WriteDialogItem(m_dialogData, BS_GROUPBOX, 0x0080FFFF, 5, 5, 200, 150, L"Renderer Status");
WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 20, 60, 8, L"Exclusive:");
@@ -140,8 +152,8 @@ namespace SaneAudioRenderer
WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT, 0x0082FFFF, 73, 68, 120, 8, channelsField);
WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 80, 60, 8, L"Rate:");
WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT, 0x0082FFFF, 73, 80, 120, 8, rateField);
- //WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 92, 60, 8, L"Processors:");
- //WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT, 0x0082FFFF, 73, 92, 120, 50, processorsField);
+ WriteDialogItem(m_dialogData, BS_TEXT | SS_RIGHT, 0x0082FFFF, 10, 92, 60, 8, L"Processors:");
+ WriteDialogItem(m_dialogData, BS_TEXT | SS_LEFT, 0x0082FFFF, 73, 92, 120, 50, processorsField);
}
STDMETHODIMP MyPropertyPage::NonDelegatingQueryInterface(REFIID riid, void** ppv)
diff --git a/src/MyPropertyPage.h b/src/MyPropertyPage.h
index c3e4eeb..f4c063d 100644
--- a/src/MyPropertyPage.h
+++ b/src/MyPropertyPage.h
@@ -11,7 +11,8 @@ namespace SaneAudioRenderer
{
public:
- MyPropertyPage(const WAVEFORMATEXTENSIBLE* pInputFormat, const AudioDevice* pDeviceFormat);
+ MyPropertyPage(const WAVEFORMATEXTENSIBLE* pInputFormat, const AudioDevice* pDeviceFormat,
+ std::vector<std::wstring> processors);
MyPropertyPage(const MyPropertyPage&) = delete;
MyPropertyPage& operator=(const MyPropertyPage&) = delete;