def onPlayStop(self, value): if value: CeciliaLib.getControlPanel().nonZeroTime = 0 CeciliaLib.setVar("toDac", True) CeciliaLib.getVar("grapher").toolbar.loadingMsg.SetForegroundColour("#FFFFFF") CeciliaLib.getVar("grapher").toolbar.loadingMsg.Refresh() CeciliaLib.getControlPanel().transportButtons.setPlay(True) wx.CallLater(50, CeciliaLib.startCeciliaSound, True) else: CeciliaLib.stopCeciliaSound()
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()
def applyBatchProcessingFolder(self, value): folderName = value if folderName == "": return old_file_type = CeciliaLib.getVar("audioFileType") cfileins = CeciliaLib.getControlPanel().getCfileinList() num_snds = len(cfileins[0].fileMenu.choice) dlg = wx.ProgressDialog("Batch processing on sound folder", "", maximum=num_snds, parent=self, style=wx.PD_APP_MODAL | wx.PD_AUTO_HIDE | wx.PD_SMOOTH) dlg.SetMinSize((600, -1)) dlg.SetClientSize((600, 100)) count = 0 totaltime = CeciliaLib.getVar("totalTime") for snd in cfileins[0].fileMenu.choice: cfileins[0].onSelectSound(-1, snd) if CeciliaLib.getVar("useSoundDur"): cfileins[0].setTotalTime() path, dump = os.path.split(cfileins[0].filePath) name, ext = os.path.splitext(snd) lext = ext.lower() if lext in [".wav", ".wave"]: CeciliaLib.setVar('audioFileType', "wav") elif lext in [".aif", ".aiff", ".aifc"]: CeciliaLib.setVar('audioFileType', "aif") elif lext in [".ogg"]: CeciliaLib.setVar('audioFileType', "ogg") elif lext in [".flac"]: CeciliaLib.setVar('audioFileType', "flac") elif lext in [".au"]: CeciliaLib.setVar('audioFileType', "au") elif lext in [".sd2"]: CeciliaLib.setVar('audioFileType', "sd2") elif lext in [".caf"]: CeciliaLib.setVar('audioFileType', "caf") 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, folderName, ext)) count += 1 (keepGoing, skip) = dlg.Update(count, "Exporting %s" % filename) CeciliaLib.getControlPanel().onBatchProcessing(filename) while (CeciliaLib.getVar("audioServer").isAudioServerRunning()): time.sleep(.1) if CeciliaLib.getVar("useSoundDur"): CeciliaLib.getControlPanel().setTotalTime(totaltime) CeciliaLib.getControlPanel().updateDurationSlider() dlg.Destroy() CeciliaLib.setVar('audioFileType', old_file_type)
def onUpdateInterface(self, event): if event is not None: snds = [] if CeciliaLib.getVar("rememberedSound"): for key in CeciliaLib.getVar("userInputs").keys(): if CeciliaLib.getVar("userInputs")[key]['path'] != '': snds.append(CeciliaLib.getVar("userInputs")[key]['path']) if CeciliaLib.getVar("audioServer").isAudioServerRunning(): CeciliaLib.stopCeciliaSound() self.closeInterface() CeciliaLib.parseInterfaceText() title = os.path.split(CeciliaLib.getVar("currentCeciliaFile", unicode=True))[1] ceciliaInterface = CeciliaInterface.CeciliaInterface(None, title='Interface - %s' % title, mainFrame=self) ceciliaInterface.SetSize(CeciliaLib.getVar("interfaceSize")) ceciliaInterface.SetPosition(CeciliaLib.getVar("interfacePosition")) CeciliaLib.setVar("interface", ceciliaInterface) if CeciliaLib.getVar("presets") != {}: CeciliaLib.getVar("presetPanel").loadPresets() if event is not None: for i, cfilein in enumerate(CeciliaLib.getControlPanel().getCfileinList()): if i >= len(snds): break cfilein.onLoadFile(snds[i])
def arrowLeftDown(self, dir): if dir == "up": CeciliaLib.getControlPanel().movePlugin(self.vpos, -1) else: CeciliaLib.getControlPanel().movePlugin(self.vpos, 1)
def onBounceToDisk(self, event): CeciliaLib.getControlPanel().onBounceToDisk()