def __init__(self, minval=0., maxval=1., dur=10, table=None, loop=False): if table is None: table = rtcmix.maketable('line',1000, 0,0, 1,1) self.min=minval self.max=maxval self.dur=dur self.table=table self.start_time=schedule.now() self.loop=loop
def jointables(*tables): """joins any number of tables into a resulting 1000-point table. Takes any number of arguments. Each arg can be either a table handle, or a tuple as follows: (table, scale) where scale is the relative size of this table in the sum. Otherwise, scale defaults to 1.""" points = [] # we really don't want to log all these samptables: printing_was_on = rtcmix.is_print_on rtcmix.print_off() scalesum = 0 tables_and_scales = [] for t in tables: if type(t) is tuple: scale=t[1] table=t[0] else: scale=1 table=t scalesum += scale tables_and_scales.append((table, scale)) for table, scale in tables_and_scales: allotted_points = int(1000 * scale/float(scalesum)) tlen = rtcmix.tablelen(table) poll_period = tlen/allotted_points for i in xrange(allotted_points): points.append(rtcmix.samptable(table, i * poll_period)) #turn printing back on if it was off if printing_was_on: rtcmix.print_on() return rtcmix.maketable('literal', len(points), points)