File: test.py

package info (click to toggle)
sndobj 2.6.7%2Bds1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, bullseye
  • size: 4,904 kB
  • sloc: ansic: 55,663; cpp: 21,625; python: 391; makefile: 130; java: 22; sh: 21
file content (48 lines) | stat: -rw-r--r-- 783 bytes parent folder | download | duplicates (5)
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
48
from sndobj import *
import time
import sys

class test:
    def get(self):
       return self.i
    def set(self,val):
        self.i = val
    def __init__(self,val):
       self.i = val

def callb(data):
    data[0].SetFreq(data[1].get(),data[2])
    data[1].set(data[1].get()+1)

def callc(data):
    data[0].SetFreq(data[1].get(),data[2])
    data[1].set(data[1].get()-1)

t = SndRTThread()

harm = HarmTable(10000,1,1)
osc = Oscili(harm, 440, 10000)
mod = Oscili(harm, 2, 5)
osc.SetFreq(440, mod)
tes = test(100)
dat = (osc, tes, mod)

t.SetProcessCallback(callb, dat)
t.AddObj(mod)
t.AddOutput(1, osc)

t.ProcOn()
time.sleep(2)
t.LimitVectorSize(64)
tes.set(100)

time.sleep(2)
t.SetProcessCallback(callc,dat)
tes.set(1000)
t.RestoreVectorSize()
time.sleep(2)
t.ProcOff()