aboutsummaryrefslogtreecommitdiff
path: root/example/supertest.py
blob: 5c1a31728f7e1e2b7ace424f28133fdd7643159d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env python


import pyext,os,traceback
import supercollider

sc=supercollider


class supertest(pyext._class):
    _inlets=1
    _outlets=0

    def start_1(self,arg):
        try:
            self.buffer=sc.BufferRead(arg)
            self.bsynth=sc.Synth("fileplayer",["bufnum",self.buffer.id])
        except:
            traceback.print_exc()

    def stop_1(self):
        try:
            del self.bsynth
        except:
            traceback.print_exc()

    def pan_1(self,val):
        try:
            self.bsynth.set("pan",val)
        except:
            traceback.print_exc()

    def rate_1(self,rate):
        try:
            self.bsynth.set("rate",rate)
        except:
            traceback.print_exc()
                
    def __init__(self):
        try:
            server=sc.localServer
            server.dumpOSC(3)
            server.evalSynth("fileplayer");
        except:
            traceback.print_exc()