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))
     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:
             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()
Beispiel #2
0
    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 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()
Beispiel #4
0
 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()
Beispiel #5
0
 def onUpdateInterface(self, event):
     if event != 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 != None:
         for i, cfilein in enumerate(
                 CeciliaLib.getControlPanel().getCfileinList()):
             if i >= len(snds):
                 break
             cfilein.onLoadFile(snds[i])
Beispiel #6
0
 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))
     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:
             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()
Beispiel #7
0
    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 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)
Beispiel #9
0
    def OnSize(self, evt):
        scrPt = {'win32': 1, 'cygwin': 1, 'linux2': 1, 'darwin': 0}
        minSz = {'win32': 250, 'cygwin': 250, 'linux2': 245, 'darwin': 245}
        platform = CeciliaLib.getVar("systemPlatform")
        if CeciliaLib.getVar("interface") != None:
            if CeciliaLib.getControlPanel().GetScrollRange(
                    wx.VERTICAL) <= scrPt[platform]:
                hasScrollbar = False
                self._mgr.GetPane('controlPanel').MinSize((230, -1))
            else:
                hasScrollbar = True
                self._mgr.GetPane('controlPanel').MinSize(
                    (minSz[platform], -1))

            if self.hasScrollbar != hasScrollbar:
                self.hasScrollbar = hasScrollbar

            wx.CallAfter(self._mgr.Update)
        evt.Skip()
 def onUpdateInterface(self, event):
     if event != 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 != None:
         for i, cfilein in enumerate(CeciliaLib.getControlPanel().getCfileinList()):
             if i >= len(snds):
                 break
             cfilein.onLoadFile(snds[i])
 def onBounceToDisk(self, event):
     CeciliaLib.getControlPanel().onBounceToDisk()
Beispiel #12
0
 def onBounceToDisk(self, event):
     CeciliaLib.getControlPanel().onBounceToDisk()