From a312f5b5343112bb5b1a2ee10027ffc7a2dc6e2b Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 20 Mar 2017 02:35:26 +0100 Subject: Add CV dumping debug utility --- src/server/Buffer.cpp | 16 ++++++++++++++++ src/server/Buffer.hpp | 4 ++++ 2 files changed, 20 insertions(+) (limited to 'src') diff --git a/src/server/Buffer.cpp b/src/server/Buffer.cpp index cf313b67..8ed1d60a 100644 --- a/src/server/Buffer.cpp +++ b/src/server/Buffer.cpp @@ -431,6 +431,22 @@ Buffer::update_value_buffer(SampleCount offset) } } +#ifndef NDEBUG +void +Buffer::dump_cv(const RunContext& context) const +{ + float value = samples()[0]; + fprintf(stderr, "{ 0000: %.02f\n", value); + for (uint32_t i = 0; i < context.nframes(); ++i) { + if (samples()[i] != value) { + value = samples()[i]; + fprintf(stderr, " %4d: %.02f\n", i, value); + } + } + fprintf(stderr, "}\n"); +} +#endif + void intrusive_ptr_add_ref(Buffer* b) { diff --git a/src/server/Buffer.hpp b/src/server/Buffer.hpp index 13e0a7eb..8742445f 100644 --- a/src/server/Buffer.hpp +++ b/src/server/Buffer.hpp @@ -195,6 +195,10 @@ public: /// Set/add to audio buffer from the Sequence of Float in `src` void render_sequence(const RunContext& context, const Buffer* src, bool add); +#ifndef NDEBUG + void dump_cv(const RunContext& context) const; +#endif + void set_capacity(uint32_t capacity) { _capacity = capacity; } void set_buffer(void* buf) { assert(_external); _buf = buf; } -- cgit v1.2.1