diff --git a/CHANGELOG b/CHANGELOG index 38ab298..b405c07 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -20,6 +20,7 @@ Optional text description for tempo items like "allegro" Cleaner .ly export with more line breaks, comments and using more default ly instructions when available, instead of our custom generic-purpose scripts. Settings menu to autoconnect metronome audio ports to system on startup. Default off. Metronome audio outputs now use real metronome name, not only pretty name +Use lilypond title as jack pretty client name, if provided (needs libcalfbox-lss 1.1.0) ## 2022-04-15 2.0.3 diff --git a/engine/api.py b/engine/api.py index 3585848..ffcb526 100644 --- a/engine/api.py +++ b/engine/api.py @@ -303,6 +303,9 @@ def startEngine(nsmClient, additionalData:dict={}): setMetronome(session.data.currentMetronomeTrack.asMetronomeData, label=session.data.currentMetronomeTrack.name) #track.asMetronomeData is generated in staticRepresentation #template api. has callbacks callbacks._setCursor() + if session.data.metaData["title"]: + cbox.JackIO.Metadata.client_set_property("http://jackaudio.org/metadata/pretty-name", session.data.metaData["title"]) + global laborejoEngineStarted #makes for a convenient check. stepMidiInput uses it, which needs to know that the gui already started the api. laborejoEngineStarted = True @@ -313,7 +316,13 @@ def getMetadata(): return session.data.metaData def setMetadata(data): + titleBefore = bool(session.data.metaData["title"]) session.data.metaData = data + if session.data.metaData["title"]: + cbox.JackIO.Metadata.client_set_property("http://jackaudio.org/metadata/pretty-name", session.data.metaData["title"]) + elif titleBefore: + cbox.JackIO.Metadata.client_remove_property("http://jackaudio.org/metadata/pretty-name") + def playFromCursor(): playFrom(ticks=session.data.cursorExport()["tickindex"]) diff --git a/template/calfbox/metadata.py b/template/calfbox/metadata.py index 2c42ddc..bd051da 100644 --- a/template/calfbox/metadata.py +++ b/template/calfbox/metadata.py @@ -3,7 +3,7 @@ """ This file implements the JackIO Python side of Jack Medata as described here: - http://www.jackaudio.org/files/docs/html/group__Metadata.html + https://jackaudio.org/api/metadata_8h.html """ import base64 # for icons @@ -64,6 +64,13 @@ class Metadata: return TypeError("value {} must be int or str but was {}".format(value, type(value))) do_cmd("/io/client_set_property", None, [key, value, jackPropertyType]) + @staticmethod + def client_remove_property(key): + """ + This is directly for our client, which we do not need to provide here. + """ + do_cmd("/io/client_remove_property", None, [key]) + @staticmethod def remove_property(port, key): """port is the portname as string System:out_1"""