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-01-27 12:41:35 +0300
committerAlex Marsev <alex.marsev@gmail.com>2016-01-27 12:45:45 +0300
commit303ce889bc9251d8cafab57133df1e226d792515 (patch)
tree3e3c18ff94bbd46ea57270c773ebd37f530481a0
parentefeb2ee26c4ccd1de481493f42c88ca9bd0ba6b2 (diff)
Add ClassName() helper function
And use it in debug output.
-rw-r--r--src/AudioDeviceEvent.cpp14
-rw-r--r--src/AudioDevicePush.cpp2
-rw-r--r--src/AudioRenderer.cpp12
-rw-r--r--src/DspLimiter.cpp2
-rw-r--r--src/DspTempo.cpp4
-rw-r--r--src/MyPin.cpp10
-rw-r--r--src/SampleCorrection.cpp8
-rw-r--r--src/Utils.h7
8 files changed, 33 insertions, 26 deletions
diff --git a/src/AudioDeviceEvent.cpp b/src/AudioDeviceEvent.cpp
index 774b74b..7b0c923 100644
--- a/src/AudioDeviceEvent.cpp
+++ b/src/AudioDeviceEvent.cpp
@@ -58,7 +58,7 @@ namespace SaneAudioRenderer
if (!m_endOfStream)
{
- DebugOut("AudioDeviceEvent finish");
+ DebugOut(ClassName(this), "finish");
m_endOfStream = true;
m_endOfStreamPos = GetEnd();
}
@@ -104,19 +104,19 @@ namespace SaneAudioRenderer
if (delegateStart)
{
- DebugOut("AudioDeviceEvent queue start");
+ DebugOut(ClassName(this), "queue start");
m_wake.Set();
}
else
{
- DebugOut("AudioDeviceEvent start");
+ DebugOut(ClassName(this), "start");
m_backend->audioClient->Start();
}
}
void AudioDeviceEvent::Stop()
{
- DebugOut("AudioDeviceEvent stop");
+ DebugOut(ClassName(this), "stop");
{
CAutoLock threadLock(&m_threadMutex);
@@ -128,7 +128,7 @@ namespace SaneAudioRenderer
void AudioDeviceEvent::Reset()
{
- DebugOut("AudioDeviceEvent reset");
+ DebugOut(ClassName(this), "reset");
{
CAutoLock threadLock(&m_threadMutex);
@@ -176,7 +176,7 @@ namespace SaneAudioRenderer
if (m_queuedStart)
{
- DebugOut("AudioDeviceEvent start");
+ DebugOut(ClassName(this), "start");
m_backend->audioClient->Start();
m_queuedStart = false;
}
@@ -236,7 +236,7 @@ namespace SaneAudioRenderer
ThrowIfFailed(m_backend->audioRenderClient->ReleaseBuffer(deviceFrames, 0));
}
- DebugOut("AudioDeviceEvent silence", doFrames * 1000. / m_backend->waveFormat->nSamplesPerSec, "ms");
+ DebugOut(ClassName(this), "silence", doFrames * 1000. / m_backend->waveFormat->nSamplesPerSec, "ms");
m_silenceFrames += doFrames;
diff --git a/src/AudioDevicePush.cpp b/src/AudioDevicePush.cpp
index 11518d3..511bdcf 100644
--- a/src/AudioDevicePush.cpp
+++ b/src/AudioDevicePush.cpp
@@ -176,7 +176,7 @@ namespace SaneAudioRenderer
ThrowIfFailed(m_backend->audioRenderClient->GetBuffer(doFrames, &deviceBuffer));
ThrowIfFailed(m_backend->audioRenderClient->ReleaseBuffer(doFrames, AUDCLNT_BUFFERFLAGS_SILENT));
- DebugOut("AudioDevice push", 1000. * doFrames / m_backend->waveFormat->nSamplesPerSec, "ms of silence");
+ DebugOut(ClassName(this), "push", 1000. * doFrames / m_backend->waveFormat->nSamplesPerSec, "ms of silence");
m_pushedFrames += doFrames;
diff --git a/src/AudioRenderer.cpp b/src/AudioRenderer.cpp
index d2fcb52..3dfa62a 100644
--- a/src/AudioRenderer.cpp
+++ b/src/AudioRenderer.cpp
@@ -544,7 +544,7 @@ namespace SaneAudioRenderer
{
m_startClockOffset -= llMulDiv(chunk.GetFrameCount(), OneSecond, rate, 0);
- DebugOut("AudioRenderer insert", chunk.GetFrameCount() * 1000. / rate,
+ DebugOut(ClassName(this), "insert", chunk.GetFrameCount() * 1000. / rate,
"ms of silence to minimize re-slaving jitter");
ZeroMemory(chunk.GetData(), chunk.GetSize());
@@ -566,7 +566,7 @@ namespace SaneAudioRenderer
{
m_myClock.OffsetAudioClock(offset);
m_clockCorrection += offset;
- DebugOut("AudioRenderer offset internal clock by", offset / 10000., "ms");
+ DebugOut(ClassName(this), "offset internal clock by", offset / 10000., "ms");
}
}
}
@@ -600,7 +600,7 @@ namespace SaneAudioRenderer
chunk.ShrinkHead(chunk.GetFrameCount() - dropFrames);
- DebugOut("AudioRenderer drop", dropFrames, "frames for rate matching");
+ DebugOut(ClassName(this), "drop", dropFrames, "frames for rate matching");
}
else if (remaining < latency / 2) // x1.0
{
@@ -609,7 +609,7 @@ namespace SaneAudioRenderer
chunk.PadHead(padFrames);
- DebugOut("AudioRenderer pad", padFrames, "frames for rate matching");
+ DebugOut(ClassName(this), "pad", padFrames, "frames for rate matching");
}
}
else
@@ -645,7 +645,7 @@ namespace SaneAudioRenderer
padTime -= paddedTime;
assert(padTime >= 0);
- DebugOut("AudioRenderer pad", paddedTime / 10000., "ms for clock matching at",
+ DebugOut(ClassName(this), "pad", paddedTime / 10000., "ms for clock matching at",
m_sampleCorrection.GetLastFrameEnd() / 10000., "frame position");
}
@@ -676,7 +676,7 @@ namespace SaneAudioRenderer
dropTime -= droppedTime;
assert(dropTime >= 0);
- DebugOut("AudioRenderer drop", droppedTime / 10000., "ms for clock matching at",
+ DebugOut(ClassName(this), "drop", droppedTime / 10000., "ms for clock matching at",
m_sampleCorrection.GetLastFrameEnd() / 10000., "frame position");
}
diff --git a/src/DspLimiter.cpp b/src/DspLimiter.cpp
index 0868149..376d39f 100644
--- a/src/DspLimiter.cpp
+++ b/src/DspLimiter.cpp
@@ -119,6 +119,6 @@ namespace SaneAudioRenderer
{
m_peak = peak;
m_threshold = std::pow(1.0f / peak, 1.0f / slope - 1.0f) - 0.0001f;
- DebugOut("DspLimiter active with", m_peak, "peak and", m_threshold, "threshold");
+ DebugOut(ClassName(this), "active with", m_peak, "peak and", m_threshold, "threshold");
}
}
diff --git a/src/DspTempo.cpp b/src/DspTempo.cpp
index 98362b4..60faa07 100644
--- a/src/DspTempo.cpp
+++ b/src/DspTempo.cpp
@@ -106,14 +106,14 @@ namespace SaneAudioRenderer
if (m_ftempo != m_ftempo2 &&
m_outSamples1 * ratio21 - m_outSamples2 > 60 * m_rate)
{
- DebugOut("DspTempo adjusting for float/double imprecision (2), ratio", ratio21);
+ DebugOut(ClassName(this), "adjusting for float/double imprecision (2), ratio", ratio21);
m_ftempo = m_ftempo2;
m_stouch.setTempo(m_ftempo);
}
else if (m_ftempo != m_ftempo1 &&
m_outSamples2 - m_outSamples1 * ratio21 > 60 * m_rate)
{
- DebugOut("DspTempo adjusting for float/double imprecision (1), ratio", ratio21);
+ DebugOut(ClassName(this), "adjusting for float/double imprecision (1), ratio", ratio21);
m_ftempo = m_ftempo1;
m_stouch.setTempo(m_ftempo);
}
diff --git a/src/MyPin.cpp b/src/MyPin.cpp
index 0c828d1..cf6708d 100644
--- a/src/MyPin.cpp
+++ b/src/MyPin.cpp
@@ -305,22 +305,22 @@ namespace SaneAudioRenderer
if (SUCCEEDED(pushSource->GetPushSourceFlags(&flags)))
{
if (flags & AM_PUSHSOURCECAPS_INTERNAL_RM)
- DebugOut("MyPin upstream live pin has AM_PUSHSOURCECAPS_INTERNAL_RM flag");
+ DebugOut(ClassName(this), "upstream live pin has AM_PUSHSOURCECAPS_INTERNAL_RM flag");
if (flags & AM_PUSHSOURCECAPS_NOT_LIVE)
{
- DebugOut("MyPin upstream live pin has AM_PUSHSOURCECAPS_NOT_LIVE flag");
+ DebugOut(ClassName(this), "upstream live pin has AM_PUSHSOURCECAPS_NOT_LIVE flag");
live = false;
}
if (flags & AM_PUSHSOURCECAPS_PRIVATE_CLOCK)
- DebugOut("MyPin upstream live pin has AM_PUSHSOURCECAPS_PRIVATE_CLOCK flag");
+ DebugOut(ClassName(this), "upstream live pin has AM_PUSHSOURCECAPS_PRIVATE_CLOCK flag");
if (flags & AM_PUSHSOURCEREQS_USE_STREAM_CLOCK)
- DebugOut("MyPin upstream live pin has AM_PUSHSOURCEREQS_USE_STREAM_CLOCK flag");
+ DebugOut(ClassName(this), "upstream live pin has AM_PUSHSOURCEREQS_USE_STREAM_CLOCK flag");
if (!flags)
- DebugOut("MyPin upstream live pin has no flags");
+ DebugOut(ClassName(this), "upstream live pin has no flags");
}
}
diff --git a/src/SampleCorrection.cpp b/src/SampleCorrection.cpp
index b6989be..3af024d 100644
--- a/src/SampleCorrection.cpp
+++ b/src/SampleCorrection.cpp
@@ -48,7 +48,7 @@ namespace SaneAudioRenderer
if (m_freshBuffer && !(sampleProps.dwSampleFlags & AM_SAMPLE_SPLICEPOINT))
{
// Drop the sample.
- DebugOut("SampleCorrection drop [", sampleProps.tStart, sampleProps.tStop, "]");
+ DebugOut(ClassName(this), "drop [", sampleProps.tStart, sampleProps.tStop, "]");
chunk = DspChunk();
assert(chunk.IsEmpty());
}
@@ -58,7 +58,7 @@ namespace SaneAudioRenderer
if ((sampleProps.dwSampleFlags & AM_SAMPLE_STOPVALID) && sampleProps.tStop <= m_lastFrameEnd)
{
// Drop the sample.
- DebugOut("SampleCorrection drop [", sampleProps.tStart, sampleProps.tStop, "]");
+ DebugOut(ClassName(this), "drop [", sampleProps.tStart, sampleProps.tStop, "]");
chunk = DspChunk();
assert(chunk.IsEmpty());
}
@@ -69,7 +69,7 @@ namespace SaneAudioRenderer
if (cropFrames > 0)
{
- DebugOut("SampleCorrection crop", cropFrames, "frames from [",
+ DebugOut(ClassName(this), "crop", cropFrames, "frames from [",
sampleProps.tStart, sampleProps.tStop, "]");
chunk.ShrinkHead(chunk.GetFrameCount() > cropFrames ? chunk.GetFrameCount() - cropFrames : 0);
@@ -83,7 +83,7 @@ namespace SaneAudioRenderer
if (padFrames > 0 &&
FramesToTime(padFrames) < 10 * OneSecond)
{
- DebugOut("SampleCorrection pad", padFrames, "frames before [",
+ DebugOut(ClassName(this), "pad", padFrames, "frames before [",
sampleProps.tStart, sampleProps.tStop, "]");
chunk.PadHead(padFrames);
diff --git a/src/Utils.h b/src/Utils.h
index 0e27d7e..c2fa1fc 100644
--- a/src/Utils.h
+++ b/src/Utils.h
@@ -117,6 +117,13 @@ namespace SaneAudioRenderer
#endif
}
+ template <class T>
+ inline const char* ClassName(T* p)
+ {
+ const char* str = strrchr(typeid(*p).name(), ':');
+ return str ? str + 1 : "";
+ }
+
template <typename>
class WinapiFunc;
template <typename ReturnType, typename...Args>