def createGrapher(self, evt=None): buildGrapher(self.grapher) for slider in CeciliaLib.getVar("userSliders"): slider.refresh() if CeciliaLib.getVar("presetToLoad") is not None: CeciliaLib.loadPresetFromDict(CeciliaLib.getVar("presetToLoad")) CeciliaLib.setVar("presetToLoad", None)
def onPresetSelect(self, idxPreset, newPreset): if newPreset in CeciliaLib.getVar("presets"): CeciliaLib.loadPresetFromDict(newPreset) for preset in CeciliaLib.getVar("presets"): if preset != newPreset: CeciliaLib.getVar("presets")[preset]['active'] = False CeciliaLib.getVar("presets")[newPreset]['active'] = True self.currentPreset = newPreset elif newPreset == 'init': CeciliaLib.loadPresetFromDict("init") for preset in CeciliaLib.getVar("presets"): CeciliaLib.getVar("presets")[preset]['active'] = False self.currentPreset = "init"
def applyBatchProcessingPreset(self, value): folderName = value if folderName == "": return cfileins = CeciliaLib.getControlPanel().getCfileinList() presets = CeciliaLib.getVar("presetPanel").getPresets() if "init" in presets: presets.remove("init") if "last save" in presets: presets.remove("last save") num_presets = len(presets) dlg = wx.ProgressDialog("Batch processing on preset sequence", "", maximum=num_presets, parent=self, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_SMOOTH) dlg.SetMinSize((600, -1)) dlg.SetClientSize((600, 100)) if len(cfileins) > 0: filepath = cfileins[0].filePath count = 0 for preset in presets: CeciliaLib.loadPresetFromDict(preset) if len(cfileins) == 0: path = os.path.join(os.path.expanduser("~"), "Desktop") name = "batch" ext = "." + CeciliaLib.getVar("audioFileType") else: cfileins[0].onLoadFile(filepath) path, fname = os.path.split(cfileins[0].filePath) name, ext = os.path.splitext(fname) if not os.path.isdir(os.path.join(path, folderName)): os.mkdir(os.path.join(path, folderName)) filename = os.path.join(path, folderName, "%s-%s%s" % (name, preset, ext)) count += 1 (keepGoing, skip) = dlg.Update(count, "Exporting %s" % filename) CeciliaLib.getControlPanel().onBatchProcessing(filename) while (CeciliaLib.getVar("audioServer").isAudioServerRunning()): time.sleep(.1) dlg.Destroy()