Closed be1 closed 4 years ago
I totally agree with you that printf() is unacceptable for a library. I would also say that Log::INFO is a bad idea, because at the UI you probably want a progress bar widget. So you need to get a number from somewhere so you can update the progressbar (and parsing info messages sounds fragile). I've added a new set_progress_function() API now. Please verify that this is good enough for you, and if yes, close your issue. The commit is here:
https://github.com/swesterfeld/liquidsfz/commit/45fc0fd56b9f3e2ac923126728c87e7a24b890ea
Thank you for your response and the new set_progress_function()
. This works for me, like a charm. Closing the issue.
As of v0.1.0, loading an sfz file yields loading percentage written to stdout. A graphical interface must then create a piped acces to stdout and read the percentage loading to display it in a graphical widget (see line 27 of liquidmainwindow.cpp of qliquidsfz). This is not very convenient. Moreover, in a command-line user interface, it is not convenient from the library to write to stdout because it can break the output of the command-line user interface. Therefore, i propose for libliquidsfz to not write loading percentage to stdout, at least if a log fonction has been set with
Synth::set_log_function()
to theSynth
object. And i propose loading percentage to be passed to the log function with aLog::INFO
level. Another proposition is to add in the API a (for example)Synth::set_loadpercent_function()
with a handler beingvoid (*fun) (int percent)
. Withpercent
being a regularly updated integer representing the current loading percentage. Then the application can display the status when loading an sfz file, wich is a long operation. Comments welcomed, of course!