Start reworking log output

This commit is contained in:
Chris Cannam
2022-06-21 16:06:16 +01:00
parent e546767a6d
commit 35653f3a86
13 changed files with 258 additions and 71 deletions

View File

@@ -37,6 +37,8 @@
#include <vector>
#include <map>
#include <string>
#include <memory>
#include <cstddef>
/**
@@ -277,7 +279,6 @@ public:
* provided for backward compatibility only. They are ignored by
* the stretcher.
*/
enum Option {
OptionProcessOffline = 0x00000000,
@@ -331,6 +332,13 @@ public:
PercussiveOptions = 0x00102000
};
struct Logger {
virtual void log0(const char *) = 0;
virtual void log1(const char *, double) = 0;
virtual void log2(const char *, double, double) = 0;
virtual ~Logger() { }
};
/**
* Construct a time and pitch stretcher object to run at the given
* sample rate, with the given number of channels.
@@ -361,6 +369,30 @@ public:
Options options = DefaultOptions,
double initialTimeRatio = 1.0,
double initialPitchScale = 1.0);
/**
* Construct a time and pitch stretcher object with a custom debug
* logger. This may be useful for debugging if the default logger
* output (which simply goes to cout) is not visible in the
* runtime environment, or if the application has a standard or
* more realtime-appropriate logging mechanism.
*
* See the documentation for the other constructor above for
* details of the arguments other than the logger.
*
* Note that although the supplied logger gets to decide what to
* do with log messages, the separately-set debug level (see
* setDebugLevel() and setDefaultDebugLevel()) still determines
* whether any given debug message is generated and sent to the
* logger in the first place.
*/
RubberBandStretcher(size_t sampleRate,
size_t channels,
std::shared_ptr<Logger> logger,
Options options = DefaultOptions,
double initialTimeRatio = 1.0,
double initialPitchScale = 1.0);
~RubberBandStretcher();
/**