~ubuntu-branches/ubuntu/quantal/python-pyo/quantal

« back to all changes in this revision

Viewing changes to pyolib/utils.py

  • Committer: Package Import Robot
  • Author(s): Tiago Bortoletto Vaz
  • Date: 2012-07-03 23:45:41 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20120703234541-jh5jg00lvljnwq8m
Tags: 0.6.2-1
New upstream release.

Show diffs side-by-side

added added

removed removed

Lines of Context:
188
188
        [obj.setMessage(wrap(x,i)) for i, obj in enumerate(self._base_objs)]
189
189
 
190
190
    def out(self, chnl=0, inc=1, dur=0, delay=0):
191
 
        return self
 
191
        return self.play(dur, delay)
192
192
 
193
193
    def ctrl(self, map_list=None, title=None, wxnoserver=False):
194
194
        self._map_list = []
274
274
    """
275
275
    def __init__(self, input, choice, scale=0, mul=1, add=0):
276
276
        PyoObject.__init__(self)
 
277
        if type(choice) != ListType:
 
278
            print >> sys.stderr, 'TypeError: "choice" argument of %s must be a list.\n' % self.__class__.__name__
 
279
            exit()
277
280
        self._input = input
278
281
        self._choice = choice
279
282
        self._scale = scale
281
284
        self._add = add
282
285
        self._in_fader = InputFader(input)
283
286
        in_fader, scale, mul, add, lmax = convertArgsToLists(self._in_fader, scale, mul, add)
284
 
        self._base_objs = [Snap_base(wrap(in_fader,i), choice, wrap(scale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
 
287
        if type(choice[0]) != ListType:
 
288
            self._base_objs = [Snap_base(wrap(in_fader,i), choice, wrap(scale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
 
289
        else:
 
290
            choicelen = len(choice)
 
291
            lmax = max(choicelen, lmax)
 
292
            self._base_objs = [Snap_base(wrap(in_fader,i), wrap(choice,i), wrap(scale,i), wrap(mul,i), wrap(add,i)) for i in range(lmax)]
285
293
 
286
294
    def __dir__(self):
287
295
        return ['input', 'choice', 'scale', 'mul', 'add']
658
666
        return ['input', 'comp', 'mode', 'mul', 'add']
659
667
 
660
668
    def out(self, chnl=0, inc=1, dur=0, delay=0):
661
 
        return self
 
669
        return self.play(dur, delay)
662
670
 
663
671
    def setInput(self, x, fadetime=0.05):
664
672
        """
811
819
        self._base_objs = [Record_base(self._input.getBaseObjects(), filename, chnls, fileformat, sampletype, buffering)]
812
820
 
813
821
    def out(self, chnl=0, inc=1, dur=0, delay=0):
814
 
        return self
 
822
        return self.play(dur, delay)
815
823
 
816
824
    def __dir__(self):
817
825
        return []
970
978
        self._base_objs = [ControlRec_base(wrap(in_fader,i), rate, dur) for i in range(lmax)]
971
979
 
972
980
    def out(self, chnl=0, inc=1, dur=0, delay=0):
973
 
        return self
 
981
        return self.play(dur, delay)
974
982
 
975
983
    def __dir__(self):
976
984
        return []
1078
1086
        return ['rate', 'loop', 'interp', 'mul', 'add']
1079
1087
 
1080
1088
    def out(self, chnl=0, inc=1, dur=0, delay=0):
1081
 
        return self
 
1089
        return self.play(dur, delay)
1082
1090
 
1083
1091
    def setRate(self, x):
1084
1092
        """
1213
1221
        self._base_objs = [NoteinRec_base(wrap(in_pitch,i), wrap(in_velocity,i)) for i in range(lmax)]
1214
1222
 
1215
1223
    def out(self, chnl=0, inc=1, dur=0, delay=0):
1216
 
        return self
 
1224
        return self.play(dur, delay)
1217
1225
 
1218
1226
    def __dir__(self):
1219
1227
        return []
1314
1322
    def __dir__(self):
1315
1323
        return ['loop', 'mul', 'add']
1316
1324
 
1317
 
    def __del__(self):
1318
 
        if self._pitch_dummy:
1319
 
            [obj.deleteStream() for obj in self._pitch_dummy]
1320
 
        if self._velocity_dummy:
1321
 
            [obj.deleteStream() for obj in self._velocity_dummy]
1322
 
        self._pitch_dummy = []
1323
 
        self._velocity_dummy = []
1324
 
        for obj in self._base_objs:
1325
 
            obj.deleteStream()
1326
 
            del obj
1327
 
        del self._trig_objs
1328
 
 
1329
1325
    def __getitem__(self, str):
1330
1326
        if str == 'trig':
1331
1327
            return self._trig_objs
1363
1359
            return [obj._getStream().getValue() for obj in self.__getitem__(identifier).getBaseObjects()]
1364
1360
 
1365
1361
    def out(self, chnl=0, inc=1, dur=0, delay=0):
1366
 
        return self
 
1362
        return self.play(dur, delay)
1367
1363
 
1368
1364
    def setLoop(self, x):
1369
1365
        """