[SCM] cecilia/master: Imported Upstream version 5.2.1
tiago at users.alioth.debian.org
tiago at users.alioth.debian.org
Thu Mar 10 06:08:03 UTC 2016
The following commit has been merged in the master branch:
commit 4438378d19b7fd3046c5aa3669d375acd6277b77
Author: Tiago Bortoletto Vaz <tiago at debian.org>
Date: Thu Mar 10 00:37:30 2016 -0500
Imported Upstream version 5.2.1
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..bf255fb
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,62 @@
+# Byte-compiled / optimized / DLL files
+__pycache__/
+*.py[cod]
+*$py.class
+
+# C extensions
+*.so
+
+# Distribution / packaging
+.Python
+env/
+build/
+develop-eggs/
+dist/
+downloads/
+eggs/
+.eggs/
+lib/
+lib64/
+parts/
+sdist/
+var/
+*.egg-info/
+.installed.cfg
+*.egg
+
+# PyInstaller
+# Usually these files are written by a python script from a template
+# before PyInstaller builds the exe, so as to inject date/other infos into it.
+*.manifest
+*.spec
+
+# Installer logs
+pip-log.txt
+pip-delete-this-directory.txt
+
+# Unit test / coverage reports
+htmlcov/
+.tox/
+.coverage
+.coverage.*
+.cache
+nosetests.xml
+coverage.xml
+*,cover
+
+# Translations
+*.mo
+*.pot
+
+# Django stuff:
+*.log
+
+# Sphinx documentation
+docs/_build/
+
+# PyBuilder
+target/
+
+# OSX Desktop
+.DS_Store
+
diff --git a/Resources/CeciliaLib.py b/Resources/CeciliaLib.py
index 2eb6f39..16f1687 100644
--- a/Resources/CeciliaLib.py
+++ b/Resources/CeciliaLib.py
@@ -417,12 +417,15 @@ def loadPresetFromDict(preset):
for input in getVar("userInputs"):
cfilein = getControlPanel().getCfileinFromName(input)
cfilein.reset()
+ cfilein.reinitSamplerFrame()
else:
if ok:
setVar("userInputs", copy.deepcopy(presetData[data]))
updateInputsFromDict()
else:
- pass
+ for input in getVar("userInputs"):
+ cfilein = getControlPanel().getCfileinFromName(input)
+ cfilein.reinitSamplerFrame()
elif data == 'userSliders':
slidersDict = presetData[data]
for slider in getVar("userSliders"):
@@ -431,7 +434,7 @@ def loadPresetFromDict(preset):
del slidersDict
elif data == 'plugins':
pluginsDict = copy.deepcopy(presetData[data])
- getControlPanel().setPlugins(pluginsDict)
+ wx.CallAfter(getControlPanel().setPlugins, pluginsDict)
del pluginsDict
elif data == 'userTogglePopups':
togDict = presetData[data]
@@ -441,7 +444,13 @@ def loadPresetFromDict(preset):
del togDict
else:
continue
- if presetData.has_key('userGraph'):
+ if preset == "init":
+ for line in getVar("grapher").getPlotter().getData():
+ try:
+ line.reinit()
+ except:
+ pass
+ elif presetData.has_key('userGraph'):
graphDict = presetData['userGraph']
ends = ['min', 'max']
for line in graphDict:
@@ -466,6 +475,22 @@ def loadPresetFromDict(preset):
setVar("currentModule", currentModule)
getVar("grapher").setTotalTime(getVar("totalTime"))
+ wx.CallAfter(againForPluginKnobs, presetData)
+
+### This is a hack to ensure that plugin knob automations are drawn in the grapher.
+### Called within a wx.CallAfter to be executed after wx.CallAfter(getControlPanel().setPlugins).
+def againForPluginKnobs(presetData):
+ if presetData.has_key('userGraph'):
+ graphDict = presetData['userGraph']
+ for line in graphDict:
+ for i, graphLine in enumerate(getVar("grapher").getPlotter().getData()):
+ if line == graphLine.getName():
+ graphLine.setLineState(copy.deepcopy(graphDict[line]))
+ break
+ del graphDict
+ getVar("grapher").getPlotter().draw()
+ getVar("grapher").setTotalTime(getVar("totalTime"))
+
def savePresetToDict(presetName):
presetDict = dict()
presetDict['nchnls'] = getVar("nchnls")
@@ -519,9 +544,9 @@ def savePresetToDict(presetName):
del graphDict
if presetName == "init":
- setVar("initPreset", presetDict)
+ setVar("initPreset", copy.deepcopy(presetDict))
else:
- getVar("presets")[presetName] = presetDict
+ getVar("presets")[presetName] = copy.deepcopy(presetDict)
setVar("isModified", True)
def completeUserInputsDict():
diff --git a/Resources/CeciliaPlot.py b/Resources/CeciliaPlot.py
index a9d37d6..33a7aa3 100644
--- a/Resources/CeciliaPlot.py
+++ b/Resources/CeciliaPlot.py
@@ -28,13 +28,13 @@
#
# Oct 15, 2004 Gordon Williams (g_will at cyberus.ca)
# - Imported modules given leading underscore to name.
-# - Added Cursor Line Tracking and User Point Labels.
+# - Added Cursor Line Tracking and User Point Labels.
# - Demo for Cursor Line Tracking and Point Labels.
# - Size of plot preview frame adjusted to show page better.
# - Added helper functions PositionUserToScreen and PositionScreenToUser in PlotCanvas.
# - Added functions GetClosestPoints (all curves) and GetClosestPoint (only closest curve)
# can be in either user coords or screen coords.
-#
+#
#
"""
@@ -42,8 +42,8 @@ This is a simple light weight plotting module that can be used with
Boa or easily integrated into your own wxPython application. The
emphasis is on small size and fast plotting for large data sets. It
has a reasonable number of features to do line and scatter graphs
-easily as well as simple bar graphs. It is not as sophisticated or
-as powerful as SciPy Plt or Chaco. Both of these are great packages
+easily as well as simple bar graphs. It is not as sophisticated or
+as powerful as SciPy Plt or Chaco. Both of these are great packages
but consume huge amounts of computer resources for simple plots.
They can be found at http://scipy.com
@@ -66,7 +66,7 @@ Major Additions Gordon Williams Feb. 2003 (g_will at cyberus.ca)
-Doc strings and lots of comments
-Optimizations for large number of points
-Legends
-
+
Did a lot of work here to speed markers up. Only a factor of 4
improvement though. Lines are much faster than markers, especially
filled markers. Stay away from circles and triangles unless you
@@ -91,41 +91,27 @@ Zooming controls with mouse (when enabled):
import string as _string
import time as _time
-import wx, pdb
+import wx
import CeciliaLib
from Widgets import CECTooltip
from constants import *
-# Needs Numeric or numarray or NumPy
try:
- import numpy.oldnumeric as _Numeric
+ import numpy as _Numeric
except:
- try:
- import numarray as _Numeric #if numarray is used it is renamed Numeric
- except:
- try:
- import Numeric as _Numeric
- except:
- msg= """
- This module requires the Numeric/numarray or NumPy module,
- which could not be imported. It probably is not installed
- (it's not part of the standard Python distribution). See the
- Numeric Python site (http://numpy.scipy.org) for information on
- downloading source or binaries."""
- raise ImportError, "Numeric,numarray or NumPy not found. \n" + msg
-
+ msg= """
+ This module requires the NumPy module, which could not be imported.
+ It probably is not installed (it's not part of the standard Python
+ distribution). See the NumPy Python site (http://www.numpy.org/)
+ for information on downloading source or binaries."""
+ raise ImportError, "NumPy not found. \n" + msg
-from constants import FONT_FACE
-#
-# Plotting classes...
-#
class PolyPoints:
"""Base Class for lines and markers
- All methods are private.
"""
-
def __init__(self, points, attr):
- self._points = _Numeric.array(points).astype(_Numeric.Float64)
+ self._points = _Numeric.array(points).astype(_Numeric.float32)
self._logscale = (False, False)
self.currentScale= (1,1)
self.currentShift= (0,0)
@@ -136,10 +122,10 @@ class PolyPoints:
if name not in self._attributes.keys():
raise KeyError, "Style attribute incorrect. Should be one of %s" % self._attributes.keys()
self.attributes[name] = value
-
+
def setLogScale(self, logscale):
self._logscale = logscale
-
+
def __getattr__(self, name):
if name == 'points':
if len(self._points)>0:
@@ -153,7 +139,7 @@ class PolyPoints:
return self._points
else:
raise AttributeError, name
-
+
def log10(self, data, ind):
data = _Numeric.compress(data[:,ind]>0,data,0)
data[:,ind] = _Numeric.log10(data[:,ind])
@@ -180,7 +166,7 @@ class PolyPoints:
self.currentScale= scale
self.currentShift= shift
# else unchanged use the current scaling
-
+
def getLegend(self):
return self.attributes['legend']
@@ -206,12 +192,12 @@ class PolyPoints:
pntIndex = _Numeric.argmin(d)
dist = d[pntIndex]
return [pntIndex, self.points[pntIndex], self.scaled[pntIndex], dist]
-
+
class PolyLine(PolyPoints):
"""Class to define line type and style
- All methods except __init__ are private.
"""
-
+
_attributes = {'colour': 'black',
'width': 1,
'style': wx.SOLID,
@@ -267,12 +253,12 @@ def GetCircleBitmap(w=6, h=6, fillcol="#000000", pencol="#000000"):
dc.SelectObject(wx.NullBitmap)
b.SetMaskColour(maskColour)
return b
-
+
class PolyMarker(PolyPoints):
"""Class to define marker type and style
- All methods except __init__ are private.
"""
-
+
_attributes = {'colour': 'black',
'width': 1,
'size': 2,
@@ -293,7 +279,7 @@ class PolyMarker(PolyPoints):
'fillstyle'= wx.SOLID, - wx.Brush fill style (use wx.TRANSPARENT for no fill)
'marker'= 'circle' - Marker shape
'legend'= '' - Marker Legend to display
-
+
Marker Shapes:
- 'circle'
- 'dot'
@@ -306,7 +292,7 @@ class PolyMarker(PolyPoints):
- 'bmpsel' ---> Cecilia 5 grapher selected marker
- 'none' ---> Cecilia 5 grapher non selected lines
"""
-
+
PolyPoints.__init__(self, points, attr)
self.circleBitmap = GetCircleBitmap(6, 6, "#000000", "#000000")
self.circleBitmapSel = GetCircleBitmap(8, 8, "#EEEEEE", "#000000")
@@ -319,7 +305,6 @@ class PolyMarker(PolyPoints):
fillstyle = self.attributes['fillstyle']
marker = self.attributes['marker']
- ###### May be removed ######
if colour and not isinstance(colour, wx.Colour):
colour = wx.NamedColour(colour)
if fillcolour and not isinstance(fillcolour, wx.Colour):
@@ -402,7 +387,7 @@ class PolyMarker(PolyPoints):
poly.shape= (len(coords),3,2)
poly += shape
dc.DrawPolygonList(poly.astype(_Numeric.Int32))
-
+
def _cross(self, dc, coords, size=1):
fact= 2.5*size
for f in [[-fact,-fact,fact,fact],[-fact,fact,fact,-fact]]:
@@ -442,7 +427,7 @@ class PlotGraphics:
return
for o in self.objects:
o.setLogScale(logscale)
-
+
def boundingBox(self):
p1, p2 = self.objects[0].boundingBox()
for o in self.objects[1:]:
@@ -466,7 +451,7 @@ class PlotGraphics:
def setYLabel(self, yLabel= ''):
"""Set the Y axis label on the graph"""
self.yLabel= yLabel
-
+
def setTitle(self, title= ''):
"""Set the title at the top of graph"""
self.title= title
@@ -497,14 +482,14 @@ class PlotGraphics:
oSymExt = o.getSymExtent(printerScale)
symExt = _Numeric.maximum(symExt, oSymExt)
return symExt
-
+
def getLegendNames(self):
"""Returns list of legend names"""
lst = [None]*len(self)
for i in range(len(self)):
lst[i]= self.objects[i].getLegend()
return lst
-
+
def __len__(self):
return len(self.objects)
@@ -540,13 +525,13 @@ class PlotCanvas(wx.Panel):
size=wx.DefaultSize, style=0, name="plotCanvas"):
"""Constructs a panel, which can be a child of a frame or
any other non-control window"""
-
+
wx.Panel.__init__(self, parent, id, pos, size, style, name)
sizer = wx.FlexGridSizer(2,2,0,0)
self.canvas = wx.Window(self, -1)
self.canvas.SetToolTip(CECTooltip(TT_GRAPHER))
-
+
self.sb_vert = wx.ScrollBar(self, -1, style=wx.SB_VERTICAL)
self.sb_vert.SetScrollbar(0,1000,1000,1000)
self.sb_hor = wx.ScrollBar(self, -1, style=wx.SB_HORIZONTAL)
@@ -556,20 +541,20 @@ class PlotCanvas(wx.Panel):
sizer.Add(self.sb_vert, 0, wx.EXPAND)
sizer.Add(self.sb_hor, 0, wx.EXPAND)
sizer.Add((0,0))
-
+
sizer.AddGrowableRow(0, 1)
sizer.AddGrowableCol(0, 1)
self.sb_vert.Show(False)
self.sb_hor.Show(False)
-
+
self.SetSizer(sizer)
self.Fit()
self.border = (1,1)
self.SetBackgroundColour("white")
-
+
# Create some mouse events for zooming
self.canvas.Bind(wx.EVT_LEFT_DOWN, self.OnMouseLeftDown)
self.canvas.Bind(wx.EVT_LEFT_UP, self.OnMouseLeftUp)
@@ -591,7 +576,7 @@ class PlotCanvas(wx.Panel):
self.HandCursor = wx.StockCursor(wx.CURSOR_HAND)
self.GrabHandCursor = wx.StockCursor(wx.CURSOR_HAND)
self.MagCursor = wx.StockCursor(wx.CURSOR_MAGNIFIER)
-
+
# Things for printing
self.print_data = wx.PrintData()
self.print_data.SetPaperId(wx.PAPER_LETTER)
@@ -610,10 +595,10 @@ class PlotCanvas(wx.Panel):
self._sb_yfullrange = 0
self._sb_xunit = 0
self._sb_yunit = 0
-
+
self._dragEnabled = False
self._screenCoordinates = _Numeric.array([0.0, 0.0])
-
+
self._logscale = (False, False)
self._background_bitmap = None
self._oldSize = wx.Size(0,0)
@@ -625,7 +610,7 @@ class PlotCanvas(wx.Panel):
self._zoomCorner2= _Numeric.array([0.0, 0.0]) # left mouse up corner
self._zoomEnabled= False
self._hasDragged= False
-
+
# Drawing Variables
self.last_draw = None
self._pointScale= 1
@@ -636,18 +621,18 @@ class PlotCanvas(wx.Panel):
self._legendEnabled= False
self._titleEnabled= True
self._clientSize = (0, 0)
-
+
# Fonts
self._fontCache = {}
self._fontSizeAxis= 9
self._fontSizeTitle= 15
self._fontSizeLegend= 10
- # Values to print on graph
+ # Values to print on graph
self._posToDrawValues = (0,0)
self._Xvalue = ''
self._Yvalue = ''
-
+
# corners from selection rect
self._selectionCorner1 = None
self._selectionCorner2 = None
@@ -684,10 +669,10 @@ class PlotCanvas(wx.Panel):
def drawSelectionRect(self, c1, c2):
self._selectionCorner1 = c1
self._selectionCorner2 = c2
-
+
def SetCursor(self, cursor):
self.canvas.SetCursor(cursor)
-
+
def GetGridColour(self):
return self._gridColour
@@ -705,13 +690,13 @@ class PlotCanvas(wx.Panel):
def setBackgroundBitmap(self, bit):
self._background_bitmap = bit
-
+
# SaveFile
def SaveFile(self, fileName= ''):
"""Saves the file to the type specified in the extension. If no file
name is specified a dialog box is provided. Returns True if sucessful,
otherwise False.
-
+
.bmp Save a Windows bitmap file.
.xbm Save an X bitmap file.
.xpm Save an XPM bitmap file.
@@ -720,7 +705,7 @@ class PlotCanvas(wx.Panel):
"""
if _string.lower(fileName[-3:]) not in ['bmp','xbm','xpm','png','jpg']:
dlg1 = wx.FileDialog(
- self,
+ self,
"Choose a file with extension bmp, gif, xbm, xpm, png, or jpg", ".", "",
"BMP files (*.bmp)|*.bmp|XBM files (*.xbm)|*.xbm|XPM file (*.xpm)|*.xpm|PNG files (*.png)|*.png|JPG files (*.jpg)|*.jpg",
wx.SAVE|wx.OVERWRITE_PROMPT
@@ -777,7 +762,7 @@ class PlotCanvas(wx.Panel):
self.print_data=wx.PrintData(data.GetPrintData()) # updates print_data
finally:
dlg.Destroy()
-
+
def Printout(self, paper=None):
"""Print current plot."""
if paper != None:
@@ -824,15 +809,15 @@ class PlotCanvas(wx.Panel):
def getLogScale(self):
return self._logscale
-
+
def SetFontSizeAxis(self, point= 10):
"""Set the tick and axis label font size (default is 10 point)"""
self._fontSizeAxis= point
-
+
def GetFontSizeAxis(self):
"""Get current tick and axis label font size in points"""
return self._fontSizeAxis
-
+
def SetFontSizeTitle(self, point= 15):
"""Set Title font size (default is 15 point)"""
self._fontSizeTitle= point
@@ -840,11 +825,11 @@ class PlotCanvas(wx.Panel):
def GetFontSizeTitle(self):
"""Get current Title font size in points"""
return self._fontSizeTitle
-
+
def SetFontSizeLegend(self, point= 7):
"""Set Legend font size (default is 7 point)"""
self._fontSizeLegend= point
-
+
def GetFontSizeLegend(self):
"""Get current Legend font size in points"""
return self._fontSizeLegend
@@ -874,7 +859,7 @@ class PlotCanvas(wx.Panel):
self.SetCursor(self.ArrowCursor)
elif tool == 1:
self.SetCursor(self.PencilCursor)
-
+
def SetEnableDrag(self, value, tool=0):
"""Set True to enable drag."""
if value not in [True,False]:
@@ -887,10 +872,10 @@ class PlotCanvas(wx.Panel):
if tool == 0:
self.SetCursor(self.ArrowCursor)
self._dragEnabled = value
-
+
def GetEnableDrag(self):
return self._dragEnabled
-
+
def SetEnableZoom(self, value, tool=0):
"""Set True to enable zooming."""
if value not in [True,False]:
@@ -923,7 +908,7 @@ class PlotCanvas(wx.Panel):
"""Set True to enable legend."""
if value not in [True,False]:
raise TypeError, "Value should be True or False"
- self._legendEnabled= value
+ self._legendEnabled= value
self.Redraw()
def GetEnableLegend(self):
@@ -934,7 +919,7 @@ class PlotCanvas(wx.Panel):
"""Set True to enable title."""
if value not in [True,False]:
raise TypeError, "Value should be True or False"
- self._titleEnabled= value
+ self._titleEnabled= value
self.Redraw()
def GetEnableTitle(self):
@@ -945,7 +930,7 @@ class PlotCanvas(wx.Panel):
"""Set True to enable pointLabel."""
if value not in [True,False]:
raise TypeError, "Value should be True or False"
- self._pointLabelEnabled= value
+ self._pointLabelEnabled= value
self.Redraw() #will erase existing pointLabel if present
self.last_PointLabel = None
@@ -968,8 +953,8 @@ class PlotCanvas(wx.Panel):
self.last_PointLabel = None #reset pointLabel
if self.last_draw is not None:
self._Draw(self.last_draw[0])
-
- def ScrollRight(self, units):
+
+ def ScrollRight(self, units):
"""Move view right number of axis units."""
self.last_PointLabel = None #reset pointLabel
if self.last_draw is not None:
@@ -993,7 +978,7 @@ class PlotCanvas(wx.Panel):
if self.getLogScale()[1]:
y = _Numeric.power(10,y)
return x,y
-
+
def _getXY(self,event):
"""Takes a mouse event and returns the XY user axis values."""
x,y= self.PositionScreenToUser(event.GetPosition())
@@ -1004,13 +989,13 @@ class PlotCanvas(wx.Panel):
userPos= _Numeric.array(pntXY)
x,y= userPos * self._pointScale + self._pointShift
return x,y
-
+
def PositionScreenToUser(self, pntXY):
"""Converts Screen position to User Coordinates"""
screenPos= _Numeric.array(pntXY)
x,y= (screenPos-self._pointShift)/self._pointScale
return x,y
-
+
def SetXSpec(self, type= 'auto'):
"""xSpec- defines x axis type. Can be 'none', 'min' or 'auto'
where:
@@ -1019,7 +1004,7 @@ class PlotCanvas(wx.Panel):
'auto' - rounds axis range to sensible values
"""
self._xSpec= type
-
+
def SetYSpec(self, type= 'auto'):
"""ySpec- defines x axis type. Can be 'none', 'min' or 'auto'
where:
@@ -1032,11 +1017,11 @@ class PlotCanvas(wx.Panel):
def GetXSpec(self):
"""Returns current XSpec for axis"""
return self._xSpec
-
+
def GetYSpec(self):
"""Returns current YSpec for axis"""
return self._ySpec
-
+
def GetXMaxRange(self):
xAxis = self._getXMaxRange()
if self.getLogScale()[0]:
@@ -1072,7 +1057,7 @@ class PlotCanvas(wx.Panel):
def _getXCurrentRange(self):
"""Returns (minX, maxX) x-axis for currently displayed portion of graph"""
return self.last_draw[1]
-
+
def GetYCurrentRange(self):
yAxis = self._getYCurrentRange()
if self.getLogScale()[1]:
@@ -1085,15 +1070,15 @@ class PlotCanvas(wx.Panel):
def Draw(self, graphics, xAxis = None, yAxis = None, dc = None):
"""Wrapper around _Draw, which handles log axes"""
-
+
graphics.setLogScale(self.getLogScale())
-
+
# check Axis is either tuple or none
if type(xAxis) not in [type(None),tuple]:
raise TypeError, "xAxis should be None or (minX,maxX)"+str(type(xAxis))
if type(yAxis) not in [type(None),tuple]:
raise TypeError, "yAxis should be None or (minY,maxY)"+str(type(xAxis))
-
+
# check case for axis = (a,b) where a==b caused by improper zooms
if xAxis != None:
if xAxis[0] == xAxis[1]:
@@ -1106,14 +1091,14 @@ class PlotCanvas(wx.Panel):
if self.getLogScale()[1]:
yAxis = _Numeric.log10(yAxis)
self._Draw(graphics, xAxis, yAxis, dc)
-
+
def _Draw(self, graphics, xAxis = None, yAxis = None, dc = None):
"""\
Draw objects in graphics with specified x and y axis.
graphics- instance of PlotGraphics with list of PolyXXX objects
xAxis - tuple with (min, max) axis range to view
yAxis - same as xAxis
- dc - drawing context - doesn't have to be specified.
+ dc - drawing context - doesn't have to be specified.
If it's not, the offscreen buffer is used
"""
if self._zoomed:
@@ -1140,13 +1125,13 @@ class PlotCanvas(wx.Panel):
self.last_draw = (graphics, _Numeric.array(xAxis), _Numeric.array(yAxis)) # saves most recient values
if dc == None:
- # sets new dc and clears it
+ # sets new dc and clears it
dc = wx.BufferedDC(wx.ClientDC(self.canvas), self._Buffer)
dc.Clear()
gc = wx.GraphicsContext_Create(dc)
-
+
dc.BeginDrawing()
-
+
# set font size for every thing but title and legend
dc.SetFont(self._getFont(self._fontSizeAxis))
@@ -1215,7 +1200,7 @@ class PlotCanvas(wx.Panel):
shift = -p1 * scale + self.plotbox_origin + textSize_shift * _Numeric.array((1,-1))
self._pointScale = scale # make available for mouse events
self._pointShift = shift
-
+
size = dc.GetSize()
dc.SetPen(wx.Pen(self._backColour, 1))
dc.SetBrush(wx.Brush(self._backColour))
@@ -1228,10 +1213,10 @@ class PlotCanvas(wx.Panel):
dc.DrawBitmap(self._scaled_background_bitmap, ptx, pty)
self._drawAxes(dc, p1, p2, scale, shift, xticks, yticks)
-
+
graphics.scaleAndShift(scale, shift)
graphics.setPrinterScale(self.printerScale) # thicken up lines and markers if printing
-
+
# set clipping area so drawing does not occur outside axis box
ptx,pty,rectWidth,rectHeight= self._point2ClientCoord(p1, p2)
dc.SetClippingRegion(ptx-5,pty-5,rectWidth+10,rectHeight+10)
@@ -1311,13 +1296,13 @@ class PlotCanvas(wx.Panel):
#[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
cn = [curveNum]+ [obj.getLegend()]+ obj.getClosestPoint( pntXY, pointScaled)
return cn
-
+
def GetClosestPoints(self, pntXY, pointScaled= True):
"""Returns list with
[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
list for each curve.
Returns [] if no curves are being plotted.
-
+
x, y in user coords
if pointScaled == True based on screen coords
if pointScaled == False based on user coords
@@ -1341,7 +1326,7 @@ class PlotCanvas(wx.Panel):
[curveNumber, legend, index of closest point, pointXY, scaledXY, distance]
list for only the closest curve.
Returns [] if no curves are being plotted.
-
+
x, y in user coords
if pointScaled == True based on screen coords
if pointScaled == False based on user coords
@@ -1356,7 +1341,7 @@ class PlotCanvas(wx.Panel):
mdist = min(dists) #Min dist
i = dists.index(mdist) #index for min dist
return closestPts[i] #this is the closest point on closest curve
-
+
GetClosetPoint = GetClosestPoint
def UpdatePointLabel(self, mDataDict):
@@ -1369,7 +1354,7 @@ class PlotCanvas(wx.Panel):
you specify.
This function can be called from parent window with onClick,
- onMotion events etc.
+ onMotion events etc.
"""
if self.last_PointLabel != None:
#compare pointXY
@@ -1403,7 +1388,7 @@ class PlotCanvas(wx.Panel):
yAxis -= dist[1]
xAxis -= dist[0]
self._Draw(graphics,xAxis,yAxis)
-
+
def OnMouseLeftDown(self,event):
self._zoomCorner1[0], self._zoomCorner1[1]= self._getXY(event)
self._screenCoordinates = _Numeric.array(event.GetPosition())
@@ -1437,7 +1422,7 @@ class PlotCanvas(wx.Panel):
# before (possibly) removing the scrollbars and trigering
# size events, etc.
wx.FutureCall(200,self.Reset)
-
+
def OnMouseRightDown(self,event):
if self._zoomEnabled:
X,Y = self._getXY(event)
@@ -1457,7 +1442,7 @@ class PlotCanvas(wx.Panel):
size = self.canvas.GetClientSize()
size.width = max(1, size.width)
size.height = max(1, size.height)
-
+
# Make new offscreen bitmap: this bitmap will always have the
# current drawing in it, so it can be used to save the image to
# a file, or whatever.
@@ -1484,21 +1469,24 @@ class PlotCanvas(wx.Panel):
if not self._adjustingSB:
self._sb_ignore = True
sbpos = evt.GetPosition()
-
+
if evt.GetOrientation() == wx.VERTICAL:
fullrange,pagesize = self.sb_vert.GetRange(),self.sb_vert.GetPageSize()
sbpos = fullrange-pagesize-sbpos
dist = sbpos*self._sb_yunit-(self._getYCurrentRange()[0]-self._sb_yfullrange[0])
self.ScrollUp(dist)
-
+
if evt.GetOrientation() == wx.HORIZONTAL:
dist = sbpos*self._sb_xunit-(self._getXCurrentRange()[0]-self._sb_xfullrange[0])
self.ScrollRight(dist)
-
+
# Private Methods **************************************************
def drawCursor(self, time):
pt = time * self._pointScale + self._pointShift
- self.time = pt[0]
+ try:
+ self.time = pt[0]
+ except:
+ pass
self.GetParent().cursorPanel.setTime(self.time)
def _setSize(self, width=None, height=None):
@@ -1506,17 +1494,17 @@ class PlotCanvas(wx.Panel):
if width == None:
(self.width,self.height) = self.canvas.GetClientSize()
else:
- self.width, self.height= width,height
+ self.width, self.height= width,height
self.plotbox_size = 0.97*_Numeric.array([self.width, self.height])
xo = 0.5*(self.width-self.plotbox_size[0])
yo = self.height-0.5*(self.height-self.plotbox_size[1])
self.plotbox_origin = _Numeric.array([xo, yo])
-
+
def _setPrinterScale(self, scale):
"""Used to thicken lines and increase marker size for print out."""
# line thickness on printer is very thin at 600 dot/in. Markers small
self.printerScale= scale
-
+
def _printDraw(self, printDC):
"""Used for printing."""
if self.last_draw != None:
@@ -1583,7 +1571,7 @@ class PlotCanvas(wx.Panel):
xLabelWH= dc.GetTextExtent(xLabel)
yLabelWH= dc.GetTextExtent(yLabel)
return titleWH, xLabelWH, yLabelWH
-
+
def _legendWH(self, dc, graphics):
"""Returns the size in screen units for legend box"""
if self._legendEnabled != True:
@@ -1597,7 +1585,7 @@ class PlotCanvas(wx.Panel):
txtExt= dc.GetTextExtent(txtList[0])
for txt in graphics.getLegendNames()[1:]:
txtExt= _Numeric.maximum(txtExt,dc.GetTextExtent(txt))
- maxW= symExt[0]+txtExt[0]
+ maxW= symExt[0]+txtExt[0]
maxH= max(symExt[1],txtExt[1])
# padding .1 for lhs of legend box and space between lines
maxW= maxW* 1.1
@@ -1641,7 +1629,7 @@ class PlotCanvas(wx.Panel):
pt1= c1*self._pointScale+self._pointShift
ptx,pty= pt1
return ptx, pty
-
+
def _point2ClientCoord(self, corner1, corner2):
"""Converts user point coords to client screen int coords x,y,width,height"""
c1= _Numeric.array(corner1)
@@ -1654,8 +1642,8 @@ class PlotCanvas(wx.Panel):
plr= _Numeric.maximum(pt1,pt2) # Lower right corner
rectWidth, rectHeight= plr-pul
ptx,pty= pul
- return ptx, pty, rectWidth, rectHeight
-
+ return ptx, pty, rectWidth, rectHeight
+
def _axisInterval(self, spec, lower, upper):
"""Returns sensible axis range for given spec"""
if spec == 'none' or spec == 'min':
@@ -1688,10 +1676,10 @@ class PlotCanvas(wx.Panel):
raise ValueError, str(spec) + ': illegal axis specification'
def _drawAxes(self, dc, p1, p2, scale, shift, xticks, yticks):
-
+
penWidth= self.printerScale # increases thickness for printing only
dc.SetPen(wx.Pen(self._gridColour, penWidth))
-
+
# set length of tick marks--long ones make grid
if self._gridEnabled:
x,y,width,height= self._point2ClientCoord(p1,p2)
@@ -1762,13 +1750,13 @@ class PlotCanvas(wx.Panel):
return self._logticks(*args)
else:
return self._ticks(*args)
-
+
def _yticks(self, *args):
if self._logscale[1]:
return self._logticks(*args)
else:
return self._ticks(*args)
-
+
def _logticks(self, lower, upper):
#lower,upper = map(_Numeric.log10,[lower,upper])
#print 'logticks',lower,upper
@@ -1805,7 +1793,7 @@ class PlotCanvas(wx.Panel):
if len(ticks) == 0:
ticks = [(0,'')]
return ticks
-
+
def _ticks(self, lower, upper):
ideal = (upper-lower)/7.
log = _Numeric.log10(ideal)
@@ -1820,7 +1808,7 @@ class PlotCanvas(wx.Panel):
factor = f
grid = factor * 10.**power
if self._useScientificNotation and (power > 4 or power < -4):
- format = '%+7.1e'
+ format = '%+7.1e'
elif power >= 0:
digits = max(1, int(power))
format = '%' + `digits`+'.0f'
@@ -1846,7 +1834,7 @@ class PlotCanvas(wx.Panel):
self._adjustingSB = True
needScrollbars = False
-
+
# horizontal scrollbar
r_current = self._getXCurrentRange()
r_max = list(self._getXMaxRange())
@@ -1854,12 +1842,12 @@ class PlotCanvas(wx.Panel):
r_max[0] = min(r_max[0],r_current[0])
r_max[1] = max(r_max[1],r_current[1])
-
+
self._sb_xfullrange = r_max
unit = (r_max[1]-r_max[0])/float(self.sb_hor.GetRange())
pos = int((r_current[0]-r_max[0])/unit)
-
+
if pos >= 0:
pagesize = int((r_current[1]-r_current[0])/unit)
@@ -1876,12 +1864,12 @@ class PlotCanvas(wx.Panel):
r_max[0] = min(r_max[0],r_current[0])
r_max[1] = max(r_max[1],r_current[1])
-
+
self._sb_yfullrange = r_max
-
+
unit = (r_max[1]-r_max[0])/sbfullrange
pos = int((r_current[0]-r_max[0])/unit)
-
+
if pos >= 0:
pagesize = int((r_current[1]-r_current[0])/unit)
pos = (sbfullrange-1-pos-pagesize)
@@ -1929,14 +1917,14 @@ class PlotPrintout(wx.Printout):
dcSize= dc.GetSize() # DC size
pageSize= self.GetPageSizePixels() # page size in terms of pixcels
clientDcSize= self.graph.GetClientSize()
-
+
# find what the margins are (mm)
margLeftSize,margTopSize= self.graph.pageSetupData.GetMarginTopLeft()
margRightSize, margBottomSize= self.graph.pageSetupData.GetMarginBottomRight()
# calculate offset and scale for dc
pixLeft= margLeftSize*PPIPrinter[0]/25.4 # mm*(dots/in)/(mm/in)
- pixRight= margRightSize*PPIPrinter[0]/25.4
+ pixRight= margRightSize*PPIPrinter[0]/25.4
pixTop= margTopSize*PPIPrinter[1]/25.4
pixBottom= margBottomSize*PPIPrinter[1]/25.4
@@ -1951,10 +1939,10 @@ class PlotPrintout(wx.Printout):
pixTop *= ratioH
plotAreaW *= ratioW
plotAreaH *= ratioH
-
+
# rescale plot to page or preview plot area
self.graph._setSize(plotAreaW,plotAreaH)
-
+
# Set offset and scale
dc.SetDeviceOrigin(pixLeft,pixTop)
@@ -1972,4 +1960,3 @@ class PlotPrintout(wx.Printout):
return True
-
diff --git a/Resources/Control.py b/Resources/Control.py
index 6caa71e..23334b1 100644
--- a/Resources/Control.py
+++ b/Resources/Control.py
@@ -24,10 +24,10 @@ import CeciliaLib
from Widgets import *
from subprocess import Popen
from types import ListType
-from TogglePopup import SamplerPopup, SamplerToggle
+from TogglePopup import SamplerPopup, SamplerToggle
from Plugins import *
import wx.lib.scrolledpanel as scrolled
-
+
class CECControl(scrolled.ScrolledPanel):
if CeciliaLib.getVar("systemPlatform") == "win32":
BORDER = wx.DOUBLE_BORDER
@@ -39,7 +39,7 @@ class CECControl(scrolled.ScrolledPanel):
self.parent = parent
self.outputFilename = ''
- self.cfileinList = []
+ self.cfileinList = []
self.peak = ''
self.time = self.nonZeroTime = 0
self.charNumForLabel = 34
@@ -53,7 +53,7 @@ class CECControl(scrolled.ScrolledPanel):
##### Transport Panel #####
controlPanel = wx.Panel(self, -1, style=wx.NO_BORDER)
controlPanel.SetBackgroundColour(TITLE_BACK_COLOUR)
- controlSizer = wx.FlexGridSizer(1,4)
+ controlSizer = wx.FlexGridSizer(1,4)
self.transportButtons = Transport(controlPanel, outPlayFunction=self.onPlayStop, outRecordFunction=self.onRec,
backgroundColour=TITLE_BACK_COLOUR, borderColour=WIDGET_BORDER_COLOUR)
self.clocker = Clocker(controlPanel, backgroundColour=TITLE_BACK_COLOUR, borderColour=WIDGET_BORDER_COLOUR)
@@ -108,7 +108,7 @@ class CECControl(scrolled.ScrolledPanel):
self.createPluginPanel()
self.sizerMain.Add(self.pluginsPanel, 1, wx.EXPAND | wx.ALL, 0)
self.sizerMain.Show(self.pluginsPanel, False)
-
+
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
controlPanel.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
self.inputPanel.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
@@ -152,9 +152,6 @@ class CECControl(scrolled.ScrolledPanel):
def createGrapherLines(self, plugin):
knobs = [plugin.knob1, plugin.knob2, plugin.knob3]
grapher = CeciliaLib.getVar("grapher")
- choice = grapher.toolbar.getPopupChoice()
- choice.extend([knob.getLongLabel() for knob in knobs])
- grapher.toolbar.setPopupChoice(choice)
for j, knob in enumerate(knobs):
func = '0 %f 1 %f' % (knob.GetValue(), knob.GetValue())
func = [float(v.replace('"', '')) for v in func.split()]
@@ -167,6 +164,9 @@ class CECControl(scrolled.ScrolledPanel):
name = knob.getName()
grapher.plotter.createLine(func, (mini, maxi), colour, label, log, name, 8192, knob, '')
grapher.plotter.getData()[-1].setShow(0)
+ choice = grapher.toolbar.getPopupChoice()
+ choice.extend([knob.getLongLabel() for knob in knobs])
+ grapher.toolbar.setPopupChoice(choice)
grapher.plotter.draw()
def removeGrapherLines(self, plugin):
@@ -192,7 +192,7 @@ class CECControl(scrolled.ScrolledPanel):
if self.plugins[i].pluginName != 'None':
for label in self.plugins[i].getKnobLongLabels():
choice.remove(label)
-
+
tmp = copy.deepcopy(self.pluginsParams[i1])
self.pluginsParams[i1] = copy.deepcopy(self.pluginsParams[i2])
self.pluginsParams[i2] = tmp
@@ -205,7 +205,7 @@ class CECControl(scrolled.ScrolledPanel):
self.plugins[i].checkArrows()
graphData = CeciliaLib.getVar("grapher").getPlotter().getData()
-
+
if self.plugins[i1].pluginName == 'None':
CeciliaLib.setPlugins(None, i1)
else:
@@ -218,7 +218,7 @@ class CECControl(scrolled.ScrolledPanel):
break
CeciliaLib.setPlugins(self.plugins[i1], i1)
choice.extend(self.plugins[i1].getKnobLongLabels())
-
+
if self.plugins[i2].pluginName == 'None':
CeciliaLib.setPlugins(None, i2)
else:
@@ -242,7 +242,7 @@ class CECControl(scrolled.ScrolledPanel):
self.plugins[i1].Refresh()
self.plugins[i2].Refresh()
self.bagSizer.Layout()
-
+
if CeciliaLib.getVar("audioServer").isAudioServerRunning():
CeciliaLib.getVar("audioServer").movePlugin(vpos, dir)
@@ -253,7 +253,7 @@ class CECControl(scrolled.ScrolledPanel):
self.removeGrapherLines(self.plugins[order])
plugin = self.pluginsDict[new](self.pluginsPanel, self.replacePlugin, order)
- if new != 'None':
+ if new != 'None':
CeciliaLib.setPlugins(plugin, order)
self.createGrapherLines(plugin)
ind = PLUGINS_CHOICE.index(plugin.getName())
@@ -261,7 +261,7 @@ class CECControl(scrolled.ScrolledPanel):
else:
CeciliaLib.setPlugins(None, order)
plugin.setParams([0,0,0,0])
-
+
itempos = self.bagSizer.GetItemPosition(self.plugins[order])
item = self.bagSizer.FindItem(self.plugins[order])
if item.IsWindow():
@@ -292,12 +292,12 @@ class CECControl(scrolled.ScrolledPanel):
def createInputPanel(self):
isEmpty = True
self.inputPanel = wx.Panel(self, -1, style=wx.NO_BORDER)
- inputSizer = wx.FlexGridSizer(5,1)
-
+ inputSizer = wx.FlexGridSizer(0,1)
+
self.cfileinList = []
samplersList = []
widgets = CeciliaLib.getVar("interfaceWidgets")
-
+
for w in range(len(widgets)):
if widgets[w]['type'] == 'cfilein':
cFileIn = Cfilein(self.inputPanel, label=widgets[w].get('label', ''), name=widgets[w]['name'])
@@ -323,22 +323,22 @@ class CECControl(scrolled.ScrolledPanel):
inputTextSizer.AddGrowableCol(0)
inputTextPanel.SetSizer(inputTextSizer)
inputSizer.Add(inputTextPanel, 1, wx.EXPAND| wx.ALIGN_RIGHT | wx.ALL, 0)
-
+
for i in range(len(self.cfileinList)):
inputSizer.Add(self.cfileinList[i], 1, wx.EXPAND | wx.LEFT | wx.RIGHT | wx.TOP, -1)
if i != len(self.cfileinList)-1:
inputSizer.Add(Separator(self.inputPanel, size=(230,1)), 1, wx.EXPAND)
-
+
inputSizer.AddGrowableCol(0)
self.inputPanel.SetSizer(inputSizer)
-
+
return isEmpty
def createOutputPanel(self):
self.outputPanel = wx.Panel(self, -1, style=wx.NO_BORDER)
self.outputPanel.SetBackgroundColour(BACKGROUND_COLOUR)
outputSizer = wx.FlexGridSizer(0,1)
-
+
outputTextPanel = wx.Panel(self.outputPanel, -1, style=wx.NO_BORDER)
outputTextPanel.SetBackgroundColour(TITLE_BACK_COLOUR)
outputTextSizer = wx.FlexGridSizer(1,1)
@@ -351,48 +351,48 @@ class CECControl(scrolled.ScrolledPanel):
outputTextPanel.SetSizer(outputTextSizer)
outputSizer.Add(outputTextPanel, 1, wx.EXPAND | wx.ALIGN_RIGHT | wx.ALL, 0)
outputSizer.AddGrowableCol(0)
-
+
outputSizer.AddSpacer((5,7))
-
+
outLine1 = wx.BoxSizer(wx.HORIZONTAL)
-
+
# File Name Label
- self.filenameLabel = OutputLabel(self.outputPanel, label='', size=(130,20),
+ self.filenameLabel = OutputLabel(self.outputPanel, label='', size=(130,20),
colour=CONTROLLABEL_BACK_COLOUR, outFunction=self.onSelectOutputFilename)
self.filenameLabel.SetToolTip(CECTooltip(TT_OUTPUT))
self.filenameLabel.setItalicLabel('File name')
outLine1.Add(self.filenameLabel, 0, wx.LEFT | wx.ALIGN_LEFT | wx.ALIGN_CENTER_VERTICAL, 0)
-
+
outLine1.AddSpacer((28,1))
-
+
outToolbox = ToolBox(self.outputPanel, tools=['play','edit','recycle'],
outFunction=[self.listenSoundfile, self.editSoundfile, self.onReuseOutputFile])
outLine1.Add(outToolbox, 0, wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 2)
-
+
outputSizer.Add(outLine1, 1, wx.EXPAND | wx.LEFT | wx.BOTTOM, 7)
-
+
# Duration Static Text
durationText = wx.StaticText(self.outputPanel, -1, 'Duration (sec) :')
durationText.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, face=FONT_FACE))
durationText.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
outputSizer.Add(durationText, 0, wx.ALIGN_LEFT | wx.LEFT, 9)
-
+
# Duration Slider
outputSizer.AddSpacer((3,1))
self.durationSlider = ControlSlider(self.outputPanel,
0.01, 3600, CeciliaLib.getVar("defaultTotalTime"),
- size=(220,15), log=True,
+ size=(220,15), log=True,
backColour=BACKGROUND_COLOUR, outFunction=self.setTotalTime)
self.durationSlider.setSliderHeight(10)
self.durationSlider.SetToolTip(CECTooltip(TT_DUR_SLIDER))
outputSizer.Add(self.durationSlider, 0, wx.ALIGN_LEFT | wx.LEFT | wx.BOTTOM, 7)
-
+
# Gain Static Text
gainText = wx.StaticText(self.outputPanel, -1, 'Gain (dB) :')
gainText.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, face=FONT_FACE))
gainText.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
outputSizer.Add(gainText, 0, wx.ALIGN_LEFT | wx.LEFT, 9)
-
+
# Gain Slider
outputSizer.AddSpacer((3,1))
self.gainSlider = ControlSlider(self.outputPanel, -48, 18, 0, size=(220,15),
@@ -416,23 +416,23 @@ class CECControl(scrolled.ScrolledPanel):
self.formatText.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, face=FONT_FACE))
self.formatText.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
formatSizer.Add(self.formatText, 0, wx.ALIGN_LEFT | wx.LEFT, 2)
-
+
self.formatChoice = CustomMenu(self.outputPanel,
- choice=[str(x) for x in range(1,37)],
+ choice=[str(x) for x in range(1,37)],
init=str(CeciliaLib.getVar("nchnls")),
outFunction=self.onFormatChange,
colour=CONTROLLABEL_BACK_COLOUR)
self.formatChoice.SetToolTip(CECTooltip(TT_CHANNELS))
formatSizer.Add(self.formatChoice, 0, wx.ALIGN_LEFT | wx.TOP, 1)
self.lineSizer.Add(formatSizer, 0, wx.ALIGN_LEFT | wx.RIGHT, 10)
-
+
# Peak
peakSizer = wx.BoxSizer(wx.VERTICAL)
self.peakText = wx.StaticText(self.outputPanel, -1, 'Peak :')
self.peakText.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_BOLD, face=FONT_FACE))
self.peakText.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
peakSizer.Add(self.peakText, 0, wx.ALIGN_LEFT | wx.LEFT, 2)
-
+
self.peakLabel = PeakLabel(self.outputPanel,
label=self.peak,
size=(100,20),
@@ -453,7 +453,7 @@ class CECControl(scrolled.ScrolledPanel):
def createPluginPanel(self):
self.oldPlugins = [0] * NUM_OF_PLUGINS
- paramsTemplate = [[0,0,0,0], [.25,1,.5,1], [.25,.7,5000,1], [1,1000,1,1], [.5,.2,.5,1], [1000,1,-3,1],
+ paramsTemplate = [[0,0,0,0], [.25,1,.5,1], [.25,.7,5000,1], [1,1000,1,1], [.5,.2,.5,1], [1000,1,-3,1],
[0,0,0,1], [-20,3,0,1], [-70,0.005,.01,1], [.7,.7,-12,1], [8,1,0,1], [100,5,1.1,1],
[.1,0,0.5,1], [0.5,0.25,0.25,1], [-7,0,0.5,1], [80,2.01,0.33,1], [80,0.5,0.33,1],
[0.025,0.5,1,2]]
@@ -499,21 +499,21 @@ class CECControl(scrolled.ScrolledPanel):
def getCfileinList(self):
return self.cfileinList
-
+
def getCfileinFromName(self, name):
good = None
for cfilein in self.cfileinList:
if name == cfilein.getName():
good = cfilein
- break
+ break
return good
-
+
def listenSoundfile(self):
CeciliaLib.listenSoundfile(self.outputFilename)
-
+
def editSoundfile(self):
CeciliaLib.editSoundfile(self.outputFilename)
-
+
def getTime(self):
return self.time
@@ -549,7 +549,7 @@ class CECControl(scrolled.ScrolledPanel):
filename = self.onSelectOutputFilename()
if filename == None:
CeciliaLib.stopCeciliaSound()
- return
+ return
self.outputFilename = filename
CeciliaLib.setVar("outputFile", filename)
self.nonZeroTime = 0
@@ -568,7 +568,7 @@ class CECControl(scrolled.ScrolledPanel):
filename = self.onSelectOutputFilename()
if filename == None:
CeciliaLib.stopCeciliaSound()
- return
+ return
self.outputFilename = filename
CeciliaLib.setVar("outputFile", filename)
CeciliaLib.setVar("toDac", False)
@@ -584,7 +584,7 @@ class CECControl(scrolled.ScrolledPanel):
self.bounce_dlg.SetSizerAndFit(sizer)
self.bounce_dlg.CenterOnParent()
self.bounce_dlg.Show()
-
+
def closeBounceToDiskDialog(self):
try:
self.bounce_dlg.Destroy()
@@ -660,7 +660,7 @@ class CECControl(scrolled.ScrolledPanel):
def resetVuMeter(self):
self.vuMeter.resetMax()
-
+
def getCfileinList(self):
return self.cfileinList
@@ -677,12 +677,12 @@ class CInputBase(wx.Panel):
self.chnls = 0
self.type = ''
self.samprate = 0
- self.bitrate = 0
+ self.bitrate = 0
self.filePath = ''
self.folderInfo = None
self.mode = 0
- mainSizer = wx.FlexGridSizer(4,1)
+ mainSizer = wx.FlexGridSizer(4,1)
mainSizer.AddSpacer((200,4))
# Static label for the popup menu
@@ -699,10 +699,10 @@ class CInputBase(wx.Panel):
self.fileMenu = FolderPopup(self, path=None, init='', outFunction=self.onSelectSound,
emptyFunction=self.onLoadFile, backColour=CONTROLLABEL_BACK_COLOUR, tooltip=TT_SEL_SOUND)
line2.Add(self.fileMenu, 0, wx.ALIGN_CENTER | wx.RIGHT, 6)
-
- self.inputBitmaps = [ICON_INPUT_1_FILE.GetBitmap(),
- ICON_INPUT_2_LIVE.GetBitmap(),
- ICON_INPUT_3_MIC.GetBitmap(),
+
+ self.inputBitmaps = [ICON_INPUT_1_FILE.GetBitmap(),
+ ICON_INPUT_2_LIVE.GetBitmap(),
+ ICON_INPUT_3_MIC.GetBitmap(),
ICON_INPUT_4_MIC_RECIRC.GetBitmap()]
self.modebutton = InputModeButton(self, 0, outFunction=self.onChangeMode)
line2.Add(self.modebutton, 0, wx.ALIGN_CENTER | wx.TOP, 2)
@@ -711,7 +711,7 @@ class CInputBase(wx.Panel):
outFunction=[self.listenSoundfile,self.editSoundfile, self.onShowSampler])
self.toolbox.setOpen(False)
line2.Add(self.toolbox,0,wx.ALIGN_CENTER | wx.TOP | wx.LEFT, 2)
-
+
mainSizer.Add(line2, 1, wx.LEFT, 6)
mainSizer.AddSpacer((5,2))
@@ -746,7 +746,7 @@ class CInputBase(wx.Panel):
def getDuration(self):
return self.duration
-
+
def setTotalTime(self):
if self.duration:
CeciliaLib.getControlPanel().setTotalTime(self.duration)
@@ -757,6 +757,12 @@ class CInputBase(wx.Panel):
self.filePath = ''
CeciliaLib.getVar("userInputs")[self.name]['path'] = self.filePath
+ def reinitSamplerFrame(self):
+ try:
+ self.samplerFrame.reinit()
+ except:
+ pass
+
def getSoundInfos(self, file):
file = CeciliaLib.ensureNFD(file)
self.filePath = CeciliaLib.ensureNFD(self.folderInfo[file]['path'])
@@ -773,7 +779,7 @@ class CInputBase(wx.Panel):
type=self.type,
bitDepth=self.bitrate,
chanNum=self.chnls,
- sampRate=self.samprate)
+ sampRate=self.samprate)
CeciliaLib.getVar("userInputs")[self.name]['sr%s' % self.name] = self.samprate
CeciliaLib.getVar("userInputs")[self.name]['dur%s' % self.name] = self.duration
CeciliaLib.getVar("userInputs")[self.name]['nchnls%s' % self.name] = self.chnls
@@ -781,14 +787,14 @@ class CInputBase(wx.Panel):
CeciliaLib.getVar("userInputs")[self.name]['path'] = self.filePath
def onLoadFile(self, filePath=''):
- if filePath == '':
- path = CeciliaLib.openAudioFileDialog(self, AUDIO_FILE_WILDCARD,
+ if filePath == '':
+ path = CeciliaLib.openAudioFileDialog(self, AUDIO_FILE_WILDCARD,
defaultPath=CeciliaLib.getVar("openAudioFilePath", unicode=True))
elif not os.path.isfile(filePath):
return False
else:
path = filePath
-
+
if path == None:
return False
if not CeciliaLib.getVar("audioServer").validateAudioFile(path):
@@ -820,23 +826,23 @@ class CInputBase(wx.Panel):
elif os.path.isdir(path):
root = path
isfile = False
-
+
pathList = []
for p in os.listdir(root):
pathList.append(os.path.join(root,p))
self.folderInfo = CeciliaLib.getVar("audioServer").getSoundsFromList(pathList)
files = self.folderInfo.keys()
files.sort()
-
+
self.fileMenu.setChoice(files)
if isfile:
self.fileMenu.setLabel(CeciliaLib.ensureNFD(os.path.split(path)[1]))
else:
self.fileMenu.setLabel(CeciliaLib.ensureNFD(files[0]))
-
+
def listenSoundfile(self):
CeciliaLib.listenSoundfile(self.filePath)
-
+
def editSoundfile(self):
CeciliaLib.editSoundfile(self.filePath)
@@ -851,11 +857,11 @@ class CInputBase(wx.Panel):
self.samplerFrame.loopInSlider.setRange(0, newMaxDur)
self.samplerFrame.loopOutSlider.setRange(0, newMaxDur)
except:
- pass
-
+ pass
+
def setOffset(self, value):
CeciliaLib.getVar("userInputs")[self.name]['off%s' % self.name] = value
- self.samplerFrame.offsetSlider.setEnable(True)
+ self.samplerFrame.offsetSlider.Enable()
self.samplerFrame.offsetSlider.SetValue(value)
def getOffset(self):
@@ -868,10 +874,10 @@ class CInputBase(wx.Panel):
return self.samplerFrame
class Cfilein(CInputBase):
- def __init__(self, parent, id=-1, label='', size=(-1,-1), style = wx.NO_BORDER, name=''):
+ def __init__(self, parent, id=-1, label='', size=(-1,-1), style = wx.NO_BORDER, name=''):
CInputBase.__init__(self, parent, id, label=label, size=size, style=style, name=name)
CeciliaLib.getVar("userInputs")[self.name]['type'] = 'cfilein'
-
+
def processMode(self):
if self.mode in [1,3]:
self.mode = (self.mode + 1) % 4
@@ -885,7 +891,7 @@ class Cfilein(CInputBase):
elif self.mode == 2:
self.fileMenu.setEnable(False)
self.samplerFrame.textOffset.SetLabel('Table Length (sec) :')
- self.samplerFrame.offsetSlider.setEnable(True)
+ self.samplerFrame.offsetSlider.Enable()
self.samplerFrame.offsetSlider.SetValue(5)
self.samplerFrame.liveInputHeader(True)
@@ -903,9 +909,9 @@ class CSampler(CInputBase):
self.gainMod = None
self.transMod = None
self.startPos = None
-
+
CeciliaLib.getVar("userInputs")[self.name]['type'] = 'csampler'
-
+
def processMode(self):
grapher = CeciliaLib.getVar('grapher')
if self.mode == 0:
@@ -944,10 +950,10 @@ class CSampler(CInputBase):
for line in CeciliaLib.getVar("grapher").plotter.getData():
if line.getName() == self.samplerFrame.loopInSlider.getCName() or line.getName() == self.samplerFrame.loopOutSlider.getCName():
line.changeYrange((0, self.duration))
-
+
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setSound(self.filePath)
-
+
def getSamplerInfo(self):
info = {}
info['loopMode'] = self.samplerFrame.getLoopMode()
@@ -975,11 +981,11 @@ class CfileinFrame(wx.Frame):
w, h = self.GetSize()
panel.SetBackgroundColour(BACKGROUND_COLOUR)
box = wx.BoxSizer(wx.VERTICAL)
-
+
# Header
self.title = FrameLabel(panel, '', size=(w-2, 50))
box.Add(self.title, 0, wx.ALL, 1)
-
+
box.AddSpacer((200,2))
#toolbox
@@ -988,7 +994,7 @@ class CfileinFrame(wx.Frame):
outFunction=[self.parent.listenSoundfile,
self.parent.editSoundfile,
self.parent.setTotalTime])
- toolsBox.Add(tools, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 320)
+ toolsBox.Add(tools, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 320)
box.Add(toolsBox, 0, wx.TOP, 5)
# Static label for the offset slider
@@ -998,15 +1004,15 @@ class CfileinFrame(wx.Frame):
textLabel2.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
textLabel2.SetBackgroundColour(BACKGROUND_COLOUR)
line3.Add(textLabel2,0,wx.ALL, 0)
-
+
self.textOffset = wx.StaticText(self, -1, ' Offset :')
self.textOffset.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
self.textOffset.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
self.textOffset.SetBackgroundColour(BACKGROUND_COLOUR)
line3.Add(self.textOffset,0,wx.ALL, 0)
-
+
box.Add(line3, 0, wx.LEFT, 20)
-
+
# Offset slider
self.offsetSlider = ControlSlider(self, minvalue=0, maxvalue=100, size=(222,15), init=0,
outFunction=self.parent.onOffsetSlider, backColour=BACKGROUND_COLOUR)
@@ -1040,6 +1046,9 @@ class CfileinFrame(wx.Frame):
self.Hide()
self.GetParent().toolbox.setOpen(False)
+ def reinit(self):
+ self.offsetSlider.setValue(0)
+
def update(self, path, dur, type, bitDepth, chanNum, sampRate):
self.path = path
self.dur = dur
@@ -1049,7 +1058,7 @@ class CfileinFrame(wx.Frame):
self.sampRate = sampRate
soundInfoText = self.createHeader()
self.title.setLabel(soundInfoText)
-
+
def createHeader(self):
if self.sampRate > 1000:
self.sampRate = self.sampRate / 1000.
@@ -1067,18 +1076,20 @@ class SamplerFrame(wx.Frame):
def __init__(self, parent, name, pos=wx.DefaultPosition, size=(390, 295)):
style = ( wx.CLIP_CHILDREN | wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.NO_BORDER | wx.FRAME_FLOAT_ON_PARENT)
wx.Frame.__init__(self, parent, title='', pos=pos, style=style)
+ self.SetBackgroundColour(BACKGROUND_COLOUR)
self.parent = parent
self.SetClientSize(size)
self.size = size
self.name = name
+ self.dur = 0
self.loopList = ['Off', 'Forward', 'Backward', 'Back and Forth']
-
+
panel = wx.Panel(self, -1)
w, h = size
panel.SetBackgroundColour(BACKGROUND_COLOUR)
box = wx.BoxSizer(wx.VERTICAL)
-
+
# Header
self.title = FrameLabel(panel, '', size=(w-2, 50))
box.Add(self.title, 0, wx.ALL, 1)
@@ -1090,29 +1101,29 @@ class SamplerFrame(wx.Frame):
textLabel2.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
textLabel2.SetBackgroundColour(BACKGROUND_COLOUR)
line3.Add(textLabel2,0,wx.ALL, 0)
-
+
self.textOffset = wx.StaticText(panel, -1, ' Offset :')
self.textOffset.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
self.textOffset.SetForegroundColour(TEXT_LABELFORWIDGET_COLOUR)
self.textOffset.SetBackgroundColour(BACKGROUND_COLOUR)
line3.Add(self.textOffset,0,wx.ALL, 0)
-
+
box.Add(line3, 0, wx.LEFT, 20)
-
+
box.AddSpacer((200,2))
-
+
# Offset slider
offBox = wx.BoxSizer(wx.HORIZONTAL)
self.offsetSlider = ControlSlider(panel, minvalue=0, maxvalue=100, size=(345,15), init=0,
outFunction=self.parent.onOffsetSlider, backColour=BACKGROUND_COLOUR)
- self.offsetSlider.SetToolTip(CECTooltip(TT_SAMPLER_OFFSET))
+ self.offsetSlider.SetToolTip(CECTooltip(TT_SAMPLER_OFFSET))
self.offsetSlider.setSliderHeight(10)
self.offsetSlider.Disable()
offBox.Add(self.offsetSlider, 1, wx.EXPAND | wx.LEFT | wx.RIGHT, 20)
box.Add(offBox)
box.AddSpacer((200,10))
-
+
#Loop type + toolbox
loopBox = wx.FlexGridSizer(1,8,5,5)
loopLabel = wx.StaticText(panel, -1, "Loop")
@@ -1121,7 +1132,7 @@ class SamplerFrame(wx.Frame):
loopBox.Add(loopLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 3)
self.loopMenu = SamplerPopup(panel, self.loopList, self.loopList[1], self.name, outFunction=self.handleLoopMode)
self.loopMenu.popup.setBackColour(GREY_COLOUR)
- self.loopMenu.popup.SetToolTip(CECTooltip(TT_SAMPLER_LOOP))
+ self.loopMenu.popup.SetToolTip(CECTooltip(TT_SAMPLER_LOOP))
loopBox.Add(self.loopMenu.popup, 0, wx.ALIGN_CENTER_VERTICAL)
startLabel = wx.StaticText(panel, -1, "Start from loop")
@@ -1129,7 +1140,7 @@ class SamplerFrame(wx.Frame):
startLabel.SetForegroundColour("#FFFFFF")
loopBox.Add(startLabel, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
self.startToggle = SamplerToggle(panel, 0, self.name)
- self.startToggle.toggle.SetToolTip(CECTooltip(TT_SAMPLER_START))
+ self.startToggle.toggle.SetToolTip(CECTooltip(TT_SAMPLER_START))
loopBox.Add(self.startToggle.toggle, 0, wx.ALIGN_CENTER_VERTICAL)
xfadeLabel = wx.StaticText(panel, -1, "Xfade")
xfadeLabel.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
@@ -1143,43 +1154,43 @@ class SamplerFrame(wx.Frame):
self.parent.setTotalTime])
loopBox.Add(tools, 0, wx.ALIGN_CENTER_VERTICAL | wx.LEFT, 5)
loopBox.AddGrowableCol(2)
-
+
box.Add(loopBox, 0, wx.ALL, 10)
-
+
# Sliders
slidersBox = wx.FlexGridSizer(5, 4, 5, 5)
self.loopInSlider = SamplerSlider(panel, self.name, "Loop In", "sec", 0, 1, 0, outFunction=self.handleLoopIn)
- self.loopInSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_LOOP_IN))
+ self.loopInSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_LOOP_IN))
slidersBox.AddMany([(self.loopInSlider.labelText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
(self.loopInSlider.buttons, 0, wx.CENTER),
(self.loopInSlider.slider, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
(self.loopInSlider.unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)])
-
+
self.loopOutSlider = SamplerSlider(panel, self.name, "Loop Time", "sec", 0, 1, 1, outFunction=self.handleLoopOut)
- self.loopOutSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_LOOP_DUR))
+ self.loopOutSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_LOOP_DUR))
slidersBox.AddMany([(self.loopOutSlider.labelText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
(self.loopOutSlider.buttons, 0, wx.CENTER),
(self.loopOutSlider.slider, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
(self.loopOutSlider.unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)])
self.loopXSlider = SamplerSlider(panel, self.name, "Loop X", "%", 0, 50, 1, outFunction=self.handleLoopX)
- self.loopXSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_CROSSFADE))
+ self.loopXSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_CROSSFADE))
slidersBox.AddMany([(self.loopXSlider.labelText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
(self.loopXSlider.buttons, 0, wx.CENTER),
(self.loopXSlider.slider, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
(self.loopXSlider.unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)])
self.gainSlider = SamplerSlider(panel, self.name, "Gain", "dB", -48, 18, 0, outFunction=self.handleGain)
- self.gainSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_GAIN))
+ self.gainSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_GAIN))
slidersBox.AddMany([(self.gainSlider.labelText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
(self.gainSlider.buttons, 0, wx.CENTER),
(self.gainSlider.slider, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
(self.gainSlider.unit, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_LEFT)])
self.transpSlider = SamplerSlider(panel, self.name, "Transpo", "cents", -48, 48, 0, integer=False, outFunction=self.handleTransp)
- self.transpSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_TRANSPO))
+ self.transpSlider.slider.SetToolTip(CECTooltip(TT_SAMPLER_TRANSPO))
slidersBox.AddMany([(self.transpSlider.labelText, 0, wx.ALIGN_CENTER_VERTICAL | wx.ALIGN_RIGHT),
(self.transpSlider.buttons, 0, wx.CENTER),
(self.transpSlider.slider, 0, wx.ALIGN_CENTER_VERTICAL | wx.RIGHT, 5),
@@ -1194,14 +1205,14 @@ class SamplerFrame(wx.Frame):
self.sliderlist = [self.loopInSlider, self.loopOutSlider, self.loopXSlider, self.gainSlider, self.transpSlider]
- samplerSliders = CeciliaLib.getVar("samplerSliders")
+ samplerSliders = CeciliaLib.getVar("samplerSliders")
CeciliaLib.setVar("samplerSliders", samplerSliders + self.sliderlist)
userSliders = CeciliaLib.getVar("userSliders")
- CeciliaLib.setVar("userSliders", userSliders + self.sliderlist)
+ CeciliaLib.setVar("userSliders", userSliders + self.sliderlist)
samplerTogPop = CeciliaLib.getVar("samplerTogglePopup")
CeciliaLib.setVar("samplerTogglePopup", samplerTogPop + [self.loopMenu, self.startToggle])
-
+
panel.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
self.title.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
@@ -1221,6 +1232,25 @@ class SamplerFrame(wx.Frame):
self.Hide()
self.GetParent().toolbox.setOpen(False)
+ def reinit(self):
+ for slider in self.sliderlist:
+ slider.setMidiCtl(None)
+ slider.setMidiChannel(1)
+ slider.setOpenSndCtrl(None)
+ slider.setOSCOut(None)
+ slider.setPlay(False)
+ slider.setRec(False)
+ self.offsetSlider.SetValue(0)
+ self.loopInSlider.setValue(0)
+ self.loopOutSlider.setValue(self.dur)
+ self.loopXSlider.setValue(1)
+ self.gainSlider.setValue(0)
+ self.transpSlider.setValue(0)
+ self.setXfadeShape(0)
+ self.setLoopMode(1)
+ self.setStartFromLoop(0)
+ self.setLoopX([1,0])
+
def update(self, path, dur, type, bitDepth, chanNum, sampRate):
self.path = path
self.dur = dur
@@ -1234,7 +1264,7 @@ class SamplerFrame(wx.Frame):
self.loopInSlider.setValue(0)
self.loopOutSlider.setRange(0, self.dur)
self.loopOutSlider.setValue(self.dur)
-
+
def createHeader(self):
if self.sampRate > 1000:
self.sampRate = self.sampRate / 1000.
@@ -1260,33 +1290,33 @@ class SamplerFrame(wx.Frame):
def getXfadeShape(self):
return self.xfadeSwitcher.getValue()
-
+
def handleLoopMode(self, value):
"""
- Removed real-time loop mode switching until the bug with Looper object is resolved.
+ Removed real-time loop mode switching until the bug with Looper object is resolved.
Something to do with reset of the pointer when start and dur are not 0 and max.
-belangeo
"""
pass
#if CeciliaLib.getVar("currentModule") != None:
# CeciliaLib.getVar("currentModule")._samplers[self.name].setLoopMode(value)
-
+
def setLoopMode(self, index):
self.loopMenu.popup.setByIndex(index)
-
+
def getLoopMode(self):
return self.loopMenu.getValue()
def setStartFromLoop(self, value):
self.startToggle.setValue(value)
-
+
def getStartFromLoop(self):
return self.startToggle.getValue()
def handleLoopX(self, value):
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setXfade(value)
-
+
def setLoopX(self, values):
self.loopXSlider.setValue(values[0])
self.loopXSlider.setPlay(values[1])
@@ -1306,7 +1336,7 @@ class SamplerFrame(wx.Frame):
self.loopXSlider.setMidiChannel(1)
self.loopXSlider.setOpenSndCtrl(None)
self.loopXSlider.setOSCOut(None)
-
+
def getLoopX(self):
return [self.loopXSlider.getValue(), self.loopXSlider.getPlay(), self.loopXSlider.getRec(),
self.loopXSlider.getWithMidi(), self.loopXSlider.getMidiCtl(), self.loopXSlider.getMidiChannel(),
@@ -1315,7 +1345,7 @@ class SamplerFrame(wx.Frame):
def handleLoopIn(self, value):
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setStart(value)
-
+
def setLoopIn(self, values):
self.loopInSlider.setValue(values[0])
self.loopInSlider.setPlay(values[1])
@@ -1338,7 +1368,7 @@ class SamplerFrame(wx.Frame):
self.loopInSlider.setOSCOut(None)
def getLoopIn(self):
- return [self.loopInSlider.getValue(), self.loopInSlider.getPlay(), self.loopInSlider.getRec(),
+ return [self.loopInSlider.getValue(), self.loopInSlider.getPlay(), self.loopInSlider.getRec(),
self.loopInSlider.getWithMidi(), self.loopInSlider.getMidiCtl(), self.loopInSlider.getMidiChannel(),
self.loopInSlider.slider.getMinValue(), self.loopInSlider.slider.getMaxValue(),
self.loopInSlider.getOpenSndCtrl(), self.loopInSlider.getOSCOut()]
@@ -1346,7 +1376,7 @@ class SamplerFrame(wx.Frame):
def handleLoopOut(self, value):
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setDur(value)
-
+
def setLoopOut(self, values):
self.loopOutSlider.setValue(values[0])
self.loopOutSlider.setPlay(values[1])
@@ -1367,7 +1397,7 @@ class SamplerFrame(wx.Frame):
self.loopOutSlider.setMidiChannel(1)
self.loopOutSlider.setOpenSndCtrl(None)
self.loopOutSlider.setOSCOut(None)
-
+
def getLoopOut(self):
return [self.loopOutSlider.getValue(), self.loopOutSlider.getPlay(), self.loopOutSlider.getRec(),
self.loopOutSlider.getWithMidi(), self.loopOutSlider.getMidiCtl(), self.loopOutSlider.getMidiChannel(),
@@ -1377,7 +1407,7 @@ class SamplerFrame(wx.Frame):
def handleGain(self, value):
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setGain(value)
-
+
def setGain(self, values):
self.gainSlider.setValue(values[0])
self.gainSlider.setPlay(values[1])
@@ -1397,12 +1427,12 @@ class SamplerFrame(wx.Frame):
self.gainSlider.setMidiChannel(1)
self.gainSlider.setOpenSndCtrl(None)
self.gainSlider.setOSCOut(None)
-
+
def getGain(self):
return [self.gainSlider.getValue(), self.gainSlider.getPlay(), self.gainSlider.getRec(),
self.gainSlider.getWithMidi(), self.gainSlider.getMidiCtl(), self.gainSlider.getMidiChannel(),
self.gainSlider.getOpenSndCtrl(), self.gainSlider.getOSCOut()]
-
+
def handleTransp(self, value):
if CeciliaLib.getVar("currentModule") != None:
CeciliaLib.getVar("currentModule")._samplers[self.name].setPitch(value)
@@ -1426,17 +1456,17 @@ class SamplerFrame(wx.Frame):
self.transpSlider.setMidiChannel(1)
self.transpSlider.setOpenSndCtrl(None)
self.transpSlider.setOSCOut(None)
-
+
def getTransp(self):
return [self.transpSlider.getValue(), self.transpSlider.getPlay(), self.transpSlider.getRec(),
self.transpSlider.getWithMidi(), self.transpSlider.getMidiCtl(), self.transpSlider.getMidiChannel(),
self.transpSlider.getOpenSndCtrl(), self.transpSlider.getOSCOut()]
-
+
class SamplerPlayRecButtons(wx.Panel):
def __init__(self, parent, id=wx.ID_ANY, pos=(0,0), size=(40,20)):
wx.Panel.__init__(self, parent=parent, id=wx.ID_ANY, pos=pos, size=size)
self.SetMaxSize(self.GetSize())
- self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
+ self.SetBackgroundStyle(wx.BG_STYLE_CUSTOM)
self.SetBackgroundColour(BACKGROUND_COLOUR)
self.Bind(wx.EVT_PAINT, self.OnPaint)
self.Bind(wx.EVT_MOTION, self.OnMotion)
@@ -1472,10 +1502,10 @@ class SamplerPlayRecButtons(wx.Panel):
self.recOverWait = True
def setPlay(self, x):
- if x == 0:
+ if x == 0:
self.play = False
self.playColour = SLIDER_PLAY_COLOUR_HOT
- elif x == 1:
+ elif x == 1:
if self.rec:
self.setRec(0)
self.play = True
@@ -1491,19 +1521,19 @@ class SamplerPlayRecButtons(wx.Panel):
self.setPlay(0)
self.rec = True
self.recColour = SLIDER_REC_COLOUR_PRESSED
-
+
def MouseDown(self, evt):
pos = evt.GetPosition()
if wx.Rect(2, 2, 17, 17).Contains(pos):
- if self.play:
+ if self.play:
self.setPlay(0)
else:
self.setPlay(1)
self.setOverWait(0)
elif wx.Rect(21, 2, 38, 17).Contains(pos):
- if self.rec:
+ if self.rec:
self.setRec(0)
- else:
+ else:
self.setRec(1)
self.setOverWait(1)
self.playOver = False
@@ -1516,14 +1546,14 @@ class SamplerPlayRecButtons(wx.Panel):
self.enterWithButtonDown = True
pos = evt.GetPosition()
if wx.Rect(0, 0, 20, 20).Contains(pos):
- if self.play:
+ if self.play:
self.setPlay(0)
else:
self.setPlay(1)
elif wx.Rect(20, 0, 40, 20).Contains(pos):
- if self.rec:
+ if self.rec:
self.setRec(False)
- else:
+ else:
self.setRec(True)
self.playOver = False
self.recOver = False
@@ -1569,18 +1599,18 @@ class SamplerPlayRecButtons(wx.Panel):
# Draw triangle
if self.playOver: playColour = SLIDER_PLAY_COLOUR_OVER
else: playColour = self.playColour
- gc.SetPen(wx.Pen(playColour, width=1, style=wx.SOLID))
+ gc.SetPen(wx.Pen(playColour, width=1, style=wx.SOLID))
gc.SetBrush(wx.Brush(playColour, wx.SOLID))
tri = [(14,h/2), (9,6), (9,h-6), (14,h/2)]
gc.DrawLines(tri)
- dc.SetPen(wx.Pen('#333333', width=1, style=wx.SOLID))
+ dc.SetPen(wx.Pen('#333333', width=1, style=wx.SOLID))
dc.DrawLine(w/2,4,w/2,h-4)
-
+
# Draw circle
if self.recOver: recColour = SLIDER_REC_COLOUR_OVER
else: recColour = self.recColour
- gc.SetPen(wx.Pen(recColour, width=1, style=wx.SOLID))
+ gc.SetPen(wx.Pen(recColour, width=1, style=wx.SOLID))
gc.SetBrush(wx.Brush(recColour, wx.SOLID))
gc.DrawEllipse(w/4+w/2-4, h/2-4, 8, 8)
@@ -1592,6 +1622,119 @@ class SamplerPlayRecButtons(wx.Panel):
def getRec(self):
return self.rec
+class SamplerControlSlider(ControlSlider):
+ def __init__(self, parent, minvalue, maxvalue, init=None, pos=(0,0), size=(200,16), log=False,
+ outFunction=None, integer=False, powoftwo=False, backColour=None, orient=wx.HORIZONTAL):
+ ControlSlider.__init__(self, parent, minvalue, maxvalue, init, pos, size, log,
+ outFunction, integer, powoftwo, backColour, orient)
+ self.midiLearn = False
+ self.midictl = ""
+ self.openSndCtrl = ""
+
+ def setMidiCtl(self, str):
+ self.midictl = str
+ self.midiLearn = False
+ wx.CallAfter(self.Refresh)
+
+ def inMidiLearnMode(self):
+ self.midiLearn = True
+ wx.CallAfter(self.Refresh)
+
+ def setOpenSndCtrl(self, str):
+ self.openSndCtrl = str
+ wx.CallAfter(self.Refresh)
+
+ def OnPaint(self, evt):
+ w,h = self.GetSize()
+ dc = self.dcref(self)
+ gc = wx.GraphicsContext_Create(dc)
+
+ dc.SetBrush(wx.Brush(self.backgroundColour, wx.SOLID))
+ dc.Clear()
+
+ # Draw background
+ dc.SetPen(wx.Pen(self.backgroundColour, width=self.borderWidth, style=wx.SOLID))
+ dc.DrawRectangle(0, 0, w, h)
+
+ # Draw inner part
+ if self._enable: sliderColour = "#99A7CC"
+ else: sliderColour = "#BBBBBB"
+ if self.orient == wx.VERTICAL:
+ w2 = (w - self.sliderWidth) / 2
+ rec = wx.Rect(w2, 0, self.sliderWidth, h)
+ brush = gc.CreateLinearGradientBrush(w2, 0, w2+self.sliderWidth, 0, "#646986", sliderColour)
+ else:
+ h2 = self.sliderHeight / 4
+ rec = wx.Rect(0, h2, w, self.sliderHeight)
+ brush = gc.CreateLinearGradientBrush(0, h2, 0, h2+self.sliderHeight, "#646986", sliderColour)
+ gc.SetBrush(brush)
+ gc.DrawRoundedRectangle(rec[0], rec[1], rec[2], rec[3], 2)
+
+ dc.SetTextForeground('#FFFFFF')
+ if sys.platform in ['win32', 'linux2']:
+ dc.SetFont(wx.Font(6, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_LIGHT, face=FONT_FACE))
+ else:
+ dc.SetFont(wx.Font(9, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_ITALIC, wx.FONTWEIGHT_LIGHT, face=FONT_FACE))
+ if self.midiLearn:
+ dc.DrawLabel("Move a MIDI controller...", wx.Rect(5, 0, 50, h), wx.ALIGN_CENTER_VERTICAL)
+ elif self.openSndCtrl:
+ dc.DrawLabel(self.openSndCtrl, wx.Rect(5, 0, w, h), wx.ALIGN_CENTER_VERTICAL)
+ else:
+ dc.DrawLabel(self.midictl, wx.Rect(5, 0, w, h), wx.ALIGN_CENTER_VERTICAL)
+
+ # Draw knob
+ if self._enable: knobColour = '#888888'
+ else: knobColour = "#DDDDDD"
+ if self.orient == wx.VERTICAL:
+ rec = wx.Rect(0, self.pos-self.knobHalfSize, w, self.knobSize-1)
+ if self.selected:
+ brush = wx.Brush('#333333', wx.SOLID)
+ else:
+ brush = gc.CreateLinearGradientBrush(0, 0, w, 0, "#323854", knobColour)
+ gc.SetBrush(brush)
+ gc.DrawRoundedRectangle(rec[0], rec[1], rec[2], rec[3], 3)
+ else:
+ rec = wx.Rect(self.pos-self.knobHalfSize, 0, self.knobSize-1, h)
+ if self.selected:
+ brush = wx.Brush('#333333', wx.SOLID)
+ else:
+ brush = gc.CreateLinearGradientBrush(self.pos-self.knobHalfSize, 0, self.pos+self.knobHalfSize, 0, "#323854", knobColour)
+ gc.SetBrush(brush)
+ gc.DrawRoundedRectangle(rec[0], rec[1], rec[2], rec[3], 3)
+
+ if sys.platform in ['win32', 'linux2']:
+ dc.SetFont(wx.Font(7, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
+ else:
+ dc.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
+
+ # Draw text
+ if self.selected and self.new:
+ val = self.new
+ else:
+ if self.integer:
+ val = '%d' % self.GetValue()
+ elif abs(self.GetValue()) >= 1000:
+ val = '%.1f' % self.GetValue()
+ elif abs(self.GetValue()) >= 100:
+ val = '%.2f' % self.GetValue()
+ elif abs(self.GetValue()) >= 10:
+ val = '%.3f' % self.GetValue()
+ elif abs(self.GetValue()) < 10:
+ val = '%.4f' % self.GetValue()
+ if sys.platform == 'linux2':
+ width = len(val) * (dc.GetCharWidth() - 3)
+ else:
+ width = len(val) * dc.GetCharWidth()
+ dc.SetTextForeground('#FFFFFF')
+ dc.DrawLabel(val, rec, wx.ALIGN_CENTER)
+
+ # Send value
+ if self.outFunction and self.propagate:
+ self.outFunction(self.GetValue())
+ self.propagate = True
+
+ evt.Skip()
+
class SamplerSlider:
def __init__(self, parent, name, label, unit, mini, maxi, init, integer=False, outFunction=None):
self.widget_type = "slider"
@@ -1600,7 +1743,7 @@ class SamplerSlider:
self.automationData = []
self.outFunction = outFunction
self.label = name + ' ' + label
- self.cname = {'Loop In': name+'start', 'Loop Time': name+'end',
+ self.cname = {'Loop In': name+'start', 'Loop Time': name+'end',
'Loop X': name+'xfade', 'Gain': name+'gain', 'Transpo': name+'trans'}[label]
self.path = os.path.join(AUTOMATION_SAVE_PATH, self.cname)
self.convertSliderValue = 200
@@ -1615,9 +1758,9 @@ class SamplerSlider:
self.labelText.Bind(wx.EVT_RIGHT_DOWN, self.onMidiLearn)
self.labelText.Bind(wx.EVT_LEFT_DCLICK, self.onLabelDClick)
self.buttons = SamplerPlayRecButtons(parent)
- self.slider = ControlSlider(parent, mini, maxi, init, size=(236, 15), integer=integer,
- backColour=BACKGROUND_COLOUR, outFunction=self.sendValue)
- self.slider.setSliderHeight(10)
+ self.slider = SamplerControlSlider(parent, mini, maxi, init, size=(236, 15), integer=integer,
+ backColour=BACKGROUND_COLOUR, outFunction=self.sendValue)
+ self.slider.setSliderHeight(10)
self.unit = wx.StaticText(parent, -1, unit)
self.unit.SetFont(wx.Font(TEXT_LABELFORWIDGET_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE))
self.unit.SetForegroundColour("#FFFFFF")
@@ -1649,10 +1792,10 @@ class SamplerSlider:
self.slider.SetRange(minval, maxval)
self.setValue(self.getValue())
wx.CallAfter(self.slider.Refresh)
-
+
def setValue(self, val):
self.slider.SetValue(val)
-
+
def getValue(self):
return self.slider.GetValue()
@@ -1710,7 +1853,7 @@ class SamplerSlider:
if log:
torec = math.log10(val/minval) / math.log10(maxOnMin)
else:
- torec = (val - minval) / maxMinusMin
+ torec = (val - minval) / maxMinusMin
temp.append([pos, torec])
oldval = val
oldpos = i
@@ -1732,7 +1875,7 @@ class SamplerSlider:
self.midictl = None
self.midichan = 1
self.slider.setMidiCtl('')
- else:
+ else:
self.midictl = int(ctl)
self.slider.setMidiCtl("%d:%d" % (self.midictl, self.midichan))
self.openSndCtrl = None
@@ -1746,7 +1889,7 @@ class SamplerSlider:
def getMidiChannel(self):
return self.midichan
-
+
def getWithMidi(self):
if self.getMidiCtl() != None and CeciliaLib.getVar("useMidi"):
return True
@@ -1769,28 +1912,26 @@ class SamplerSlider:
self.setOSCOut(value)
def setOpenSndCtrl(self, value):
- if value != None:
- if value == "":
- self.openSndCtrl = None
- self.slider.setOpenSndCtrl("")
- else:
- sep = value.split(":")
- port = int(sep[0].strip())
- address = str(sep[1].strip())
- self.openSndCtrl = (port, address)
- self.slider.setOpenSndCtrl("%d:%s" % (port, address))
- self.setMidiCtl(None)
+ if value == None or value == "":
+ self.openSndCtrl = None
+ self.slider.setOpenSndCtrl("")
+ else:
+ sep = value.split(":")
+ port = int(sep[0].strip())
+ address = str(sep[1].strip())
+ self.openSndCtrl = (port, address)
+ self.slider.setOpenSndCtrl("%d:%s" % (port, address))
+ self.setMidiCtl(None)
def setOSCOut(self, value):
- if value != None:
- if value == "":
- self.OSCOut = None
- else:
- sep = value.split(":")
- host = str(sep[0].strip())
- port = int(sep[1].strip())
- address = str(sep[2].strip())
- self.OSCOut = (host, port, address)
+ if value == None or value == "":
+ self.OSCOut = None
+ else:
+ sep = value.split(":")
+ host = str(sep[0].strip())
+ port = int(sep[1].strip())
+ address = str(sep[2].strip())
+ self.OSCOut = (host, port, address)
def getOpenSndCtrl(self):
return self.openSndCtrl
@@ -1802,4 +1943,4 @@ class SamplerSlider:
if self.openSndCtrl != None:
return True
else:
- return False
+ return False
\ No newline at end of file
diff --git a/Resources/Grapher.py b/Resources/Grapher.py
index 29f9e23..6176b77 100755
--- a/Resources/Grapher.py
+++ b/Resources/Grapher.py
@@ -72,7 +72,7 @@ class Line:
self.suffix = suffix
self.colour = colour[0]
self.midColour = colour[1]
- self.knobColour = colour[2]
+ self.knobColour = colour[2]
self.sliderColour = colour[3]
# curved variables
self.curved = curved
@@ -81,9 +81,12 @@ class Line:
self.initData = self.getLineState()
self.modified = True
+ def reinit(self):
+ self.setLineState(self.initData)
+
def getModified(self):
return self.modified
-
+
def setModified(self, state):
self.modified = state
@@ -110,16 +113,16 @@ class Line:
def getColour(self):
return self.colour
-
+
def getMidColour(self):
return self.midColour
def getSuffix(self):
return self.suffix
-
+
def getData(self):
return self.data
-
+
def setData(self, list):
self.data = list
self.checkIfCurved()
@@ -249,7 +252,7 @@ class Line:
if self.getCurved():
self.curved = False
self.setCurvedLine()
-
+
class Grapher(plot.PlotCanvas):
def __init__(self, parent, style=wx.EXPAND):
plot.PlotCanvas.__init__(self, parent, style=wx.EXPAND | wx.WANTS_CHARS)
@@ -304,7 +307,7 @@ class Grapher(plot.PlotCanvas):
if win not in [CeciliaLib.getVar("mainFrame"), CeciliaLib.getVar("interface"), CeciliaLib.getVar("spectrumFrame")]:
win.Raise()
event.Skip()
-
+
def OnGrabFocus(self, event):
self.SetFocus()
@@ -344,13 +347,13 @@ class Grapher(plot.PlotCanvas):
def resetSelectedPoints(self):
self.selectedPoints = []
self.draw()
-
+
def getSelected(self):
return self.selected
def sendSelected(self):
self.parent.setSelected(self.selected)
-
+
def getLine(self, which):
return self.data[which]
@@ -369,7 +372,7 @@ class Grapher(plot.PlotCanvas):
break
self.draw()
- def createLine(self, data, yrange, colour, label='', log=False, name='', size=8192, slider=None, suffix='', curved=False):
+ def createLine(self, data, yrange, colour, label='', log=False, name='', size=8192, slider=None, suffix='', curved=False):
if data[0][0] != 0: data[0][0] = 0
if data[-1][0] != self.totaltime: data[-1][0] = self.totaltime
self.data.append(Line(data, yrange, colour, label, log, name, size, slider, suffix, curved))
@@ -442,7 +445,7 @@ class Grapher(plot.PlotCanvas):
for i, l in enumerate(self.data):
l.setLineState(self._history[self._historyPoint][i])
self.draw()
-
+
if len(self._history) > 0 :
if self._historyPoint >= (len(self._history) - 1):
self.menubarUndo.Enable(False)
@@ -455,7 +458,7 @@ class Grapher(plot.PlotCanvas):
else:
self.menubarUndo.Enable(False)
self.menubarRedo.Enable(False)
-
+
def rescaleLinLin(self, data, yrange, currentYrange):
scale = yrange[1] - yrange[0]
currentScale = currentYrange[1] - currentYrange[0]
@@ -477,7 +480,7 @@ class Grapher(plot.PlotCanvas):
def rescaleLinLog(self, data, yrange, currentYrange):
list = []
if yrange[0] == 0: yoffrange = .00001
- else: yoffrange = yrange[0]
+ else: yoffrange = yrange[0]
totalRange = yrange[1] - yoffrange
currentTotalRange = math.log10(currentYrange[1]/currentYrange[0])
currentMin = math.log10(currentYrange[0])
@@ -530,6 +533,11 @@ class Grapher(plot.PlotCanvas):
return data
def draw(self):
+ wx.CallAfter(self._draw)
+
+ def _draw(self):
+ if len(self.data) == 0:
+ return
lines = []
markers = []
self.visibleLines = []
@@ -551,7 +559,7 @@ class Grapher(plot.PlotCanvas):
index = self.data.index(l)
if index == self.lineOver:
col = 'black'
- else:
+ else:
col = l.getColour()
if l.getShow():
if l.getCurved():
@@ -618,7 +626,7 @@ class Grapher(plot.PlotCanvas):
markers.append(marker)
if self.selectedPoints and index == self.selected:
try:
- selmarker = plot.PolyMarker([l.getData()[selp] for selp in self.selectedPoints],
+ selmarker = plot.PolyMarker([l.getData()[selp] for selp in self.selectedPoints],
size=1.5, marker="bmpsel", fillcolour='white')
markers.append(selmarker)
except:
@@ -796,7 +804,7 @@ class Grapher(plot.PlotCanvas):
maxX, maxY = _Numeric.maximum( self._zoomCorner1, self._zoomCorner2)
self._hasDragged = False # reset flag
self.last_PointLabel = None #reset pointLabel
- self._zoomed = True
+ self._zoomed = True
if self.last_draw != None:
self._Draw(self.last_draw[0], xAxis = (minX,maxX), yAxis = (minY,maxY), dc = None)
else:
@@ -825,14 +833,14 @@ class Grapher(plot.PlotCanvas):
self.markSelectionStart = None
self.drawSelectionRect(None, None)
self.draw()
-
+
self.checkForHistory()
self.movingCurve = False
self.curve = None
self.point = None
self.setValuesToDraw(self._getXY(event))
self.draw()
-
+
def OnMotion(self,event):
if self._zoomEnabled and event.LeftIsDown() and self._tool > 1 and self.curve == None:
if self._hasDragged:
@@ -878,7 +886,7 @@ class Grapher(plot.PlotCanvas):
self._zoomCorner2[0] = xAxis[1]
self._zoomCorner1[1] = yAxis[0]
self._zoomCorner2[1] = yAxis[1]
-
+
self._Draw(graphics,xAxis,yAxis)
if self._tool == 0:
@@ -894,8 +902,8 @@ class Grapher(plot.PlotCanvas):
if pos[0] < minboundary: X = minboundary
elif pos[0] > maxboundary: X = maxboundary
else: X = pos[0]
-
- if pos[1] < self.GetYCurrentRange()[0]: Y = self.GetYCurrentRange()[0]
+
+ if pos[1] < self.GetYCurrentRange()[0]: Y = self.GetYCurrentRange()[0]
elif pos[1] > self.GetYCurrentRange()[1]: Y = self.GetYCurrentRange()[1]
else: Y = pos[1]
@@ -937,7 +945,7 @@ class Grapher(plot.PlotCanvas):
newypos = self.templist[self.selectedPoints.index(p)][1] * offset[1]
else:
newypos = self.templist[self.selectedPoints.index(p)][1] - offset[1]
- if newypos < self.GetYCurrentRange()[0]: Y = self.GetYCurrentRange()[0]
+ if newypos < self.GetYCurrentRange()[0]: Y = self.GetYCurrentRange()[0]
elif newypos > self.GetYCurrentRange()[1]: Y = self.GetYCurrentRange()[1]
else: Y = newypos
@@ -969,7 +977,7 @@ class Grapher(plot.PlotCanvas):
self.draw()
# Check for mouse over
- else:
+ elif len(self.data) > 0:
self.lineOver = None
if self.selected >= len(self.data) or self.selected < 0:
self.selected = 0
@@ -1083,7 +1091,7 @@ class Grapher(plot.PlotCanvas):
elif key in [wx.WXK_LEFT, wx.WXK_RIGHT, wx.WXK_UP, wx.WXK_DOWN]:
# TODO: The idea here is to move the selected points with arrows
pass
-
+
if self._zoomed and key == wx.WXK_ESCAPE:
self._zoomed = False
self.draw()
@@ -1103,7 +1111,7 @@ class Grapher(plot.PlotCanvas):
def clip(self, off, exXs, exYs):
x,y = off
minX, maxX = 0, self.getTotalTime()
- minY, maxY = self.getLine(self.getSelected()).getYrange()[0], self.getLine(self.getSelected()).getYrange()[1]
+ minY, maxY = self.getLine(self.getSelected()).getYrange()[0], self.getLine(self.getSelected()).getYrange()[1]
if exXs[0] - x >= minX and exXs[1] - x <= maxX:
x = x
elif exXs[1] - x >= maxX:
@@ -1121,7 +1129,7 @@ class Grapher(plot.PlotCanvas):
def clipLog(self, off, exXs, exYs):
x,y = off
minX, maxX = 0, self.getTotalTime()
- minY, maxY = self.getLine(self.getSelected()).getYrange()[0], self.getLine(self.getSelected()).getYrange()[1]
+ minY, maxY = self.getLine(self.getSelected()).getYrange()[0], self.getLine(self.getSelected()).getYrange()[1]
if exXs[0] - x >= minX and exXs[1] - x <= maxX:
x = x
elif exXs[1] - x >= maxX:
@@ -1141,7 +1149,7 @@ class Grapher(plot.PlotCanvas):
xscl = 1./self.totaltime
yscl = 1./yscale
return math.sqrt(pow((p2[0]-p1[0])*xscl, 2) + pow((p2[1]-p1[1])*yscl, 2))
-
+
def distanceLog(self, p1, p2, yrange):
"Length of line between two points (based on X scale and Y ratio)"
xscl = 1./self.totaltime
@@ -1171,7 +1179,7 @@ class ToolBar(wx.Panel):
if CeciliaLib.getVar("systemPlatform") == "win32":
self.loadingMsg = GenStaticText(fakePanel, -1, label="loading buffers... ", pos=(-1, 7))
else:
- self.loadingMsg = wx.StaticText(fakePanel, -1, label="loading buffers... ", pos=(-1, 7))
+ self.loadingMsg = wx.StaticText(fakePanel, -1, label="loading buffers... ", pos=(-1, 7))
self.loadingMsg.SetBackgroundColour(TITLE_BACK_COLOUR)
self.loadingMsg.SetForegroundColour(TITLE_BACK_COLOUR)
font = self.loadingMsg.GetFont()
@@ -1198,7 +1206,7 @@ class ToolBar(wx.Panel):
self.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
fakePanel.Bind(wx.EVT_LEAVE_WINDOW, self.OnLooseFocus)
-
+
def OnLooseFocus(self, event):
win = wx.FindWindowAtPointer()
if win != None:
@@ -1300,7 +1308,7 @@ class CursorPanel(wx.Panel):
dc.SetBrush(wx.Brush(GRAPHER_BACK_COLOUR))
dc.DrawRectangle(0, 0, w, h)
dc.DrawBitmap(self.bitmap, curtime-4, 0)
-
+
def setTime(self, time):
self.time = time
wx.CallAfter(self.Refresh)
@@ -1323,7 +1331,7 @@ class CECGrapher(wx.Panel):
self.toolbar = ToolBar(self, tools=['save', 'load', 'reset', 'show'],
toolFunctions=[self.OnSave, self.OnLoad, self.onReset, self.onShow])
mainBox.Add(self.toolbar, 0, wx.EXPAND)
-
+
sepLine = Separator(self, size=(200,2), colour=BORDER_COLOUR)
mainBox.Add(sepLine, 0, wx.EXPAND)
@@ -1338,7 +1346,7 @@ class CECGrapher(wx.Panel):
mainBox.AddGrowableRow(3)
self.SetSizerAndFit(mainBox)
self.SetSize(self.GetBestSize())
-
+
def getPlotter(self):
return self.plotter
@@ -1362,7 +1370,7 @@ class CECGrapher(wx.Panel):
line.setShow(self.showLineState[line.getLabel()])
self.showLineState = {}
self.plotter.draw()
-
+
def setTotalTime(self, time):
self.plotter.setTotalTime(time)
@@ -1384,7 +1392,7 @@ class CECGrapher(wx.Panel):
if line.getName() in names:
line.setShow(False)
self.plotter.draw()
-
+
def createLines(self, list):
for l in list:
self.createLine(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7])
@@ -1403,7 +1411,7 @@ class CECGrapher(wx.Panel):
def OnSave(self):
line = self.plotter.getLine(self.plotter.getSelected())
- dlg = wx.FileDialog(self, message="Save file as ...", defaultDir=CeciliaLib.ensureNFD(os.getcwd()),
+ dlg = wx.FileDialog(self, message="Save file as ...", defaultDir=CeciliaLib.ensureNFD(os.getcwd()),
defaultFile="", style=wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
@@ -1414,8 +1422,8 @@ class CECGrapher(wx.Panel):
def OnLoad(self):
line = self.plotter.getLine(self.plotter.getSelected())
- dlg = wx.FileDialog(self, message="Choose a grapher file",
- defaultDir=CeciliaLib.ensureNFD(CeciliaLib.getVar("grapherLinePath")),
+ dlg = wx.FileDialog(self, message="Choose a grapher file",
+ defaultDir=CeciliaLib.ensureNFD(CeciliaLib.getVar("grapherLinePath")),
defaultFile="", style=wx.OPEN | wx.CHANGE_DIR)
if dlg.ShowModal() == wx.ID_OK:
path = dlg.GetPath()
@@ -1447,7 +1455,7 @@ class CECGrapher(wx.Panel):
def onShow(self, state):
self.getSelected().setShow(state)
self.plotter.draw()
-
+
def onPopupMenu(self, ind, val):
self.plotter.setSelected(ind)
colour = self.getSelected().getMidColour()
@@ -1600,9 +1608,9 @@ class ConvertSlider(PlainSlider):
def checkFunctionValidity(func, totaltime):
for i, p in enumerate(func):
func[i] = (p[0]*totaltime, float(p[1]))
- if func[0][0] != 0:
+ if func[0][0] != 0:
func[0] = (0, func[0][1])
- if func[-1][0] != totaltime:
+ if func[-1][0] != totaltime:
func[-1] = (totaltime, func[-1][1])
oldX = -1
for f in func:
@@ -1629,7 +1637,7 @@ def checkLogValidity(linlog, mini, maxi, verbose=False):
CeciliaLib.showErrorDialog('Error when building interface!', "'min' or 'max' arguments can't be 0 for a logarithmic cgraph. Reset to 'lin'.")
log = False
return log
-
+
def getGrapher(parent):
return CECGrapher(parent)
@@ -1734,7 +1742,7 @@ def buildGrapher(grapher, list, totaltime):
if up:
colour = CeciliaLib.chooseColourFromName("grey")
else:
- colour = CeciliaLib.chooseColourFromName(col)
+ colour = CeciliaLib.chooseColourFromName(col)
linlog = widget['rel']
log = checkLogValidity(linlog, mini, maxi)
for slider in CeciliaLib.getVar("userSliders"):
@@ -1772,7 +1780,7 @@ def buildGrapher(grapher, list, totaltime):
if up:
colour = CeciliaLib.chooseColourFromName("grey")
else:
- colour = CeciliaLib.chooseColourFromName(col)
+ colour = CeciliaLib.chooseColourFromName(col)
linlog = widget['rel']
log = checkLogValidity(linlog, mini, maxi)
for slider in CeciliaLib.getVar("userSliders"):
@@ -1813,7 +1821,7 @@ def buildGrapher(grapher, list, totaltime):
if len(grapher.plotter.getData()) == 0:
grapher.createLine([[0, 0], [totaltime, 0]], (0, 1), "#FFFFFF", 'unused', False, 'unused', 8192)
labelList.append('unused')
-
+
for line in grapher.plotter.getData():
if line.getName() in samplerSliderNames:
line.setShow(0)
@@ -1847,4 +1855,3 @@ def convert(path, slider, threshold, fromSlider=False, which=None):
maxval = slider.getMaxValue()
points = reducePoints(temp, threshold)
return points
-
diff --git a/Resources/PreferencePanel.py b/Resources/PreferencePanel.py
index cf0e07c..887dbcc 100644
--- a/Resources/PreferencePanel.py
+++ b/Resources/PreferencePanel.py
@@ -29,18 +29,13 @@ PADDING = 10
class PreferenceFrame(wx.Frame):
def __init__(self, parent):
style = ( wx.CLIP_CHILDREN | wx.FRAME_NO_TASKBAR | wx.FRAME_SHAPED | wx.NO_BORDER | wx.FRAME_FLOAT_ON_PARENT )
- wx.Frame.__init__(self, parent, title='', style = style)
+ wx.Frame.__init__(self, parent, style=style)
self.SetBackgroundColour(BACKGROUND_COLOUR)
self.parent = parent
self.font = wx.Font(MENU_FONT, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL, face=FONT_FACE)
self.SetClientSize((350, 390))
-
- if wx.Platform == '__WXGTK__':
- self.Bind(wx.EVT_WINDOW_CREATE, self.SetRoundShape)
- else:
- self.SetRoundShape()
panel = wx.Panel(self, -1)
w, h = self.GetSize()
@@ -63,7 +58,6 @@ class PreferenceFrame(wx.Frame):
box.AddSpacer(5)
self.panelsBox = wx.BoxSizer(wx.HORIZONTAL)
- self.panels = []
pathsPane = self.createPathsPanel(panel)
audioPane = self.createAudioPanel(panel)
audioPane.Hide()
@@ -73,11 +67,7 @@ class PreferenceFrame(wx.Frame):
csoundPane.Hide()
ceciliaPane = self.createCeciliaPanel(panel)
ceciliaPane.Hide()
- self.panels.append(pathsPane)
- self.panels.append(audioPane)
- self.panels.append(midiPane)
- self.panels.append(csoundPane)
- self.panels.append(ceciliaPane)
+ self.panels = [pathsPane, audioPane, midiPane, csoundPane, ceciliaPane]
self.currentPane = 0
self.panelsBox.Add(self.panels[self.currentPane])
box.Add(self.panelsBox, 0, wx.TOP, 10)
@@ -91,9 +81,6 @@ class PreferenceFrame(wx.Frame):
panel.SetSizerAndFit(box)
- def SetRoundShape(self, event=None):
- self.SetShape(GetRoundShape(350, 390, 1))
-
def onClose(self, event=None):
CeciliaLib.writeVarToDisk()
self.Destroy()
diff --git a/Resources/Sliders.py b/Resources/Sliders.py
index f8eb18a..472e8bf 100644
--- a/Resources/Sliders.py
+++ b/Resources/Sliders.py
@@ -25,6 +25,10 @@ import CeciliaLib
from constants import *
from Widgets import *
+### TODO:
+# When an OSC controler is defined for a slider, the interface initialization gives this error:
+# TypeError: in method 'Window_Refresh', expected argument 1 of type 'wxWindow *'
+
def interpFloat(t, v1, v2):
"interpolator for a single value; interprets t in [0-1] between v1 and v2"
return (v2-v1)*t + v1
@@ -298,9 +302,9 @@ class Slider(wx.Panel):
def OnResize(self, evt):
self.createSliderBitmap()
+ self.createKnobMaskBitmap()
self.createKnobBitmap()
self.createBackgroundBitmap()
- self.createKnobMaskBitmap()
self.clampPos()
wx.CallAfter(self.Refresh)
@@ -325,13 +329,13 @@ class HSlider(Slider):
self.knobSize = 28
self.knobHalfSize = 14
self.sliderHeight = 14
- self.createSliderBitmap()
self.createKnobMaskBitmap()
- self.createBackgroundBitmap()
+ self.createSliderBitmap()
self.createKnobBitmap()
+ self.createBackgroundBitmap()
self.value = 0
- if init != None: self.SetValue(init)
- else: self.SetValue(minvalue)
+ if init != None: self._setValue(init)
+ else: self._setValue(minvalue)
self.clampPos()
self.midictl = ''
self.midiLearn = False
@@ -393,9 +397,9 @@ class HSlider(Slider):
def setOpenSndCtrl(self, str):
self.openSndCtrl = str
- self.OnResize(None)
+ #self.OnResize(None)
- def SetValue(self, value):
+ def _setValue(self, value):
self.lastvalue = self.value
value = clamp(value, self.minvalue, self.maxvalue)
if self.log:
@@ -406,7 +410,12 @@ class HSlider(Slider):
self.value = interpFloat(t, self.minvalue, self.maxvalue)
if self.myType == IntType:
self.value = int(self.value)
- self.OnResize(None)
+ self.clampPos()
+
+ def SetValue(self, value):
+ self._setValue(value)
+ #self.OnResize(None)
+ wx.CallAfter(self.Refresh)
def GetValue(self):
if self.log:
@@ -614,11 +623,9 @@ class CECSlider:
self.setMidiChannel(values[3])
self.setMidiCtl(values[2])
if len(values) >= 5:
- if values[4] != None:
- self.setOpenSndCtrl("%d:%s" % (values[4][0], values[4][1]))
+ self.setOpenSndCtrl(values[4])
if len(values) >= 6:
- if values[5] != None:
- self.setOSCOut("%s:%d:%s" % (values[5][0], values[5][1], values[5][2]))
+ self.setOSCOut(values[5])
def getPath(self):
return self.path
@@ -633,7 +640,7 @@ class CECSlider:
self.slider.setMidiCtl("%d:%d" % (self.midictl, self.midichan))
self.openSndCtrl = None
self.slider.setOpenSndCtrl('')
- self.slider.Refresh()
+ wx.CallAfter(self.slider.Refresh)
def getMidiCtl(self):
return self.midictl
@@ -651,28 +658,28 @@ class CECSlider:
return False
def setOpenSndCtrl(self, value):
- if value != None:
- if value == "":
- self.openSndCtrl = None
- self.slider.setOpenSndCtrl("")
- else:
- sep = value.split(":")
- port = int(sep[0].strip())
- address = str(sep[1].strip())
- self.openSndCtrl = (port, address)
- self.slider.setOpenSndCtrl("%d:%s" % (port, address))
- self.setMidiCtl(None)
+ if value == None or value == "":
+ self.openSndCtrl = None
+ self.slider.setOpenSndCtrl("")
+ else:
+ msg = "%d:%s" % (value[0], value[1])
+ sep = msg.split(":")
+ port = int(sep[0].strip())
+ address = str(sep[1].strip())
+ self.openSndCtrl = (port, address)
+ self.slider.setOpenSndCtrl("%d:%s" % (port, address))
+ self.setMidiCtl(None)
def setOSCOut(self, value):
- if value != None:
- if value == "":
- self.OSCOut = None
- else:
- sep = value.split(":")
- host = str(sep[0].strip())
- port = int(sep[1].strip())
- address = str(sep[2].strip())
- self.OSCOut = (host, port, address)
+ if value == None or value == "":
+ self.OSCOut = None
+ else:
+ msg = "%s:%d:%s" % (value[0], value[1], value[2])
+ sep = msg.split(":")
+ host = str(sep[0].strip())
+ port = int(sep[1].strip())
+ address = str(sep[2].strip())
+ self.OSCOut = (host, port, address)
def getOpenSndCtrl(self):
return self.openSndCtrl
@@ -1205,7 +1212,7 @@ class CECRange:
self.openSndCtrl = None
self.slider.setOpenSndCtrl('', "left")
self.slider.setOpenSndCtrl('', "right")
- self.slider.Refresh()
+ wx.CallAfter(self.slider.Refresh)
def getMidiCtl(self):
return self.midictl
diff --git a/Resources/Variables.py b/Resources/Variables.py
index 00c463d..92c6a0b 100644
--- a/Resources/Variables.py
+++ b/Resources/Variables.py
@@ -72,7 +72,7 @@ CeciliaVar['moduleDescription'] = ''
CeciliaVar['interfaceWidgets'] = []
CeciliaVar['interface'] = None
CeciliaVar['interfaceSize'] = (1000, 600)
-CeciliaVar['interfacePosition'] = (0, 0)
+CeciliaVar['interfacePosition'] = (0, 25)
CeciliaVar['grapher'] = None
CeciliaVar['gainSlider'] = None
CeciliaVar['plugins'] = [None] * NUM_OF_PLUGINS
@@ -171,7 +171,7 @@ def readCeciliaPrefsFromFile():
CeciliaVar["nchnls"] = CeciliaVar["defaultNchnls"]
else:
- print('Preferences file not found.\n')
+ print('Preferences file not found. Using defaults...\n')
def writeCeciliaPrefsToFile():
varsToSave = ['interfaceSize', 'interfacePosition', 'useTooltips', 'enableAudioInput', 'textEditor',
diff --git a/Resources/Widgets.py b/Resources/Widgets.py
index a94d60f..063c84e 100644
--- a/Resources/Widgets.py
+++ b/Resources/Widgets.py
@@ -3434,7 +3434,7 @@ class WavesFrame(wx.Frame):
self.parent = parent
self.SetClientSize((300,210))
- self.distList = ['Sine', 'Square', 'triangle', 'Sawtooth', 'Sinc', 'Pulse', 'Bi-Pulse']
+ self.distList = ['Sine', 'Square', 'Triangle', 'Sawtooth', 'Sinc', 'Pulse', 'Bi-Pulse']
panel = wx.Panel(self, -1)
w, h = self.GetSize()
@@ -3537,7 +3537,7 @@ class WavesFrame(wx.Frame):
elif label == 'Square':
self.ptsSlider.Disable()
self.widthSlider.Enable()
- elif label == 'triangle':
+ elif label == 'Triangle':
self.ptsSlider.Disable()
self.widthSlider.Enable()
elif label == 'Sinc':
@@ -3561,7 +3561,7 @@ class WavesFrame(wx.Frame):
dict = self.sineGenerate(points, amp, freq, phase)
elif dist == 'Square':
dict = self.squareGenerate(points, amp, freq, phase, width)
- elif dist == 'triangle':
+ elif dist == 'Triangle':
dict = self.triangleGenerate(points, amp, freq, phase, width)
elif dist == 'Sawtooth':
dict = self.sawtoothGenerate(points, amp, freq, phase)
@@ -3937,6 +3937,7 @@ class ProcessFrame(wx.Frame):
def onDistribution(self, ind, label):
if label == 'Scatter':
self.ptsSlider.Disable()
+ self.scatYSlider.Enable()
self.offXSlider.Disable()
self.offYSlider.Disable()
self.scatXLabel.SetLabel('Scatt X')
@@ -3947,6 +3948,7 @@ class ProcessFrame(wx.Frame):
self.scatYSlider.SetValue(0.05)
elif label == 'Jitter':
self.ptsSlider.Enable()
+ self.scatYSlider.Enable()
self.offXSlider.Disable()
self.offYSlider.Disable()
self.scatXLabel.SetLabel('Jitte X')
@@ -3957,6 +3959,7 @@ class ProcessFrame(wx.Frame):
self.scatYSlider.SetValue(0.05)
elif label == 'Comp/Expand':
self.ptsSlider.Disable()
+ self.scatYSlider.Enable()
self.offXSlider.Enable()
self.offYSlider.Enable()
self.scatXLabel.SetLabel('Comp X')
diff --git a/Resources/audio.py b/Resources/audio.py
index 739a866..d90096e 100755
--- a/Resources/audio.py
+++ b/Resources/audio.py
@@ -50,7 +50,7 @@ class CeciliaFilein:
self.table = NewTable(length=offset, chnls=chnls, feedback=0.0)
self.livein = Input(chnl=[x for x in range(chnls)], mul=0.7)
self.filltabrec = TableRec(self.livein, self.table, fadetime=0.05).play()
-
+
def sig(self):
return self.table
@@ -84,9 +84,9 @@ class CeciliaSampler:
for line in CeciliaLib.getVar("grapher").plotter.getData():
if line.name.startswith(self.name):
graph_lines[line.name] = line
-
+
paths = [slider.getPath() for slider in sampler.getSamplerSliders()]
-
+
################ start ################
start_init, self.start_play, self.start_rec = sinfo['loopIn'][0], sinfo['loopIn'][1], sinfo['loopIn'][2]
try:
@@ -116,7 +116,7 @@ class CeciliaSampler:
self.baseModule._addOpenSndCtrlWidget(self.start_osc[0], self.start_osc[1], self, name='start')
if self.start_rec:
self.start_record = ControlRec(self.start, filename=paths[0], rate=1000, dur=totalTime).play()
-
+
################ dur ################
dur_init, self.dur_play, self.dur_rec = sinfo['loopOut'][0], sinfo['loopOut'][1], sinfo['loopOut'][2]
try:
@@ -146,7 +146,7 @@ class CeciliaSampler:
self.baseModule._addOpenSndCtrlWidget(self.dur_osc[0], self.dur_osc[1], self, name='dur')
if self.dur_rec:
self.dur_record = ControlRec(self.dur, filename=paths[1], rate=1000, dur=totalTime).play()
-
+
################ xfade ################
xfade_init, self.xfade_play, self.xfade_rec = sinfo['loopX'][0], sinfo['loopX'][1], sinfo['loopX'][2]
try:
@@ -175,7 +175,7 @@ class CeciliaSampler:
self.baseModule._addOpenSndCtrlWidget(self.xfade_osc[0], self.xfade_osc[1], self, name='xfade')
if self.xfade_rec:
self.xfade_record = ControlRec(self.xfade, filename=paths[2], rate=1000, dur=totalTime).play()
-
+
################ gain ################
gain_init, self.gain_play, self.gain_rec = sinfo['gain'][0], sinfo['gain'][1], sinfo['gain'][2]
try:
@@ -205,7 +205,7 @@ class CeciliaSampler:
if self.gain_rec:
self.gain_record = ControlRec(self.gain_in, filename=paths[3], rate=1000, dur=totalTime).play()
self.gain = Pow(10, self.gain_in * 0.05, mul=self.user_amp)
-
+
################ pitch ################
pitch_init, self.pitch_play, self.pitch_rec = sinfo['transp'][0], sinfo['transp'][1], sinfo['transp'][2]
try:
@@ -295,7 +295,7 @@ class CeciliaSampler:
mul=self.gain)
self.loopinterp = Interp(self.looper, self.looper2, self.interp)
self.mix = Mix(self.loopinterp, voices=chnls, mul=self.parent.polyphony_scaling)
-
+
else:
self.mix = Input(chnl=[x for x in range(chnls)], mul=0.7)
@@ -379,7 +379,7 @@ class CeciliaSampler:
self.gain_table.replace(func)
elif which.endswith('trans'):
self.pitch_table.replace(func)
-
+
def checkForAutomation(self):
if self.mode != 1:
if self.start_rec:
@@ -405,27 +405,27 @@ class CeciliaSampler:
def setSound(self, snd):
if self.mode == 0:
self.table.setSound(snd)
-
+
def setStart(self, x):
if self.mode != 1:
if not self.start_play:
self.start.value = x
-
+
def setDur(self, x):
if self.mode != 1:
if not self.dur_play:
self.dur.value = x
-
+
def setXfade(self, x):
if self.mode != 1:
if not self.xfade_play:
self.xfade.value = x
-
+
def setGain(self, x):
if self.mode != 1:
if not self.gain_play:
self.gain_in.value = x
-
+
def setPitch(self, x):
if self.mode != 1:
if not self.pitch_play:
@@ -436,7 +436,7 @@ class CeciliaSampler:
self.looper.mode = x
if self.mode == 3:
self.looper2.mode = x
-
+
def setXfadeShape(self, x):
if self.mode != 1:
self.looper.xfadeshape = x
@@ -456,13 +456,13 @@ class CeciliaSlider:
for line in CeciliaLib.getVar("grapher").plotter.getData():
if line.name == self.name:
break
-
+
self.widget = line.slider
self.play = self.widget.getPlay()
self.rec = self.widget.getRec()
self.midi = self.widget.getWithMidi()
self.openSndCtrl = self.widget.getWithOSC()
-
+
curved = line.getCurved()
log = self.widget.getLog()
if curved and log:
@@ -479,8 +479,8 @@ class CeciliaSlider:
if slider.name == self.name:
self.widget = slider
break
-
- init = self.widget.getValue()
+
+ init = self.widget.getValue()
mini = self.widget.getMinValue()
maxi = self.widget.getMaxValue()
log = self.widget.getLog()
@@ -496,7 +496,7 @@ class CeciliaSlider:
if log:
init = math.sqrt((init - mini) / (maxi - mini)) * (maxi - mini) + mini
exp = 2
- else:
+ else:
exp = 1
self.ctlin = Midictl(self.widget.getMidiCtl(), mini, maxi, init, self.widget.getMidiChannel())
self.ctlin.setInterpolation(False)
@@ -588,7 +588,7 @@ class CeciliaRange:
if log:
init = [math.sqrt((x - mini) / (maxi - mini)) * (maxi - mini) + mini for x in init]
exp = 2
- else:
+ else:
exp = 1
self.ctlin = Midictl(self.widget.getMidiCtl(), mini, maxi, init, self.widget.getMidiChannel())
self.ctlin.setInterpolation(False)
@@ -829,7 +829,7 @@ class BaseModule:
def getSamplerDur(self, name):
return self._samplers[name].getDur()
-
+
def duplicate(self, seq, num):
"""
Duplicates elements in a sequence according to the `num` parameter.
@@ -858,7 +858,7 @@ class BaseModule:
"""
Sets the Server's global seed used by objects from the random family.
-
+
"""
CeciliaLib.getVar("audioServer").server.globalseed = x
############################
@@ -883,7 +883,7 @@ class BaseModule:
self.polyphony_spread.append(midiToTranspo(note+60))
else:
self.polyphony_spread.append(midiToTranspo(note-12+60))
-
+
def _deleteOscReceivers(self):
if hasattr(self, "oscReceivers"):
del self.oscReceivers
@@ -1028,21 +1028,37 @@ class CeciliaPlugin:
break
self.play_p1 = self.widget_p1.getPlay()
self.rec_p1 = self.widget_p1.getRec()
+ self.midi_p1 = self.widget_p1.getWithMidi()
curved = line.getCurved()
if curved:
self.table_p1 = CosTable()
else:
self.table_p1 = LinTable()
+
+
+ init = self.widget_p1.getValue()
+ mini = self.widget_p1.getMinValue()
+ maxi = self.widget_p1.getMaxValue()
+ log = self.widget_p1.getLog()
self._p1 = SigTo(params[0], time=gliss, init=params[0])
if self.rec_p1:
- self.record_p1 = ControlRec(self._p1, filename=self.widget_p1.getPath(),
+ self.record_p1 = ControlRec(self._p1, filename=self.widget_p1.getPath(),
rate=1000, dur=totalTime).play()
if self.play_p1 > 0:
data = line.getData()
data = [tuple(x) for x in data]
self.setGraph(0, data)
self.reader_p1 = TableRead(self.table_p1, freq=1.0/totalTime).play()
-
+ elif self.midi_p1:
+ if log:
+ init = math.sqrt((init - mini) / (maxi - mini)) * (maxi - mini) + mini
+ exp = 2
+ else:
+ exp = 1
+ self.ctlin_p1 = Midictl(self.widget_p1.getMidiCtl(), mini, maxi, init, self.widget_p1.getMidiChannel())
+ self.ctlin_p1.setInterpolation(False)
+ self.reader_p1 = Scale(self.ctlin_p1, inmin=mini, inmax=maxi, outmin=mini, outmax=maxi, exp=exp)
+
self.widget_p2 = knobs[1]
name = self.widget_p2.getName()
for line in CeciliaLib.getVar("grapher").plotter.getData():
@@ -1050,21 +1066,36 @@ class CeciliaPlugin:
break
self.play_p2 = self.widget_p2.getPlay()
self.rec_p2 = self.widget_p2.getRec()
+ self.midi_p2 = self.widget_p2.getWithMidi()
curved = line.getCurved()
if curved:
self.table_p2 = CosTable()
else:
self.table_p2 = LinTable()
+
+ init = self.widget_p2.getValue()
+ mini = self.widget_p2.getMinValue()
+ maxi = self.widget_p2.getMaxValue()
+ log = self.widget_p2.getLog()
self._p2 = SigTo(params[1], time=gliss, init=params[1])
if self.rec_p2:
- self.record_p2 = ControlRec(self._p2, filename=self.widget_p2.getPath(),
+ self.record_p2 = ControlRec(self._p2, filename=self.widget_p2.getPath(),
rate=1000, dur=totalTime).play()
if self.play_p2 > 0:
data = line.getData()
data = [tuple(x) for x in data]
self.setGraph(1, data)
self.reader_p2 = TableRead(self.table_p2, freq=1.0/totalTime).play()
-
+ elif self.midi_p2:
+ if log:
+ init = math.sqrt((init - mini) / (maxi - mini)) * (maxi - mini) + mini
+ exp = 2
+ else:
+ exp = 1
+ self.ctlin_p2 = Midictl(self.widget_p2.getMidiCtl(), mini, maxi, init, self.widget_p2.getMidiChannel())
+ self.ctlin_p2.setInterpolation(False)
+ self.reader_p2 = Scale(self.ctlin_p2, inmin=mini, inmax=maxi, outmin=mini, outmax=maxi, exp=exp)
+
self.widget_p3 = knobs[2]
name = self.widget_p3.getName()
for line in CeciliaLib.getVar("grapher").plotter.getData():
@@ -1072,37 +1103,52 @@ class CeciliaPlugin:
break
self.play_p3 = self.widget_p3.getPlay()
self.rec_p3 = self.widget_p3.getRec()
+ self.midi_p3 = self.widget_p3.getWithMidi()
curved = line.getCurved()
if curved:
self.table_p3 = CosTable()
else:
self.table_p3 = LinTable()
+
+ init = self.widget_p3.getValue()
+ mini = self.widget_p3.getMinValue()
+ maxi = self.widget_p3.getMaxValue()
+ log = self.widget_p3.getLog()
self._p3 = SigTo(params[2], time=gliss, init=params[2])
if self.rec_p3:
- self.record_p3 = ControlRec(self._p3, filename=self.widget_p3.getPath(),
+ self.record_p3 = ControlRec(self._p3, filename=self.widget_p3.getPath(),
rate=1000, dur=totalTime).play()
if self.play_p3 > 0:
data = line.getData()
data = [tuple(x) for x in data]
self.setGraph(2, data)
self.reader_p3 = TableRead(self.table_p3, freq=1.0/totalTime).play()
+ elif self.midi_p3:
+ if log:
+ init = math.sqrt((init - mini) / (maxi - mini)) * (maxi - mini) + mini
+ exp = 2
+ else:
+ exp = 1
+ self.ctlin_p3 = Midictl(self.widget_p3.getMidiCtl(), mini, maxi, init, self.widget_p3.getMidiChannel())
+ self.ctlin_p3.setInterpolation(False)
+ self.reader_p3 = Scale(self.ctlin_p3, inmin=mini, inmax=maxi, outmin=mini, outmax=maxi, exp=exp)
self.preset = params[3]
def sig1(self):
- if self.play_p1 == 0:
+ if self.play_p1 == 0 and not self.midi_p1:
return self._p1
else:
return self.reader_p1
def sig2(self):
- if self.play_p2 == 0:
+ if self.play_p2 == 0 and not self.midi_p2:
return self._p2
else:
return self.reader_p2
def sig3(self):
- if self.play_p3 == 0:
+ if self.play_p3 == 0 and not self.midi_p3:
return self._p3
else:
return self.reader_p3
@@ -1152,15 +1198,15 @@ class CeciliaPlugin:
self.record_p2.write()
if self.rec_p3:
self.record_p3.write()
-
+
def updateWidget(self):
- if self.play_p1:
+ if self.play_p1 or self.midi_p1:
val = self.reader_p1.get()
wx.CallAfter(self.widget_p1.setValue, val)
- if self.play_p2:
+ if self.play_p2 or self.midi_p2:
val = self.reader_p2.get()
wx.CallAfter(self.widget_p2.setValue, val)
- if self.play_p3:
+ if self.play_p3 or self.midi_p3:
val = self.reader_p3.get()
wx.CallAfter(self.widget_p3.setValue, val)
@@ -1289,7 +1335,7 @@ class CeciliaAmpModPlugin(CeciliaPlugin):
else:
mode = self.preset - 1
inter = 1
-
+
self.zero = Sig(0)
if len(self.input) < 2:
self.lfoamp = Sine(freq=self.sig1(), mul=.5, add=.5)
@@ -1303,7 +1349,7 @@ class CeciliaAmpModPlugin(CeciliaPlugin):
self.modamp = self.input * (self.lfoamp * self.sig2() + self.iamp)
self.lforing = Sine(freq=self.sig1(), phase=[self.zero, self.sig3()], mul=self.sig2())
self.modring = self.input * self.lforing
-
+
if mode == 0:
self.out = Interp(self.input, self.modamp, inter)
else:
@@ -1415,7 +1461,7 @@ class CeciliaChaosModPlugin(CeciliaPlugin):
else:
self.lfo.value = self.lforo
inter = 1
-
+
self.out = Interp(self.input, self.modu, inter)
def setPreset(self, x, label):
@@ -1450,10 +1496,10 @@ class AudioServer():
self.withSpectrum = False
self.pluginObjs = [None] * NUM_OF_PLUGINS
self.out = self.spectrum = None
- self.pluginDict = {"Reverb": CeciliaReverbPlugin, "WGVerb": CeciliaWGReverbPlugin, "Filter": CeciliaFilterPlugin, "Para EQ": CeciliaEQPlugin,
- "Chorus": CeciliaChorusPlugin, "3 Bands EQ": CeciliaEQ3BPlugin, "Compress": CeciliaCompressPlugin, "Gate": CeciliaGatePlugin,
- "Disto": CeciliaDistoPlugin, "AmpMod": CeciliaAmpModPlugin, "Phaser": CeciliaPhaserPlugin, "Delay": CeciliaDelayPlugin,
- "Flange": CeciliaFlangePlugin, "Harmonizer": CeciliaHarmonizerPlugin, "Resonators": CeciliaResonatorsPlugin,
+ self.pluginDict = {"Reverb": CeciliaReverbPlugin, "WGVerb": CeciliaWGReverbPlugin, "Filter": CeciliaFilterPlugin, "Para EQ": CeciliaEQPlugin,
+ "Chorus": CeciliaChorusPlugin, "3 Bands EQ": CeciliaEQ3BPlugin, "Compress": CeciliaCompressPlugin, "Gate": CeciliaGatePlugin,
+ "Disto": CeciliaDistoPlugin, "AmpMod": CeciliaAmpModPlugin, "Phaser": CeciliaPhaserPlugin, "Delay": CeciliaDelayPlugin,
+ "Flange": CeciliaFlangePlugin, "Harmonizer": CeciliaHarmonizerPlugin, "Resonators": CeciliaResonatorsPlugin,
"DeadReson": CeciliaDeadResonPlugin, 'ChaosMod': CeciliaChaosModPlugin}
def getPrefs(self):
@@ -1491,7 +1537,7 @@ class AudioServer():
fileformat = AUDIO_FILE_FORMATS[CeciliaLib.getVar("audioFileType")]
sampletype = CeciliaLib.getVar("sampSize")
self.recamp = SigTo(self.amp, time=0.05, init=self.amp)
- self.recorder = Record(self.pluginObjs[-1].out * self.recamp,
+ self.recorder = Record(self.pluginObjs[-1].out * self.recamp,
CeciliaLib.toSysEncoding(CeciliaLib.getVar("outputFile")), CeciliaLib.getVar("nchnls"),
fileformat=fileformat, sampletype=sampletype, buffering=8)
if CeciliaLib.getVar("showSpectrum"):
@@ -1619,7 +1665,7 @@ class AudioServer():
def recordOptions(self, dur, filename, fileformat, sampletype):
self.server.recordOptions(dur=dur, filename=filename, fileformat=fileformat, sampletype=sampletype)
-
+
def isAudioServerRunning(self):
if self.server.getIsStarted():
return True
@@ -1665,7 +1711,7 @@ class AudioServer():
for i in range(NUM_OF_PLUGINS):
if self.pluginObjs[i] != None:
del self.pluginObjs[i].out
- self.pluginObjs[i] = None
+ self.pluginObjs[i] = None
if self.spectrum != None:
del self.specamp
del self.spectrum._timer
@@ -1794,20 +1840,26 @@ class AudioServer():
if plugins[order] != None:
if plugins[order].getName() == self.pluginObjs[order].name:
self.pluginObjs[order].setGraph(which, func)
-
- def getMidiCtlNumber(self, number, midichnl=1):
+
+ def getMidiCtlNumber(self, number, midichnl=1):
if not self.midiLearnRange:
- self.midiLearnSlider.setMidiCtl(number)
self.midiLearnSlider.setMidiChannel(midichnl)
- wx.CallLater(250, self.server.stop)
+ self.midiLearnSlider.setMidiCtl(number)
+ if CeciliaLib.getVar("systemPlatform") == "darwin":
+ self.tmpScanCallback = CallAfter(self.stop, .25)
+ else:
+ wx.CallLater(250, self.stop)
else:
tmp = [number, midichnl]
if not tmp in self.midiLearnCtlsAndChnls:
self.midiLearnCtlsAndChnls.append(tmp)
if len(self.midiLearnCtlsAndChnls) == 2:
- self.midiLearnSlider.setMidiCtl([self.midiLearnCtlsAndChnls[0][0], self.midiLearnCtlsAndChnls[1][0]])
self.midiLearnSlider.setMidiChannel([self.midiLearnCtlsAndChnls[0][1], self.midiLearnCtlsAndChnls[1][1]])
- wx.CallLater(250, self.server.stop)
+ self.midiLearnSlider.setMidiCtl([self.midiLearnCtlsAndChnls[0][0], self.midiLearnCtlsAndChnls[1][0]])
+ if CeciliaLib.getVar("systemPlatform") == "darwin":
+ self.tmpScanCallback = CallAfter(self.stop, .25)
+ else:
+ wx.CallLater(250, self.stop)
def midiLearn(self, slider, rangeSlider=False):
self.midiLearnSlider = slider
@@ -1830,7 +1882,7 @@ class AudioServer():
defaultMidiDriver = midiDriverList[midiDriverIndexes.index(pm_get_default_input())]
return inputDriverList, inputDriverIndexes, defaultInputDriver, outputDriverList, outputDriverIndexes, \
defaultOutputDriver, midiDriverList, midiDriverIndexes, defaultMidiDriver
-
+
def validateAudioFile(self, path):
if sndinfo(CeciliaLib.toSysEncoding(path)) != None:
return True
@@ -1840,7 +1892,7 @@ class AudioServer():
def getSoundInfo(self, path):
"""
Retrieves information of the sound and prints it to the console.
-
+
return (number of channels, sampling rate, duration, fraction of a table, length in samples, bitrate)
"""
if CeciliaLib.getVar("DEBUG"):
@@ -1848,7 +1900,7 @@ class AudioServer():
print path
info = sndinfo(CeciliaLib.toSysEncoding(path))
-
+
if info != None:
samprate = info[2]
chnls = info[3]
@@ -1861,7 +1913,7 @@ class AudioServer():
if size > nsamps:
break
tableFrac = nsamps / size
-
+
if CeciliaLib.getVar("DEBUG"):
print "channels = %d" % chnls
print "sampling rate = %s" % samprate
@@ -1881,7 +1933,7 @@ class AudioServer():
if os.path.isfile(path):
infos = self.getSoundInfo(path)
if infos != None:
- sndfile = os.path.split(path)[1]
+ sndfile = os.path.split(path)[1]
if sndfile not in soundDict.keys():
soundDict[CeciliaLib.ensureNFD(sndfile)] = {'samprate': infos[1],
'chnls': infos[0],
@@ -1895,4 +1947,3 @@ class AudioServer():
if CeciliaLib.getVar("DEBUG"):
print
return soundDict
-
diff --git a/Resources/constants.py b/Resources/constants.py
index 25c379f..bf0fe87 100644
--- a/Resources/constants.py
+++ b/Resources/constants.py
@@ -27,8 +27,8 @@ BUILD_RST = False
from images import *
APP_NAME = 'Cecilia5'
-APP_VERSION = '5.2.0'
-APP_COPYRIGHT = 'iACT, 2015'
+APP_VERSION = '5.2.1'
+APP_COPYRIGHT = 'iACT, 2016'
FILE_EXTENSION = "c5"
PRESETS_DELIMITER = "####################################\n" \
"##### Cecilia reserved section #####\n" \
diff --git a/Resources/modules/Filters/MaskFilter.c5 b/Resources/modules/Filters/MaskFilter.c5
index aff2654..eb7f4de 100644
--- a/Resources/modules/Filters/MaskFilter.c5
+++ b/Resources/modules/Filters/MaskFilter.c5
@@ -851,4 +851,4 @@ CECILIA_PRESETS = {u'01-Oscillating Filter': {'active': False,
'userSliders': {'filtrangeCAC': [[230.95639693789167, 495.74776495506785], 0, None, [1, 1], None, None],
'fultrange': [[961.6333560700168, 1927.544240436204], 0, None, [1, 1], None, None],
'mix': [0.5, 0, None, 1, None, None]},
- 'userTogglePopups': {'balance': 1, 'filtnum': 3, 'poly': 0, 'polynum': 0}}}
\ No newline at end of file
+ 'userTogglePopups': {'balance': 1, 'filtnum': 3, 'poly': 0, 'polynum': 0}}}
diff --git a/doc-en/source/conf.py b/doc-en/source/conf.py
index 19a67ef..5c5bd51 100644
--- a/doc-en/source/conf.py
+++ b/doc-en/source/conf.py
@@ -41,16 +41,16 @@ master_doc = 'index'
# General information about the project.
project = u'Cecilia5'
-copyright = u'2015, Olivier Bélanger, Julie Delisle, Jean Piché'
+copyright = u'2016, Olivier Bélanger, Julie Delisle, Jean Piché'
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
#
# The short X.Y version.
-version = '5.2.0'
+version = '5.2.1'
# The full version, including alpha/beta/rc tags.
-release = '5.2.0'
+release = '5.2.1'
# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
diff --git a/doc-en/source/index.rst b/doc-en/source/index.rst
index 10b0014..686d958 100644
--- a/doc-en/source/index.rst
+++ b/doc-en/source/index.rst
@@ -3,7 +3,7 @@
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
-Cecilia5 5.2.0 documentation
+Cecilia5 5.2.1 documentation
====================================
Welcome to the Cecilia5 documentation.
diff --git a/doc-en/source/src/configuration/midi-osc.rst b/doc-en/source/src/configuration/midi-osc.rst
index 417158c..03c1c2e 100644
--- a/doc-en/source/src/configuration/midi-osc.rst
+++ b/doc-en/source/src/configuration/midi-osc.rst
@@ -24,9 +24,10 @@ However, most parameters will have to be assigned to a controller with the MIDI
for the minimum and maximum values.
To link a parameter to a MIDI controller with the MIDI learn function, **Right-Click** on the parameter
-label you want to control and move the knob or slider of the MIDI controller to enable the connection.
-Then, the controller number should be written in the slider of Cecilia5's graphical interface.
-To disable the connection, hold **Shift** and **Right-Click** on the parameter label.
+label (or on the knob in Post-Processing section) you want to control and move the knob or slider of
+the MIDI controller to enable the connection. Then, the controller number should be written in the
+slider of Cecilia5's graphical interface. To disable the connection, hold **Shift** and **Right-Click**
+on the parameter label. Sliders in the sampler window can also be assigned to MIDI controllers.
.. image:: /images/midiLearn.png
:align: center
@@ -35,8 +36,9 @@ OSC
-------
It is also possible to control the parameters with the Open Sound Control (OSC) protocol. To enable
-an OSC connection, **Double-Click** on the parameter label you want to control, enter the destination port
-and address in the window that will appear and click on "Apply":
+an OSC connection, **Double-Click** on the parameter label (knob in Post-Processing section can't be
+assigned to OSC messages) you want to control, enter the destination port and address in the window
+that will appear and click on "Apply":
.. image:: /images/OpenSoundControl.png
:align: center
@@ -51,5 +53,7 @@ To assign OSC controller to a *Range Slider*, you must **Double-Click** one time
parameter label to create a connection with the minimum value and **Double-Click** another time on
the right part of the label to create the connection with the maximum value.
+Sliders in the sampler window can also be assigned to OSC messages.
+
Please be aware that activating an OSC connection will automatically disable the previons MIDI connection
related to the chosen parameter.
diff --git a/doc-en/source/src/intro/requirements.rst b/doc-en/source/src/intro/requirements.rst
index d428cc2..a80b8eb 100644
--- a/doc-en/source/src/intro/requirements.rst
+++ b/doc-en/source/src/intro/requirements.rst
@@ -21,7 +21,7 @@ Before running Cecilia5 from the latest sources,
please check if all these elements are installed on your computer:
- `Python 2.6 <https://www.python.org/download/releases/2.6.6>`_ or `Python 2.7 <https://www.python.org/download/releases/2.7.8>`_.
-- `Pyo 0.7.6 <http://ajaxsoundstudio.com/software/pyo/>`_ (or compiled with latest `sources <http://code.google.com/p/pyo>`_).
+- `Pyo 0.7.8 <http://ajaxsoundstudio.com/software/pyo/>`_ (or compiled with latest `sources <http://code.google.com/p/pyo>`_).
- `Numpy 1.6.0 or higher <http://sourceforge.net/projects/numpy/files/NumPy/>`_ (but below 1.9).
- `WxPython 3.0 <http://wxpython.org/download.php>`_.
- `Git client <https://git-scm.com/downloads>`_.
diff --git a/scripts/builder_OSX.sh b/scripts/builder_OSX.sh
index d3e2c8f..4dd445d 100755
--- a/scripts/builder_OSX.sh
+++ b/scripts/builder_OSX.sh
@@ -1,7 +1,7 @@
rm -rf build dist
-export DMG_DIR="Cecilia5 5.2.0"
-export DMG_NAME="Cecilia5_5.2.0.dmg"
+export DMG_DIR="Cecilia5 5.2.1"
+export DMG_NAME="Cecilia5_5.2.1.dmg"
if [ -f setup.py ]; then
mv setup.py setup_back.py;
diff --git a/scripts/info.plist b/scripts/info.plist
index abbeda1..f8d512b 100644
--- a/scripts/info.plist
+++ b/scripts/info.plist
@@ -38,11 +38,11 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
- <string>5.2.0</string>
+ <string>5.2.1</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
- <string>5.2.0</string>
+ <string>5.2.1</string>
<key>LSHasLocalizedDisplayName</key>
<false/>
<key>NSAppleScriptEnabled</key>
diff --git a/scripts/release_src.sh b/scripts/release_src.sh
index 4b66554..353eb7d 100755
--- a/scripts/release_src.sh
+++ b/scripts/release_src.sh
@@ -5,7 +5,7 @@
# 2. Execute from cecilia5 folder : ./scripts/release_src.sh
#
-version=5.2.0
+version=5.2.1
replace=XXX
src_rep=Cecilia5_XXX-src
diff --git a/scripts/win_installer.iss b/scripts/win_installer.iss
index cb30aed..1266310 100644
--- a/scripts/win_installer.iss
+++ b/scripts/win_installer.iss
@@ -7,7 +7,7 @@
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={{A970BBE5-4FA8-496E-9823-2491D09DA043}
AppName=Cecilia5
-AppVersion=5.2.0
+AppVersion=5.2.1
AppPublisher=iACT.umontreal.ca
AppPublisherURL=http://ajaxsoundstudio.com/software/cecilia/
AppSupportURL=https://github.com/belangeo/cecilia5
@@ -17,7 +17,7 @@ DisableDirPage=yes
DefaultGroupName=Cecilia5
AllowNoIcons=yes
LicenseFile=C:\Users\olivier\git\cecilia5\Cecilia5_Win\Resources\COPYING.txt
-OutputBaseFilename=Cecilia5_5.2.0_setup
+OutputBaseFilename=Cecilia5_5.2.1_setup
Compression=lzma
SolidCompression=yes
ChangesAssociations=yes
diff --git a/whatsnew.md b/whatsnew.md
index 3de3c1b..0f5e63e 100644
--- a/whatsnew.md
+++ b/whatsnew.md
@@ -138,3 +138,4 @@ Version 5.1.0:
Version 5.2.0:
+Version 5.2.1:
--
cecilia packaging
More information about the pkg-multimedia-commits
mailing list