#Set libfluidsynth! to 16 output pairs. We prepared 32 jack ports in the session start. "soundfont" is our given name, in the line below. This is a prepared config which will be looked up by add_new_instrument
cbox.Config.set("instrument:soundfont","output_pairs",16)#this is not the same as session.py cbox.Config.set("io", "outputs", METADATA["cboxOutputs"]). It is yet another layer and those two need connections
#Remove the old link, if present. We cannot unlink directly in loadSoundfont because it is quite possible that a user will try out another soundfont but decide not to save but close and reopen to get his old soundfont back.
ifself.filePathandos.path.islink(self.filePath):
self._unlinkOnSave.append(self.filePath)
#self.midiInput.scene.clear() do not call for the sf2 engine. Will kill our instrument.
self.recordingEnabled=False#MidiInput callbacks can use this to prevent/allow data creation. Handled via api callback. Saved.
self.eventLoop=None# added in api.startEngine
self.data=None#nsm_openOrNewCallback
self.standaloneMode=None#fake NSM single server for LaborejoSoftwareSuite programs or not. Set in nsm_openOrNewCallback
defaddSessionPrefix(self,jsonDataAsString:str):
"""During load the current session prefix gets added. Turning pseudo-relative paths into
@ -103,6 +103,8 @@ class Session(object):
self.sessionPrefix=ourPath#if we want to save and load resources they need to be in the session dir. We never load from outside, the scheme is always "import first, load local file"
ifnotgetenv("NSM_URL"):#NSMClient checks for this itself but we can anticipate an error and inform the user.
path=ChooseSessionDirectory(qtApp).path#ChooseSessionDirectory is calling exec. We can't call qtapp.exec_ because that blocks forever, even after quitting the window.
#qSessionDirApp.quit()
#del qSessionDirApp
#path = "/tmp"
#path = "/tmp"
ifpath:
startPseudoNSMServer(path)
startPseudoNSMServer(path)
else:
sys.exit()
#message = f"""Please start {prettyName} only through the New Session Manager (NSM) or use the --save command line parameter."""
"""This hook purely exists to call sys.exit(1) even on a Qt crash
sothatatexitgetstriggered"""
sothatatexitgetstriggered"""
#print(exctype, value, traceback)
logger.error("Caught crash in execpthook. Trying too execute atexit anyway")
sys._excepthook(exctype,value,traceback)
sys.exit(1)
sys._excepthook(exctype,value,traceback)
sys.exit(1)
sys.excepthook=exception_hook
@ -340,13 +340,13 @@ if args.mute:
#Make sure calfbox is available.
if"CALFBOXLIBABSPATH"inos.environ:
logger.info("Looking for calfbox shared library in absolute path: {}".format(os.environ["CALFBOXLIBABSPATH"]))
logger.info("Looking for calfbox shared library in absolute path: {}".format(os.environ["CALFBOXLIBABSPATH"]))
else:
logger.info("Looking for calfbox shared library systemwide through ctypes.util.find_library")
try:
fromcalfboximportcbox
logger.info("{}: using cbox python module from {} . Local version has higher priority than system wide.".format(METADATA["name"],os.path.abspath(cbox.__file__)))
logger.info("{}: using cbox python module from {} . Local version has higher priority than system wide.".format(METADATA["name"],os.path.abspath(cbox.__file__)))