def changeSoftBuff(self, index, label): softBuff = int(self.choiceSoftBuff.getLabel()) if softBuff > CeciliaLib.getHardBuf(): self.choiceSoftBuff.setLabel(str(CeciliaLib.getSoftBuf())) else: CeciliaLib.setSoftBuf(softBuff)
def changeKsmps(self, index, label): ksmps = int(self.choiceKsmps.getLabel().strip()) CeciliaLib.setKsmps(ksmps) sr = CeciliaLib.getSr() kr = sr/ksmps CeciliaLib.setKr(kr)
def createCeciliaPanel(self, panel): ceciliaPanel = wx.Panel(panel) ceciliaPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(5,3,10,3) textTotalTime = wx.StaticText(ceciliaPanel, 0, 'Total time default (sec) :') textTotalTime.SetForegroundColour(PREFS_FOREGROUND) textTotalTime.SetFont(self.font) self.choiceTotalTime = CustomMenu(ceciliaPanel, size=(80,20), choice= ["10.0", "30.0", "60.0", "120.0", "300.0", "600.0", "1200.0", "2400.0", "3600.0"], init=str(CeciliaLib.getVar("defaultTotalTime")), outFunction=self.changeDefaultTotalTime) textGlobalFade = wx.StaticText(ceciliaPanel, 0, 'Global fadein/fadeout (sec) :') textGlobalFade.SetForegroundColour(PREFS_FOREGROUND) textGlobalFade.SetFont(self.font) self.choiceGlobalFade = CustomMenu(ceciliaPanel, size=(80,20), choice= ["0.0", "0.001", "0.002", "0.003", "0.004", "0.005", "0.01", "0.015", "0.02", "0.025", "0.03", "0.05", "0.075", "0.1", "0.2", "0.3", "0.4", "0.5"], init=str(CeciliaLib.getVar("globalFade")), outFunction=self.changeGlobalFade) textUseTooltips = wx.StaticText(ceciliaPanel, 0, 'Use tooltips :') textUseTooltips.SetForegroundColour(PREFS_FOREGROUND) textUseTooltips.SetFont(self.font) self.tooltipsToggle = Toggle(ceciliaPanel, CeciliaLib.getVar("useTooltips"), outFunction=self.enableTooltips) textgraphTexture = wx.StaticText(ceciliaPanel, 0, 'Use grapher texture :') textgraphTexture.SetForegroundColour(PREFS_FOREGROUND) textgraphTexture.SetFont(self.font) self.textureToggle = Toggle(ceciliaPanel, CeciliaLib.getVar("graphTexture"), outFunction=self.enableGraphTexture) textVerbose = wx.StaticText(ceciliaPanel, 0, 'Verbose :') textVerbose.SetForegroundColour(PREFS_FOREGROUND) textVerbose.SetFont(self.font) self.verboseToggle = Toggle(ceciliaPanel, CeciliaLib.getVar("DEBUG"), outFunction=self.enableVerbose) if sys.platform == "linux2": spacerSize = 82 else: spacerSize = 86 gridSizer.AddMany([ (textTotalTime, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, '', size=(spacerSize,-1)), 1, wx.EXPAND), (self.choiceTotalTime, 0, wx.ALIGN_CENTER_VERTICAL), (textGlobalFade, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, '', size=(spacerSize,-1)), 1, wx.EXPAND), (self.choiceGlobalFade, 0, wx.ALIGN_CENTER_VERTICAL), (textUseTooltips, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, ''), 1, wx.EXPAND), (self.tooltipsToggle, 0, wx.ALIGN_CENTER_VERTICAL), (textgraphTexture, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, ''), 1, wx.EXPAND), (self.textureToggle, 0, wx.ALIGN_CENTER_VERTICAL), (textVerbose, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, ''), 1, wx.EXPAND), (self.verboseToggle, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) ceciliaPanel.SetSizerAndFit(gridSizer) return ceciliaPanel
def createFileExportPanel(self, panel): fileExportPanel = wx.Panel(panel) fileExportPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(2,3,10,3) # File Format textFileFormat = wx.StaticText(fileExportPanel, 0, 'File Format :') textFileFormat.SetForegroundColour(PREFS_FOREGROUND) textFileFormat.SetFont(self.font) self.choiceFileFormat = CustomMenu(fileExportPanel, choice=sorted(AUDIO_FILE_FORMATS.keys()), init=CeciliaLib.getVar("audioFileType"), outFunction=self.changeFileType) # Bit depth textBD = wx.StaticText(fileExportPanel, 0, 'Bit Depth :') textBD.SetForegroundColour(PREFS_FOREGROUND) textBD.SetFont(self.font) self.choiceBD = CustomMenu(fileExportPanel, choice=sorted(BIT_DEPTHS.keys()), outFunction=self.changeSampSize) for item in BIT_DEPTHS.items(): if item[1]==CeciliaLib.getVar("sampSize"): self.choiceBD.setStringSelection(item[0]) gridSizer.AddMany([ (textFileFormat, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(fileExportPanel, -1, '', size=(153,-1)), 1, wx.EXPAND), (self.choiceFileFormat, 0, wx.ALIGN_CENTER_VERTICAL), (textBD, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(fileExportPanel, -1, ''), 1, wx.EXPAND), (self.choiceBD, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) fileExportPanel.SetSizerAndFit(gridSizer) return fileExportPanel
def createPortmidiPane(self, panel): portmidiPanel = wx.Panel(panel) portmidiPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(5, 3, 5, 5) # Input textIn = wx.StaticText(portmidiPanel, 0, 'Input Device :') textIn.SetForegroundColour(PREFS_FOREGROUND) textIn.SetFont(self.font) availableMidiIns = [] for d in CeciliaLib.getVar("availableMidiInputs"): availableMidiIns.append(CeciliaLib.ensureNFD(d)) try: initInput = availableMidiIns[CeciliaLib.getVar("availableMidiInputIndexes").index(CeciliaLib.getVar("midiDeviceIn"))] except: if len(availableMidiIns) >= 1: initInput = availableMidiIns[0] else: initInput = '' self.midiChoiceInput = CustomMenu(portmidiPanel, choice=availableMidiIns, init=initInput, size=(168,20), outFunction=self.changeMidiInput) gridSizer.AddMany([ (textIn, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(portmidiPanel, -1, '', size=(75,-1)), 1, wx.EXPAND), (self.midiChoiceInput, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) portmidiPanel.SetSizerAndFit(gridSizer) return portmidiPanel
def onEntry(self, value): if type(value) != ListType: value = self.convertToList(value) if CeciliaLib.getVar("currentModule") != None and self.rate == "k": getattr(CeciliaLib.getVar("currentModule"), self.name)(value) if self.popup != None: self.popup[0].setValue(self.popup[1], True)
def onSelectOutputFilename(self): file = CeciliaLib.saveFileDialog(self, AUDIO_FILE_WILDCARD, type='Save audio') if file != None: CeciliaLib.setVar("saveAudioFilePath", os.path.split(file)[0]) return file
def changeSr(self, index, label): sr = int(label.strip()) CeciliaLib.setSr(sr) ksmps = CeciliaLib.getKsmps() kr = sr / ksmps CeciliaLib.setKr(kr)
def changeKsmps(self, index, label): ksmps = int(self.choiceKsmps.getLabel().strip()) CeciliaLib.setKsmps(ksmps) sr = CeciliaLib.getSr() kr = sr / ksmps CeciliaLib.setKr(kr)
def changeSr(self, index, label): sr = int(label.strip()) CeciliaLib.setSr(sr) ksmps = CeciliaLib.getKsmps() kr = sr/ksmps CeciliaLib.setKr(kr)
def createCeciliaPanel(self, panel): ceciliaPanel = wx.Panel(panel) ceciliaPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(3,3,10,3) textTotalTime = wx.StaticText(ceciliaPanel, 0, 'Total time default (sec) :') textTotalTime.SetFont(self.font) self.choiceTotalTime = CustomMenu(ceciliaPanel, choice= ["10.0", "30.0", "60.0", "120.0", "300.0", "600.0", "1200.0", "2400.0", "3600.0"], init=str(CeciliaLib.getDefaultTotalTime()), outFunction=self.changeDefaultTotalTime) textUseTooltips = wx.StaticText(ceciliaPanel, 0, 'Use tooltips :') textUseTooltips.SetFont(self.font) self.tooltipsToggle = Toggle(ceciliaPanel, CeciliaLib.getUseTooltips(), outFunction=self.enableTooltips) textgraphTexture = wx.StaticText(ceciliaPanel, 0, 'Use grapher texture :') textgraphTexture.SetFont(self.font) self.textureToggle = Toggle(ceciliaPanel, CeciliaLib.getUseGraphTexture(), outFunction=self.enableGraphTexture) gridSizer.AddMany([ (textTotalTime, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, '', size=(86,-1)), 1, wx.EXPAND), (self.choiceTotalTime, 0, wx.ALIGN_CENTER_VERTICAL), (textUseTooltips, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, ''), 1, wx.EXPAND), (self.tooltipsToggle, 0, wx.ALIGN_CENTER_VERTICAL), (textgraphTexture, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(ceciliaPanel, -1, ''), 1, wx.EXPAND), (self.textureToggle, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) ceciliaPanel.SetSizerAndFit(gridSizer) return ceciliaPanel
def createCsoundPanel(self, panel): csoundPanel = wx.Panel(panel) csoundPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(3,3,10,3) textKsmps = wx.StaticText(csoundPanel, 0, 'ksmps :') textKsmps.SetFont(self.font) self.choiceKsmps = CustomMenu(csoundPanel, choice= ["1", "2", "5", "10", "25", "50", "100"], init=str(CeciliaLib.getKsmps()), outFunction=self.changeKsmps) textHardbuff = wx.StaticText(csoundPanel, 0, 'Hardware buffer :') textHardbuff.SetFont(self.font) self.choiceHardBuff = CustomMenu(csoundPanel, choice=HARD_BUFF_SIZES, init=str(CeciliaLib.getHardBuf()), outFunction=self.changeHardBuff) textSoftbuff = wx.StaticText(csoundPanel, 0, 'Software buffer :') textSoftbuff.SetFont(self.font) self.choiceSoftBuff = CustomMenu(csoundPanel, choice=SOFT_BUFF_SIZES, init=str(CeciliaLib.getSoftBuf()), outFunction=self.changeSoftBuff) gridSizer.AddMany([ (textKsmps, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(csoundPanel, -1, '', size=(125,-1)), 1, wx.EXPAND), (self.choiceKsmps, 0, wx.ALIGN_CENTER_VERTICAL), (textHardbuff, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(csoundPanel, -1, ''), 1, wx.EXPAND), (self.choiceHardBuff, 0, wx.ALIGN_CENTER_VERTICAL), (textSoftbuff, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(csoundPanel, -1, ''), 1, wx.EXPAND), (self.choiceSoftBuff, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) csoundPanel.SetSizerAndFit(gridSizer) return csoundPanel
def createPortmidiPane(self, panel): portmidiPanel = wx.Panel(panel) portmidiPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(5, 3, 5, 5) # Input textIn = wx.StaticText(portmidiPanel, 0, 'Input Device :') textIn.SetFont(self.font) availableMidiIns = [] for d in CeciliaLib.getAvailableMidiInputs(): availableMidiIns.append(CeciliaLib.ensureNFD(d)) if availableMidiIns != [] and 'All' not in availableMidiIns: availableMidiIns.append('All') if CeciliaLib.getMidiDeviceIn() != '': try: initInput = availableMidiIns[int(CeciliaLib.getMidiDeviceIn())] except: initInput = 'dump' else: initInput = 'dump' self.midiChoiceInput = CustomMenu(portmidiPanel, choice=availableMidiIns, init=initInput, size=(168,20), outFunction=self.changeMidiInput) gridSizer.AddMany([ (textIn, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(portmidiPanel, -1, '', size=(74,-1)), 1, wx.EXPAND), (self.midiChoiceInput, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) portmidiPanel.SetSizerAndFit(gridSizer) return portmidiPanel
def onDriverPageChange(self, index, label): CeciliaLib.setAudioPort(label) self.driverPanels[self.driverCurrentPane].Hide() self.driverPanels[label].Show() self.driverPanels[label].SetPosition(self.driverBox.GetPosition()) self.driverBox.Replace(self.driverPanels[self.driverCurrentPane], self.driverPanels[label]) self.driverCurrentPane = label self.Refresh()
def createHorizontalSlidersPanel(self): panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) panel.SetBackgroundColour(BACKGROUND_COLOUR) box, sl = buildHorizontalSlidersBox(panel, CeciliaLib.getInterfaceWidgets()) CeciliaLib.setUserSliders(sl) panel.SetSizerAndFit(box) size = panel.GetSize() return panel, size
def createTogglePopupPanel(self): panel = wx.Panel(self, -1, style=wx.SIMPLE_BORDER) panel.SetBackgroundColour(BACKGROUND_COLOUR) box, objs = buildTogglePopupBox(panel, CeciliaLib.getInterfaceWidgets()) panel.SetSizerAndFit(box) CeciliaLib.setUserTogglePopups(objs) size = panel.GetSize() return panel, objs, size
def onDriverPageChange(self, index, label): CeciliaLib.setVar("audioHostAPI", label) self.driverPanels[self.driverCurrentPane].Hide() self.driverPanels[label].Show() self.driverPanels[label].SetPosition(self.driverBox.GetPosition()) self.driverBox.Replace(self.driverPanels[self.driverCurrentPane], self.driverPanels[label]) self.driverCurrentPane = label wx.CallAfter(self.Refresh)
def createJackPane(self, panel): jackPanel = wx.Panel(panel) jackPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(3, 3, 5, 5) jackClientLabel = wx.StaticText(jackPanel, -1, 'Jack client :') jackClientLabel.SetFont(self.font) self.jackClient = wx.TextCtrl(jackPanel, -1, CeciliaLib.getJackParams()['client'], size=(235, -1), style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.jackClient.SetFont(self.font) self.jackClient.Bind(wx.EVT_TEXT_ENTER, self.changeJackClient) self.jackClient.SetForegroundColour((50, 50, 50)) self.jackClient.SetBackgroundColour("#999999") jackInPortLabel = wx.StaticText(jackPanel, -1, 'In Port :') jackInPortLabel.SetFont(self.font) self.jackInPort = wx.TextCtrl(jackPanel, -1, CeciliaLib.getJackParams()['inPortName'], size=(235, -1), style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.jackInPort.SetFont(self.font) self.jackInPort.Bind(wx.EVT_TEXT_ENTER, self.changeJackInPort) self.jackInPort.SetForegroundColour((50, 50, 50)) self.jackInPort.SetBackgroundColour("#999999") jackOutPortLabel = wx.StaticText(jackPanel, -1, 'Out Port :') jackOutPortLabel.SetFont(self.font) self.jackOutPort = wx.TextCtrl( jackPanel, -1, CeciliaLib.getJackParams()['outPortName'], size=(235, -1), style=wx.TE_PROCESS_ENTER | wx.NO_BORDER) self.jackOutPort.SetFont(self.font) self.jackOutPort.Bind(wx.EVT_TEXT_ENTER, self.changeJackOutPort) self.jackOutPort.SetForegroundColour((50, 50, 50)) self.jackOutPort.SetBackgroundColour("#999999") gridSizer.AddMany([ (jackClientLabel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(jackPanel, -1, '', size=(15, -1)), 1, wx.EXPAND), (self.jackClient, 0, wx.ALIGN_CENTER_VERTICAL), (jackInPortLabel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(jackPanel, -1, ''), 1, wx.EXPAND), (self.jackInPort, 0, wx.ALIGN_CENTER_VERTICAL), (jackOutPortLabel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(jackPanel, -1, ''), 1, wx.EXPAND), (self.jackOutPort, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) jackPanel.SetSizerAndFit(gridSizer) return jackPanel
def getText(self): globalOuts =['gaGlobalOut%d' % i for i in range(CeciliaLib.getNchnls())] text = '' text += 'k%s init %d\n' % (self.presetName, self.preset.getIndex()) text += 'k%s chnget "%s_value"\n' % (self.presetName, self.presetName) for i in range(CeciliaLib.getNchnls()): text += '%s plugin_gate %s, gk%s, gk%s, gk%s, k%s\n' % (globalOuts[i], globalOuts[i], self.knob1.getName(), self.knob2.getName(), self.knob3.getName(), self.presetName) return text
def createPathsPanel(self, panel): pathsPanel = wx.Panel(panel) pathsPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(0,2,2,5) #Soundfile Player textSfPlayerLabel = wx.StaticText(pathsPanel, -1, 'Soundfile Player :') textSfPlayerLabel.SetFont(self.font) self.textSfPlayerPath = wx.TextCtrl(pathsPanel, -1, CeciliaLib.getSoundfilePlayerPath(), size=(270,16), style=wx.TE_PROCESS_ENTER|wx.NO_BORDER) self.textSfPlayerPath.SetFont(self.font) self.textSfPlayerPath.Bind(wx.EVT_TEXT_ENTER, self.handleSfPlayerPath) self.textSfPlayerPath.SetForegroundColour((50,50,50)) self.textSfPlayerPath.SetBackgroundColour("#AAAAAA") buttonSfPlayerPath = CloseBox(pathsPanel, outFunction=self.changeSfPlayer, label='Set...') #Soundfile Editor textSfEditorLabel = wx.StaticText(pathsPanel, -1, 'Soundfile Editor :') textSfEditorLabel.SetFont(self.font) self.textSfEditorPath = wx.TextCtrl(pathsPanel, -1, CeciliaLib.getSoundfileEditorPath(), size=(270,16), style=wx.TE_PROCESS_ENTER|wx.NO_BORDER) self.textSfEditorPath.SetFont(self.font) self.textSfEditorPath.Bind(wx.EVT_TEXT_ENTER, self.handleSfEditorPath) self.textSfEditorPath.SetForegroundColour((50,50,50)) self.textSfEditorPath.SetBackgroundColour("#AAAAAA") buttonSfEditorPath = CloseBox(pathsPanel, outFunction=self.changeSfEditor, label='Set...') textPrefPathLabel = wx.StaticText(pathsPanel, -1, 'Preferred paths :') textPrefPathLabel.SetFont(self.font) self.textPrefPath = wx.TextCtrl(pathsPanel, -1, CeciliaLib.getPrefPath(), size=(270,16), style=wx.TE_PROCESS_ENTER|wx.NO_BORDER) self.textPrefPath.SetFont(self.font) self.textPrefPath.Bind(wx.EVT_TEXT_ENTER, self.handleEditPrefPath) self.textPrefPath.SetForegroundColour((50,50,50)) self.textPrefPath.SetBackgroundColour("#AAAAAA") buttonPrefPath = CloseBox(pathsPanel, outFunction=self.addPrefPath, label='Add...') gridSizer.AddMany([ (textSfPlayerLabel, 0, wx.EXPAND | wx.LEFT, PADDING), (wx.StaticText(pathsPanel), 0, wx.EXPAND | wx.RIGHT, 15), (self.textSfPlayerPath, 0, wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (buttonSfPlayerPath, 0, wx.RIGHT, 15), (textSfEditorLabel, 0, wx.EXPAND | wx.LEFT | wx.TOP, PADDING), (wx.StaticText(pathsPanel, -1, ''), 0, wx.EXPAND | wx.RIGHT, 15), (self.textSfEditorPath, 0, wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (buttonSfEditorPath, 0, wx.RIGHT, 15), (textPrefPathLabel, 0, wx.EXPAND | wx.LEFT | wx.TOP, PADDING), (wx.StaticText(pathsPanel, -1, ''), 0, wx.EXPAND | wx.RIGHT, 15), (self.textPrefPath, 0, wx.EXPAND | wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (buttonPrefPath, 0, wx.RIGHT, 15), ]) gridSizer.AddGrowableCol(0, 1) self.textPrefPath.Navigate() panel.SetSizerAndFit(gridSizer) return pathsPanel
def openRecent(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id).GetLabel() if os.path.isfile(file[:-1]): CeciliaLib.openCeciliaFile(self, file[:-1]) self.updateTitle() else: CeciliaLib.showErrorDialog("Error while trying to open a file!", "No such file : %s" % file[:-1]) self.newRecent(file[:-1], remove=True)
def onClose(self, event): CeciliaLib.setVar("interfaceSize", self.GetSize()) CeciliaLib.setVar("interfacePosition", self.GetPosition()) CeciliaLib.resetWidgetVariables() try: self.Destroy() except: pass CeciliaLib.getVar("mainFrame").SetFocus() CeciliaLib.getVar("mainFrame").Hide()
def callback(self): state = self.csound.GetChannel('ready') CeciliaLib.csoundIsRunning(state) time = self.csound.GetChannel('time') wx.CallAfter(CeciliaLib.getCeciliaEditor().setTime, time) if CeciliaLib.getInterface(): wx.CallAfter(CeciliaLib.getControlPanel().updateTime, time) amps = [] for i in range(CeciliaLib.getNchnls()): amps.append(self.csound.GetChannel('rms%i' % i)) wx.CallAfter(CeciliaLib.getControlPanel().updateAmps, amps) if self.callbackPass == 1: for slider in self.activeSliders: name = slider.getName() if type(slider.getValue()) in [ListType, TupleType]: val = [] val.append(self.csound.GetChannel(str(name) + '_min')) val.append(self.csound.GetChannel(str(name) + '_max')) else: val = self.csound.GetChannel(str(name)) if self.channelValues[name] != val: self.channelValues[name] = val wx.CallAfter(slider.update, val) else: self.callbackPass = 1 stop = self.csound.GetChannel('stop') if stop == 1: CeciliaLib.stopCeciliaSound() self.call.stop()
def createPortaudioPane(self, panel): portaudioPanel = wx.Panel(panel) portaudioPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(5, 3, 5, 5) # Input textIn = wx.StaticText(portaudioPanel, 0, 'Input Device :') textIn.SetFont(self.font) availableAudioIns = [] for d in CeciliaLib.getAvailableAudioInputs(): availableAudioIns.append(CeciliaLib.ensureNFD(d)) if CeciliaLib.getAudioInput() != '': try: initInput = availableAudioIns[int(CeciliaLib.getAudioInput())] except: initInput = 'dump' else: initInput = 'dump' self.choiceInput = CustomMenu(portaudioPanel, choice=availableAudioIns, init=initInput, size=(168, 20), outFunction=self.changeAudioInput) if CeciliaLib.getAudioInput() == '' or CeciliaLib.getEnableAudioInput( ) == 0: initInputState = 0 else: initInputState = 1 self.inputToggle = Toggle(portaudioPanel, initInputState, outFunction=self.enableAudioInput) # Output textOut = wx.StaticText(portaudioPanel, 0, 'Output Device :') textOut.SetFont(self.font) availableAudioOuts = [] for d in CeciliaLib.getAvailableAudioOutputs(): availableAudioOuts.append(CeciliaLib.ensureNFD(d)) try: initOutput = availableAudioOuts[int(CeciliaLib.getAudioOutput())] except: initOutput = availableAudioOuts[0] self.choiceOutput = CustomMenu(portaudioPanel, choice=availableAudioOuts, init=initOutput, size=(168, 20), outFunction=self.changeAudioOutput) gridSizer.AddMany([ (textIn, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (self.inputToggle, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, 45), (self.choiceInput, 0, wx.ALIGN_CENTER_VERTICAL), (textOut, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(portaudioPanel, -1, '', size=(65, -1)), 1, wx.EXPAND), (self.choiceOutput, 0, wx.ALIGN_CENTER_VERTICAL), ]) gridSizer.AddGrowableCol(1, 1) portaudioPanel.SetSizerAndFit(gridSizer) return portaudioPanel
def marioSwitch(self, evt): if evt.GetInt() == 1: self.FindItemById(ID_MARIO).Check(1) for slider in CeciliaLib.getVar("userSliders"): slider.slider.useMario = True slider.slider.Refresh() else: self.FindItemById(ID_MARIO).Check(0) for slider in CeciliaLib.getVar("userSliders"): slider.slider.useMario = False slider.slider.Refresh()
def getText(self): globalOuts =['gaGlobalOut%d' % i for i in range(CeciliaLib.getNchnls())] text = '' text += 'k%s init %d\n' % (self.presetName, self.preset.getIndex()) text += 'k%s chnget "%s_value"\n' % (self.presetName, self.presetName) text += 'if k%s == 1 then\n' % self.presetName for i in range(CeciliaLib.getNchnls()): text += '%s eqfil %s, gk%s, gk%s, gk%s\n' % (globalOuts[i], globalOuts[i], self.knob1.getName(), self.knob2.getName(), self.knob3.getName()) text += 'endif\n' return text
def setPlay(self, x): if x: self.mode = 2 data = CeciliaLib.getGrapher().plotter.data for line in data: if line.getName() == self.name: line.setShow(1) CeciliaLib.getGrapher().plotter.draw() else: self.mode = 0 self.Refresh()
def getText(self): globalOuts =['gaGlobalOut%d' % i for i in range(CeciliaLib.getNchnls())] text = '' text += 'gi_plugin_ampmod_tab ftgenonce 0, 0, 8192, 10, 1\n' text += 'k%s init %d\n' % (self.presetName, self.preset.getIndex()) text += 'k%s chnget "%s_value"\n' % (self.presetName, self.presetName) for i in range(CeciliaLib.getNchnls()): text += '%s plugin_ampmod %s, gk%s, gk%s, gk%s, k%s, %d, gi_plugin_ampmod_tab\n' % (globalOuts[i], globalOuts[i], self.knob1.getName(), self.knob2.getName(), self.knob3.getName(), self.presetName, (i%2)) return text
def updateMidiIn(self): CeciliaLib.queryAudioMidiDrivers() inputs = CeciliaLib.getAvailableMidiInputs() if inputs == []: self.midiChoiceInput.setChoice(['']) else: inputs.append('All') self.midiChoiceInput.setChoice(inputs) self.midiChoiceInput.setByIndex(int(CeciliaLib.getMidiDeviceIn()))
def MouseRightDown(self, evt): if self._enable: rec = wx.Rect(5, 13, 45, 45) pos = evt.GetPosition() if rec.Contains(pos): if evt.ShiftDown(): self.setMidiCtl(None) else: CeciliaLib.getCsound().midiLearn(self) self.inMidiLearnMode() evt.Skip()
def onDeletePreset(self): if CeciliaLib.getVar("presets").has_key(self.currentPreset): dlg2 = wx.MessageDialog(self, 'Preset %s will be deleted. Are you sure?' % self.currentPreset, 'Warning!', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION) if dlg2.ShowModal() == wx.ID_NO: ok = False else: ok = True dlg2.Destroy() if ok: CeciliaLib.deletePreset(self.currentPreset) self.presetChoice.setChoice(self.orderingPresetNames(), False) self.presetChoice.setStringSelection("")
def getText(self): globalOuts =['gaGlobalOut%d' % i for i in range(CeciliaLib.getNchnls())] text = '' text += 'k%s init %d\n' % (self.presetName, self.preset.getIndex()) text += 'k%s chnget "%s_value"\n' % (self.presetName, self.presetName) text += 'if k%s == 1 then\n' % self.presetName for i in range(CeciliaLib.getNchnls()): text += 'aphaser_%d_%d phaser2 %s, gk%s, gk%s, 8, 1, gk%s, .5\n' % (i, self.order, globalOuts[i], self.knob1.getName(), self.knob2.getName(), self.knob3.getName()) text += '%s = (%s + aphaser_%d_%d) * 0.707 \n' % (globalOuts[i], globalOuts[i], i, self.order) text += 'endif\n' return text
def getText(self): globalOuts =['gaGlobalOut%d' % i for i in range(CeciliaLib.getNchnls())] text = '' text += 'k%s init %d\n' % (self.presetName, self.preset.getIndex()) text += 'k%s chnget "%s_value"\n' % (self.presetName, self.presetName) text += 'if k%s == 1 then\n' % self.presetName for i in range(CeciliaLib.getNchnls()): text += 'arev%d_%d nreverb %s*0.5, gk%s, gk%s, 0, 32, gicomb%d, 8, giallp%d\n' % (self.order, i, globalOuts[i], self.knob2.getName(), self.knob3.getName(), (i%4), (i%4)) text += '%s = %s * (1 - gk%s) + arev%d_%d * gk%s\n' % (globalOuts[i], globalOuts[i], self.knob1.getName(), self.order, i, self.knob1.getName()) text += 'endif\n' return text
def updateTitle(self, isModified=False): if CeciliaLib.getVar("builtinModule"): file = os.path.split(CeciliaLib.getVar("currentCeciliaFile", unicode=True))[1] else: file = CeciliaLib.getVar("currentCeciliaFile", unicode=True) title = os.path.split(CeciliaLib.getVar("currentCeciliaFile", unicode=True))[1] if not isModified: if CeciliaLib.getVar("interface"): CeciliaLib.getVar("interface").updateTitle('Interface - ' + title) else: if CeciliaLib.getVar("interface"): CeciliaLib.getVar("interface").updateTitle('*** Interface - ' + title + ' ***')
def onOpenBuiltin(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id) filename = file.GetLabel() filedict = self.GetMenuBar().files for key in filedict.keys(): if filename in filedict[key]: dirname = key break name = os.path.join(CeciliaLib.ensureNFD(MODULES_PATH), dirname, filename) CeciliaLib.openCeciliaFile(self, name, True) self.updateTitle()
def onPresetSelect(self, idxPreset, newPreset): if CeciliaLib.getVar("presets").has_key(newPreset): 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 createTogglePopupPanel(self): if CeciliaLib.getVar("systemPlatform") == "win32": BORDER = wx.DOUBLE_BORDER else: BORDER = wx.SIMPLE_BORDER panel = wx.Panel(self, -1, style=BORDER) panel.SetBackgroundColour(BACKGROUND_COLOUR) widgets = CeciliaLib.getVar("interfaceWidgets") box, objs = buildTogglePopupBox(panel, widgets) panel.SetSizerAndFit(box) CeciliaLib.setVar("userTogglePopups", objs) size = panel.GetSize() return panel, objs, size
def createSlidersPanel(self): if CeciliaLib.getVar("systemPlatform") == "win32": BORDER = wx.DOUBLE_BORDER else: BORDER = wx.SIMPLE_BORDER panel = wx.Panel(self, -1, style=BORDER) panel.SetBackgroundColour(BACKGROUND_COLOUR) widgets = CeciliaLib.getVar("interfaceWidgets") box, sl = buildHorizontalSlidersBox(panel, widgets) CeciliaLib.setVar("userSliders", sl) panel.SetSizerAndFit(box) size = panel.GetSize() return panel, size
def runForSyntaxCheck(self, csdfile): try: os.remove(os.path.join(TMP_PATH, 'csoundLog.txt')) except: pass CeciliaLib.setDayTime() self.logfile = open(os.path.join(TMP_PATH, 'csoundLog.txt'), 'w') cs = csnd6.Csound() cs.SetMessageCallback(self.logger) cs.Compile('--syntax-check-only', csdfile) self.logfile.close()
def createTogglePopupPanel(self, parent, label='', size=(-1, -1), style=wx.SUNKEN_BORDER): panel = wx.Panel(self, -1) panel.SetBackgroundColour(BACKGROUND_COLOUR) box, objs = buildTogglePopupBox(panel, CeciliaLib.getVar("interfaceWidgets")) panel.SetSizerAndFit(box) CeciliaLib.setVar("userTogglePopups", objs) size = panel.GetSize() return panel, objs, size
def onOpenPrefModule(self, event): menu = self.GetMenuBar() id = event.GetId() file = menu.FindItemById(id) filename = file.GetLabel() filedir = file.GetMenu().GetTitle() prefPath = CeciliaLib.getVar("prefferedPath") prefPaths = prefPath.split(';') prefBaseNames = [os.path.basename(path) for path in prefPaths] dirname = prefPaths[prefBaseNames.index(filedir)] if dirname: name = os.path.join(dirname, filename) CeciliaLib.openCeciliaFile(self, name) self.updateTitle()
def createHorizontalSlidersPanel(self, parent, label='', size=(-1, -1), style=wx.SUNKEN_BORDER, name=''): panel = wx.Panel(self, -1) panel.SetBackgroundColour(BACKGROUND_COLOUR) box, sl = buildHorizontalSlidersBox( panel, CeciliaLib.getVar("interfaceWidgets")) CeciliaLib.setVar("userSliders", sl) panel.SetSizerAndFit(box) size = panel.GetSize() return panel, size
def onRememberInputSound(self, event): if event.GetInt() == 1: CeciliaLib.getVar("interface").menubar.editMenu.FindItemById(ID_REMEMBER).Check(True) CeciliaLib.setVar("rememberedSound", True) else: CeciliaLib.getVar("interface").menubar.editMenu.FindItemById(ID_REMEMBER).Check(False) CeciliaLib.setVar("rememberedSound", False)
def onSavePreset(self): dlg = wx.TextEntryDialog(self, 'Enter preset name:', 'Saving Preset', self.currentPreset) if dlg.ShowModal() == wx.ID_OK: newPreset = CeciliaLib.ensureNFD(dlg.GetValue()) else: return dlg.Destroy() if newPreset == '': CeciliaLib.showErrorDialog('Failed saving preset', 'You must give a name to your preset!') return if newPreset == 'init': CeciliaLib.showErrorDialog( 'Failed saving preset', '"init" is reserved. You must give another name to your preset!' ) return if newPreset in CeciliaLib.getVar("presets").keys(): dlg2 = wx.MessageDialog( self, 'The preset you entered already exists. Are you sure you want to overwrite it?', 'Existing preset!', wx.YES_NO | wx.NO_DEFAULT | wx.ICON_INFORMATION) if dlg2.ShowModal() == wx.ID_NO: return dlg2.Destroy() self.currentPreset = newPreset CeciliaLib.savePresetToDict(self.currentPreset) self.presetChoice.setChoice(self.orderingPresetNames(), False) self.presetChoice.setStringSelection(self.currentPreset)
def createJackPane(self, panel): jackPanel = wx.Panel(panel) jackPanel.SetBackgroundColour(BACKGROUND_COLOUR) gridSizer = wx.FlexGridSizer(3, 3, 5, 5) jackClientLabel = wx.StaticText(jackPanel, -1, 'Jack client :') jackClientLabel.SetForegroundColour(PREFS_FOREGROUND) jackClientLabel.SetFont(self.font) self.jackClient = wx.TextCtrl(jackPanel, -1, CeciliaLib.getVar("jack")['client'], size=(235,-1), style=wx.TE_PROCESS_ENTER|wx.NO_BORDER) self.jackClient.SetFont(self.font) self.jackClient.Bind(wx.EVT_TEXT_ENTER, self.changeJackClient) self.jackClient.SetForegroundColour(PREFS_FOREGROUND) self.jackClient.SetBackgroundColour(PREFS_PATH_BACKGROUND) gridSizer.AddMany([ (jackClientLabel, 0, wx.LEFT | wx.ALIGN_CENTER_VERTICAL, PADDING), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (self.jackClient, 0, wx.ALIGN_CENTER_VERTICAL), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), (wx.StaticText(jackPanel, -1, '', size=(17,-1)), 1, wx.EXPAND), ]) gridSizer.AddGrowableCol(1, 1) jackPanel.SetSizerAndFit(gridSizer) return jackPanel