The Klang debug interface.
More...
#include <klang.h>
|
| template<typename Func , typename... Args> |
| static double | profile (Func func, Args... args) |
| |
| template<typename Func , typename... Args> |
| static double | profile (int times, Func func, Args... args) |
| |
| static signal & | passthrough () |
| |
Definition at line 4270 of file klang.h.
◆ getText()
| int klang::Debug::getText |
( |
char * | buffer | ) |
|
|
inline |
Definition at line 4473 of file klang.h.
4473 {
4474#if HAS_KLANG_DEBUG
4476#else
4478 return 0;
4479#endif
4480 }
int getText(char *buffer)
Console console
Debug console output.
static THREAD_LOCAL Buffer buffer
◆ hasText()
| bool klang::Debug::hasText |
( |
| ) |
const |
|
inline |
Definition at line 4465 of file klang.h.
4465 {
4466#if HAS_KLANG_DEBUG
4468#else
4469 return false;
4470#endif
4471 }
◆ input() [1/3]
| void klang::Debug::input |
( |
| ) |
|
|
inlineoverridevirtual |
◆ input() [2/3]
| void klang::Debug::input |
( |
const signal & | value | ) |
|
|
inlineoverridevirtual |
◆ input() [3/3]
◆ operator const signal &()
| klang::Debug::operator const signal & |
( |
| ) |
const |
|
inline |
Definition at line 4482 of file klang.h.
4482 {
4483#if HAS_KLANG_DEBUG
4485#else
4487#endif
4488 }
A mono audio signal (equivalent to a float).
◆ operator<<()
| void klang::Debug::operator<< |
( |
const signal & | value | ) |
|
|
inlineoverridevirtual |
◆ passthrough()
| static signal & klang::Debug::passthrough |
( |
| ) |
|
|
inlinestatic |
Definition at line 4493 of file klang.h.
4493 {
4494 static thread_local signal value = 0;
4495 return value;
4496 }
signals< 2 > signal
Stereo audio signal.
◆ print()
| void klang::Debug::print |
( |
const char * | format, |
|
|
| ... ) |
|
inline |
Definition at line 4431 of file klang.h.
4431 {
4432#if HAS_KLANG_DEBUG
4434 THREAD_LOCAL static char string[1024] = { 0 };
4435 string[0] = 0;
4436 va_list args;
4437 va_start(args, format);
4438 vsnprintf(string, 1024, format, args);
4439 va_end(args);
4441 }
4442#else
4443
4444#endif
4445 }
◆ printOnce()
| void klang::Debug::printOnce |
( |
const char * | format, |
|
|
| ... ) |
|
inline |
Definition at line 4447 of file klang.h.
4447 {
4448#if HAS_KLANG_DEBUG
4450 THREAD_LOCAL static char string[1024] = { 0 };
4451 string[0] = 0;
4452 va_list args;
4453 va_start(args, format);
4454 vsnprintf(string, 1024, format, args);
4455 va_end(args);
4456
4459 }
4460#else
4461
4462#endif
4463 }
static THREAD_LOCAL Text< 16384 > last
◆ profile() [1/2]
template<typename Func , typename... Args>
| static double klang::Debug::profile |
( |
Func | func, |
|
|
Args... | args ) |
|
inlinestatic |
Definition at line 4367 of file klang.h.
4367 {
4368#if HAS_KLANG_DEBUG
4369 using namespace std::chrono;
4370
4371 auto start = high_resolution_clock::now();
4372 func(args...);
4373 auto end = high_resolution_clock::now();
4374
4375 auto duration = duration_cast<nanoseconds>(end - start).count();
4376 return (double)duration;
4377#else
4378 return 0;
4379#endif
4380 }
◆ profile() [2/2]
template<typename Func , typename... Args>
| static double klang::Debug::profile |
( |
int | times, |
|
|
Func | func, |
|
|
Args... | args ) |
|
inlinestatic |
Definition at line 4383 of file klang.h.
4383 {
4384#if HAS_KLANG_DEBUG
4385 double sum = 0;
4386 while (times--) {
4387 sum +=
profile(func, args...);
4388 }
4389 return sum / 1000000.0;
4390#else
4391 return 0;
4392#endif
4393 }
static double profile(Func func, Args... args)
◆ buffer
◆ console
◆ in