Пример #1
0
def cboxLoop(eventLoop):
    cbox.call_on_idle()
    assert eventLoop.is_running()

    #it is not that simple. status = "[Running]" if cbox.Transport.status().playing else "[Stopped]"
    if cbox.Transport.status().playing == 1:
        status = "[Running]"
    elif cbox.Transport.status().playing == 0:
        status = "[Stopped]"
    elif cbox.Transport.status().playing == 2:
        status = "[Stopping]"
    elif cbox.Transport.status().playing is None:
        status = "[Uninitialized]"
    else:
        raise ValueError("Unknown playback status: {}".format(cbox.Transport.status().playing))

    stdout.write("                                           \r") #it is a hack but it cleans the line from old artefacts
    stdout.write('{}: {}\r'.format(status, cbox.Transport.status().pos_ppqn))
    stdout.flush()
    eventLoop.call_later(0.1, cboxLoop, eventLoop) #100ms delay
Пример #2
0
def cboxLoop(eventLoop):
    cbox.call_on_idle()
    assert eventLoop.is_running()

    #it is not that simple. status = "[Running]" if cbox.Transport.status().playing else "[Stopped]"
    if cbox.Transport.status().playing == 1:
        status = "[Running]"
    elif cbox.Transport.status().playing == 0:
        status = "[Stopped]"
    elif cbox.Transport.status().playing == 2:
        status = "[Stopping]"
    elif cbox.Transport.status().playing is None:
        status = "[Uninitialized]"
    else:
        raise ValueError("Unknown playback status: {}".format(
            cbox.Transport.status().playing))

    stdout.write("                                           \r"
                 )  #it is a hack but it cleans the line from old artefacts
    stdout.write('{}: {}\r'.format(status, cbox.Transport.status().pos_ppqn))
    stdout.flush()
    eventLoop.call_later(0.1, cboxLoop, eventLoop)  #100ms delay
Пример #3
0
client_name = status.client_name
print ("Client type: %s" % status.client_type)
print ("Client name: %s" % client_name)
print ("Audio inputs: %d, outputs: %d" % (status.audio_inputs, status.audio_outputs))
print ("Period: %d frames" % (status.buffer_size))
print ("Sample rate: %d frames/sec" % (status.sample_rate))
print ("Output resolution: %d bits/sample" % (status.output_resolution))
print ("MIDI input devices: %s" % (status.midi_input))
#cbox.JackIO.create_midi_output('drums', 'system:midi_playback_1')

scene = Document.get_scene()
scene.clear()
instrument = scene.add_new_instrument_layer("test_sampler", "sampler").get_instrument()
pgm_no = instrument.engine.get_unused_program()
pgm = instrument.engine.load_patch_from_file(pgm_no, 'synthbass.sfz', 'SynthBass')
instrument.engine.set_patch(1, pgm_no)
instrument.engine.set_patch(10, pgm_no)

song = Document.get_song()
track = song.add_track()
pattern = song.load_drum_pattern("pat1")
track.add_clip(0, 0, pattern.status().loop_end, pattern)
song.set_loop(0, pattern.status().loop_end)
song.update_playback()
cbox.Transport.play()

print("Ready!")

while True:
    cbox.call_on_idle(cmd_dumper)
Пример #4
0
cbox.init_engine()
cbox.start_audio(cmd_dumper)

global Document
Document = cbox.Document

scene = Document.get_scene()
scene.clear()
instrument = scene.add_new_instrument_layer("test_sampler",
                                            "sampler").get_instrument()
pgm_no = instrument.engine.get_unused_program()
pgm = instrument.engine.load_patch_from_file(pgm_no, 'synthbass.sfz',
                                             'SynthBass')
instrument.engine.set_patch(1, pgm_no)
print(instrument.engine.get_patches())
print(instrument.get_output_slot(0))
print(instrument.get_output_slot(0).status())
instrument.get_output_slot(0).set_insert_engine("reverb")
print(instrument.get_output_slot(0).status())
instrument.get_output_slot(0).engine.cmd("/wet_amt", None, 1.0)
for i in pgm.get_groups():
    print("<group>", i.as_string())
    for j in i.get_children():
        print("<region>", j.as_string())

print("Ready!")

while True:
    cbox.call_on_idle(cmd_dumper)
Пример #5
0
def cboxLoop(loop):
    cbox.call_on_idle()
    status = "[Running]" if cbox.Transport.status().playing else "[Stopped]"
    stdout.write('{}: {}\r'.format(status, cbox.Transport.status().pos_ppqn))
    stdout.flush()
    loop.call_later(0.1, cboxLoop, loop) #100ms delay