102
103
return ['ctlnumber', 'minscale', 'maxscale', 'channel', 'mul', 'add']
104
105
def out(self, chnl=0, inc=1, dur=0, delay=0):
106
return self.play(dur, delay)
107
108
def setCtlNumber(self, x):
269
273
def out(self, chnl=0, inc=1, dur=0, delay=0):
274
return self.play(dur, delay)
288
def setFunction(self, x):
290
Replace the `function` attribute.
295
new `function` attribute.
299
x, lmax = convertArgsToLists(x)
300
[obj.setFunction(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
302
def setToprint(self, x):
304
Replace the `toprint` attribute.
309
new `toprint` attribute.
313
x, lmax = convertArgsToLists(x)
314
[obj.setToprint(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
316
def ctrl(self, map_list=None, title=None, wxnoserver=False):
318
PyoObject.ctrl(self, map_list, title, wxnoserver)
321
def function(self): return self._function
323
def function(self, x): self.setFunction(x)
325
def toprint(self): return self._toprint
327
def toprint(self, x): self.setToprint(x)
329
class CtlScan2(PyoObject):
331
Scan the Midi channel and controller number in input.
333
Scan the Midi channel and controller number in input and send them
334
to a standard python `function`. Useful to implement a MidiLearn
337
Parentclass: PyoObject
341
function : Python function
342
Function to be called. The function must be declared
343
with two arguments, one for the controller number and
344
one for the midi channel. Ex.:
345
def ctl_scan(ctlnum, midichnl):
346
print ctlnum, midichnl
347
toprint : boolean, optional
348
If True, controller number and value will be print to
353
setFunction(x) : Replace the `function` attribute.
354
setToprint(x) : Replace the `toprint` attribute.
358
function : Python function. Function to be called.
359
toprint : boolean. If True, print values to the console.
363
The out() method is bypassed. CtlScan2's signal can not be sent
369
>>> s.setMidiInputDevice(0) # enter your device number (see pm_list_devices())
372
>>> def ctl_scan(ctlnum, midichnl):
373
... print ctlnum, midichnl
374
>>> a = CtlScan2(ctl_scan)
377
def __init__(self, function, toprint=True):
378
PyoObject.__init__(self)
379
if not callable(function):
380
print >> sys.stderr, 'TypeError: "function" argument of %s must be callable.\n' % self.__class__.__name__
382
self._function = function
383
self._toprint = toprint
384
self._base_objs = [CtlScan2_base(self._function, self._toprint)]
389
def out(self, chnl=0, inc=1, dur=0, delay=0):
390
return self.play(dur, delay)
272
392
def setMul(self, x):
405
525
def __dir__(self):
406
526
return ['channel', 'mul', 'add']
409
if self._pitch_dummy:
410
[obj.deleteStream() for obj in self._pitch_dummy]
411
if self._velocity_dummy:
412
[obj.deleteStream() for obj in self._velocity_dummy]
413
self._pitch_dummy = []
414
self._velocity_dummy = []
415
for obj in self._base_objs:
418
self._base_handler.deleteStream()
419
del self._base_handler
421
528
def __getitem__(self, str):
422
529
if str == 'pitch':
423
530
self._pitch_dummy.append(Dummy([self._base_objs[i*2] for i in range(self._poly)]))
483
590
def play(self, dur=0, delay=0):
484
591
self._base_handler.play()
485
dur, delay, lmax = convertArgsToLists(dur, delay)
486
self._base_objs = [obj.play(wrap(dur,i), wrap(delay,i)) for i, obj in enumerate(self._base_objs)]
592
return PyoObject.play(self, dur, delay)
489
594
def out(self, chnl=0, inc=1, dur=0, delay=0):
595
return self.play(dur, delay)
493
598
self._base_handler.stop()
494
[obj.stop() for obj in self._base_objs]
599
return PyoObject.stop(self)
497
601
def ctrl(self, map_list=None, title=None, wxnoserver=False):
498
602
self._map_list = []
924
1028
return ['input', 'attack', 'decay', 'sustain', 'release', 'mul', 'add']
926
1030
def out(self, chnl=0, inc=1, dur=0, delay=0):
1031
return self.play(dur, delay)
929
1033
def setInput(self, x, fadetime=0.05):
1123
1227
return ['input', 'delay', 'attack', 'decay', 'sustain', 'release', 'mul', 'add']
1125
1229
def out(self, chnl=0, inc=1, dur=0, delay=0):
1230
return self.play(dur, delay)
1128
1232
def setInput(self, x, fadetime=0.05):