From 41b4e066f25cdfc2db64d81539a882611ac5e5a2 Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Thu, 23 Jul 2020 08:18:15 -0400 Subject: [PATCH] LibPD: Print to log instead of stdout. Autoformat code. --- src/LibPDEngine.cpp | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/src/LibPDEngine.cpp b/src/LibPDEngine.cpp index 7f60b2b..aadfc18 100644 --- a/src/LibPDEngine.cpp +++ b/src/LibPDEngine.cpp @@ -69,9 +69,8 @@ struct LibPDEngine : ScriptEngine { libpd_set_printhook((t_libpd_printhook)libpd_print_concatenator); libpd_set_concatenated_printhook(receiveLights); - if (libpd_num_instances() > 2) { - display("Sorry, multi instance support in libpd is under development!"); + display("Multiple simultaneous libpd (Pure Data) instances not yet supported."); return -1; } @@ -146,7 +145,7 @@ struct LibPDEngine : ScriptEngine { _ticks = 1; libpd_process_float(_ticks, _input, _output); - //return samples to prototype + // return samples to prototype for (int s = 0; s < _pd_block_size; s++) { for (int r = 0; r < rows; r++) { block->outputs[r][s] = _output[s * rows + r]; // scale up again to +-5V signal @@ -233,25 +232,21 @@ void LibPDEngine::receiveLights(const char* s) { utility_idx = _utility_map.at(atoms[0]); // map::at throws an out-of-range } catch (const std::out_of_range& oor) { - std::cout << "prototype libpd engine Pd console message: " << std::string(s) << std::endl; + WARN("Prototype libpd: %s", s); utility_is_valid = false; //display("Warning:"+atoms[1]+" not found!"); // print out on command line } - if(utility_is_valid) - { - switch (utility_idx) - { - case 1: - std::cout << "prototype libpd engine Pd error message: " << std::string(s) << std::endl; - break; - - default: - break; + if (utility_is_valid) { + switch (utility_idx) { + case 1: + WARN("Prototype libpd: %s", s); + break; + + default: + break; } } - - } }