Make prefetch-piped samples stop correctly.
[calfbox.git] / sampler_api_example2.py
blob8e3c201dc23980836bf2be236a85eca3f38b1b24
1 from calfbox import cbox
3 def cmd_dumper(cmd, fb, args):
4 print ("%s(%s)" % (cmd, ",".join(list(map(repr,args)))))
6 cbox.init_engine()
7 cbox.start_audio(cmd_dumper)
9 global Document
10 Document = cbox.Document
12 scene = Document.get_scene()
13 scene.clear()
14 instrument = scene.add_new_instrument_layer("test_sampler", "sampler").get_instrument()
15 pgm_no = instrument.engine.get_unused_program()
16 pgm = instrument.engine.load_patch_from_file(pgm_no, 'synthbass.sfz', 'SynthBass')
17 instrument.engine.set_patch(1, pgm_no)
18 print (instrument.engine.get_patches())
19 print (instrument.get_output_slot(0))
20 print (instrument.get_output_slot(0).status())
21 instrument.get_output_slot(0).set_insert_engine("reverb")
22 print (instrument.get_output_slot(0).status())
23 instrument.get_output_slot(0).engine.cmd("/wet_amt", None, 1.0)
24 for i in pgm.get_groups():
25 print ("<group>", i.as_string())
26 for j in i.get_children():
27 print ("<region>", j.as_string())
29 print("Ready!")
31 while True:
32 cbox.call_on_idle(cmd_dumper)