Ejemplo n.º 1
0
 def act_jack(self):
     
      #jack client for playing
     self.jclientp = jack.Client('osc-player' + str(id(self)))  #new client necessary for every class member?
     self.jclientp.activate();
     # jack client for recording
     self.jclientr = jack.Client('osc-recorder' + str(id(self)))  #new client necessary for every class member?
     self.jclientr.activate();
Ejemplo n.º 2
0
    def client_reset(self):
        # Jack setup
        self.client = jack.Client('JackAudioSink')
        self.client.blocksize = self.block_size
        self.tmp_buf = np.array([0.0] * self.block_size)
        self.tmp_buf_pos = 0
        self.is_active = False

        # Debug
        self.start_time = 0
        self.sample_count = 0
        self.xrun_count = 0

        self.port = self.client.outports.register('audio_out')

        # Make sure sample rate works and set multiplier
        if not self.allow_fractional_resample:
            if self.client.samplerate % self.orig_sample_rate != 0:
                raise (ValueError(
                    "OS sample rate " + str(self.client.samplerate) +
                    " must be evenly divisible by given sample rate " +
                    str(self.orig_sample_rate)))
            self.sample_multiplier = int(self.client.samplerate /
                                         self.orig_sample_rate)
        else:
            self.sample_multiplier = float(self.client.samplerate /
                                           self.orig_sample_rate)
        self.resampler = samplerate.Resampler('sinc_best', channels=1)

        # Callback setup
        self.client.set_process_callback(self.process)
        self.client.set_xrun_callback(self.xrun)
Ejemplo n.º 3
0
def list_jack_ports(pattern='',
                    is_audio=False,
                    is_midi=False,
                    is_input=False,
                    is_output=False,
                    is_physical=False,
                    can_monitor=False,
                    is_terminal=False):
    """list of Port/MidiPort/OwnPort/OwnMidiPort
    All ports that satisfy the given conditions."""
    try:
        client = jack.Client(args.client_name)
    except jack.JackError as exc:
        return "Could not create JACK client: {}".format(exc)

    try:
        ports = client.get_ports(pattern, is_audio, is_midi, is_input,
                                 is_output, is_physical, can_monitor,
                                 is_terminal)

        port_names = []
        for port in ports:
            port_names.append(port.name)
        json.dump(port_names, sys.stdout, indent=2)
    except jack.JackError as exc:
        return "Error trying to get port: {}".format(exc)
Ejemplo n.º 4
0
def loop():
    client = jack.Client('beamform')
    client.register_port('out_L', jack.IsOutput)
    client.register_port('out_R', jack.IsOutput)
    client.register_port('in_L', jack.IsInput)
    client.register_port('in_R', jack.IsInput)
    sample_rate = client.get_sample_rate()
    seconds = 1.0 / 8
    sample_count = sample_rate / seconds
    buffer_size = client.get_buffer_size()
    loop = numpy.zeros((2, buffer_size), 'f')
    client.activate()
    client.connect('system:capture_1', 'beamform:in_L')
    client.connect('system:capture_2', 'beamform:in_R')
    client.connect('beamform:out_L', 'system:playback_1')
    client.connect('beamform:out_R', 'system:playback_2')
    try:
        while True:
            try:
                client.process(loop, loop)
            except jack.InputSyncError:
                print('Input sync.')
            except jack.OutputSyncError:
                print('Output sync.')
    except Exception:
        print("hi")
        client.deactivate()
        client.detach()
Ejemplo n.º 5
0
def init(etc_object, AOUT_NORNS):

    global aout_norns, inp, client, etc, trig_this_time, trig_last_time, sin
    aout_norns = AOUT_NORNS
    etc = etc_object

    if aout_norns:
        # set up jack for sound in
        client = jack.Client("fates_jack_client", servername="default")
        client.inports.register('input_1')
        client.inports.register('input_2')
        client.blocksize = 512
        client.activate()
        client.connect('softcut:output_1', 'fates_jack_client:input_1')
        client.connect('softcut:output_2', 'fates_jack_client:input_2')
        time.sleep(1)
        inp = [
            client.get_port_by_name('fates_jack_client:input_1'),
            client.get_port_by_name('fates_jack_client:input_2')
        ]
    else:
        #setup alsa for sound in
        inp = alsaaudio.PCM(alsaaudio.PCM_CAPTURE, alsaaudio.PCM_NONBLOCK)
        inp.setchannels(2)
        inp.setrate(
            44100)  # Original value of 11025 was giving error.. OR 44100
        inp.setformat(alsaaudio.PCM_FORMAT_S16_LE)
        inp.setperiodsize(1024)  # OR 1024

    trig_last_time = time.time()
    trig_this_time = time.time()
    for i in range(0, 100):
        sin[i] = int(math.sin(2 * 3.1459 * i / 100) * 32700)
Ejemplo n.º 6
0
 async def run(self):
     self.client = jack.Client(self.clientname, no_start_server=True)
     self.blocksize = self.client.blocksize
     self.client.set_process_callback(self.make_proccess())
     self.client.activate()
     outports = []
     qs = []
     for i, in_set in enumerate(self.ins):
         print(in_set)
         if in_set:
             outport = self.client.outports.register(self.sound_id + "_" +
                                                     str(i))
             inports = self.client.get_ports(is_input=True, is_audio=True)
             for in_no in in_set:
                 outport.connect(inports[in_no])
             outports.append(outport)
             qs.append(janus.Queue(maxsize=20))
         else:
             outports.append(None)
             qs.append(None)
     self.sound = sound(self.filename,
                        qs,
                        outports,
                        sound_id=self.sound_id,
                        loops=self.loops,
                        volume=self.volume,
                        blocksize=self.blocksize,
                        dtype='float32',
                        always_2d=True,
                        fill_value=0,
                        fadein=self.fadein,
                        fadetime=self.fadetime)
     async for p in self.sound.run():
         pass
     print("finished")
def jackConns(pattern='', InOut='all'):
    """
        Select ports by name and/or by capture/playback.
        Returns the selected ports connectios as string triplets:
            [ (A_port, B_port, direction), ... ]
    """
    triplets = []
    jc = jack.Client('tmp')

    if InOut == 'out':
        A_ports = jc.get_ports(name_pattern=pattern, is_output=True)

    elif InOut == 'in':
        A_ports = jc.get_ports(name_pattern=pattern, is_input=True)

    else:
        A_ports = jc.get_ports(name_pattern=pattern)

    for A_port in A_ports:
        B_ports = jc.get_all_connections(A_port)
        for B_port in B_ports:
            if A_port.is_input:
                direction = '<'
            else:
                direction = '>'
            triplets.append((A_port.name, B_port.name, direction))

    jc.close()

    return triplets
Ejemplo n.º 8
0
def do_change_input(input_name, in_ports, out_ports, resampled=False):
    """ 'in_ports':   list [L,R] of jack capture ports of chosen source
        'out_ports':  list of ports in 'audio_ports' variable
                        depends on use of brutefir/ecasound
    """
    monitor_ports = gc.config['jack_monitors']

    # switch...
    try:
        tmp = jack.Client('tmp')
        unplug_sources_of(jack_client=tmp, ports=out_ports)
        for i in range(len(in_ports)):
            # ...audio inputs
            try:
                tmp.connect(in_ports[i], out_ports[i])
            except:
                print(f'error connecting {in_ports[i]} <--> {out_ports[i]}')
           # ...monitor inputs
            try:
                if monitor_ports:
                    for fakepair in monitor_ports:
                        tmp.connect(in_ports[i], fakepair.split()[i])
            except:
                print('error connecting monitors')
        tmp.close()
    except:
        # on exception returns False
        print(f'error changing to input "{input_name}"')
        tmp.close()
        return False

    return True
Ejemplo n.º 9
0
def getInfo() -> Optional[JackInfo]:
    """
    Get info about a running jack server

    Returns:
        a JackInfo
    """
    # assumes that jack is running
    if not JACK_INSTALLED:
        return None
    try:
        c = jack.Client("jacktools.getInfo", no_start_server=True)
    except jack.JackOpenError:
        return None
    inports = c.get_ports(is_audio=True, is_physical=True, is_input=True)
    outports = c.get_ports(is_audio=True, is_physical=True, is_output=True)
    systemOutput = _buildClients(inports)[0]
    systemInput = _buildClients(outports)[0]
    onPipewire = linuxaudio.isPipewireRunning()
    return JackInfo(running=True,
                    samplerate=c.samplerate,
                    blocksize=c.blocksize,
                    numOutChannelsPhysical=len(inports),
                    numInChannelsPhysical=len(outports),
                    systemInput=systemOutput,
                    systemOutput=systemInput,
                    onPipewire=onPipewire)
Ejemplo n.º 10
0
def clear_port(port, client_name="jack_client", **kwarg):
    """ Removes all incoming/outgoing connections from/to a port

    Arguments:
        port: (string) -- Port name to clear.

    Raises:
        ConnectionError: "If JACK client could not connect."
        ValueError: "If no port is found, or the connection was unsuccesfull"
    """

    try:
        client = jack.Client(client_name)
    except jack.JackError as exc:
        raise ConnectionError("Could not create JACK client: {}".format(exc))

    src_ports_names = port.split(',')
    for src_port_name in src_ports_names:
        try:
            jack_port = client.get_port_by_name(src_port_name)
            jack_ports = client.get_all_connections(jack_port)

            for cport in jack_ports:
                if jack_port.is_output:
                    connect_ports(
                        src_port_name, cport.name, client_name, True)
                elif jack_port.is_input:
                    connect_ports(
                        cport.name, src_port_name, client_name, True)

        except jack.JackError as exc2:
            raise ValueError("Could not clear port: {}".format(exc2))
Ejemplo n.º 11
0
    def __init__(self):
        self.client = jack.Client('LoopTime')
        self.samplerate = self.client.samplerate
        self.blocksize = self.client.blocksize
        self.silence = np.zeros(self.blocksize, dtype=np.float32)

        # Audio Ports
        self.in_ports = [
            self.client.inports.register(f'channel_{i+1}_in') for i in range(8)
        ]
        self.out_ports = [
            self.client.outports.register(f'channel_{i+1}_out')
            for i in range(8)
        ]
        self.metronome_port = self.client.outports.register('metronome')

        # MIDI Ports
        self.midi_in_ports = [
            self.client.midi_inports.register(f'channel_{i+1}_midi_in')
            for i in range(8)
        ]
        self.midi_out_ports = [
            self.client.midi_outports.register(f'channel_{i+1}_midi_out')
            for i in range(8)
        ]

        self.client.set_process_callback(jack_process_callback)
        self.client.set_shutdown_callback(jack_shutdown_callback)
        self.connected = True
Ejemplo n.º 12
0
    def __init__(self, pipeline):
        super().__init__()

        if JackSink._ControlClient is None:
            JackSink._ControlClient = jack.Client('LinuxShowPlayer_Control')

        self.pipeline = pipeline
        self.audio_resample = Gst.ElementFactory.make('audioresample')
        self.jack_sink = Gst.ElementFactory.make('jackaudiosink', 'sink')

        self._client_id = JackSink.__register_client_id()
        self._client_name = JackSink.CLIENT_NAME + '-' + str(self._client_id)
        self.jack_sink.set_property('client-name', self._client_name)
        self.jack_sink.set_property('connect', JackSink.CONNECT_MODE)

        self.pipeline.add(self.audio_resample)
        self.pipeline.add(self.jack_sink)

        self.audio_resample.link(self.jack_sink)

        self.connections = self.default_connections(JackSink._ControlClient)
        self.changed('connections').connect(self.__prepare_connections)

        bus = self.pipeline.get_bus()
        bus.add_signal_watch()
        self._handler = bus.connect('message', self.__on_message)
Ejemplo n.º 13
0
    def __init__(self, name='jack_client'):
        """
        Args:
            name:
        """
        super(JackClient, self).__init__()

        # TODO: If global client variable is set, just return that one.

        self.name = name
        #self.pipe = pipe
        self.q = mp.Queue()
        self.q_lock = mp.Lock()

        self.play_evt = mp.Event()
        self.stop_evt = mp.Event()
        self.quit_evt = mp.Event()

        # we make a client that dies now so we can stash the fs and etc.
        self.client = jack.Client(self.name)
        self.blocksize = self.client.blocksize
        self.fs = self.client.samplerate
        self.zero_arr = np.zeros((self.blocksize,1),dtype='float32')

        # store a reference to us and our values in the module
        globals()['SERVER'] = self
        globals()['FS'] = copy(self.fs)
        globals()['BLOCKSIZE'] = copy(self.blocksize)
        globals()['QUEUE'] = self.q
        globals()['Q_LOCK'] = self.q_lock
        globals()['PLAY'] = self.play_evt
        globals()['STOP'] = self.stop_evt
Ejemplo n.º 14
0
def jack_connect():
    """ Within JACK, connect fluidsynth ports to system playback ports (enabling sound from speakers) """
    client = jack.Client("MyGreatClient")

    # Identify the system and fluidsynth audio ports
    sysports = client.get_ports('system*',
                                is_audio=True,
                                is_output=False,
                                is_physical=True)
    fluidports = client.get_ports('fluidsynth*', is_audio=True, is_output=True)

    if len(sysports) < 2:
        raise Exception(
            "Found fewer than two system audio playback ports. Should have found one left channel and one right channel."
        )
    if len(fluidports) < 2:
        raise Exception(
            "Found fewer than two fluidsynth audio output ports. Should have found one left channel and one right channel."
        )

    # Connect the fluidsynth ports to the system playback ports
    client.connect(fluidports[0], sysports[0])  # connect left port
    client.connect(fluidports[1], sysports[1])  # connect right port

    client.close()
Ejemplo n.º 15
0
def _test_multiprocessing():
    import jack

    client = jack.Client(name="PICKLE_TEST")
    print("--- CLIENT CREATED ---\n")

    # import dill
    #
    # print(dill.detect.badtypes(client, depth=1).keys())
    # print("--- DILL BADTYPES ---\n")
    #
    # dill.detect.trace(True)
    # print(dill.pickles(client))
    # print("--- DILL TRACED ---\n")

    import pickle

    # This fails since pickling is not possible for `jack.Client`, see `_multiprocessing`
    print(pickle.dumps(obj=client, protocol=pickle.HIGHEST_PROTOCOL))
    print("--- PICKLE DUMPED ---\n")

    client.activate()
    client.inports.register(f"input_{1}")
    client.outports.register(f"output_{1}")
    print("--- CLIENT ACTIVATED ---\n")

    # This fails since pickling is not possible for `jack.Port`, see `_multiprocessing`
    print(pickle.dumps(obj=client, protocol=pickle.HIGHEST_PROTOCOL))
    print("--- PICKLE DUMPED ---\n")

    client.deactivate()
    client.close()
    print("--- CLIENT CLOSED ---\n")
Ejemplo n.º 16
0
def jack_namespace():

    client = jack.Client("MIDI Chord Stacker")

    inport = client.midi_inports.register("in")
    outport = client.midi_outports.register("out")

    NOTEON = 9
    NOTEOFF = 8

    @client.set_process_callback
    def process(frames):
        outport.clear_buffer()
        for offset, data in inport.incoming_midi_events():
            outport.write_midi_event(offset, data)  # passthrough
            if len(data) == 3:  # this is probably a note event
                event, pitch, vel = struct.unpack("3B", data)
                if event >> 4 in (NOTEON, NOTEOFF):  # thanks python!
                    for int in chords[chord.get()]:
                        outport.write_midi_event(offset,
                                                 (event, pitch + int, vel))
                else:
                    outport.write_midi_event(offset, data)
            else:
                outport.write_midi_event(offset, data)

    client.activate()
    input()
Ejemplo n.º 17
0
    def __init__(self, no_start_server=True, name=None):
        if name is None:
            name = self.__class__.__name__

        self.client = jack.Client(name=name, no_start_server=no_start_server)

        self.xrun_callback = lambda delay:...
        self.shutdown_callback = lambda status, reason:...

        if self.client.status.server_started:
            logging.info('JACK server was started')
        else:
            logging.info('JACK server was already running')

        if self.client.status.name_not_unique:
            logging.info('Unique client name generated {}'.format(
                self.client.name))

        @self.client.set_xrun_callback
        def xrun(delay):
            self.xrun_callback(delay)

        @self.client.set_shutdown_callback
        def shutdown(status, reason):
            self.shutdown_callback(status, reason)

        self.client.activate()
Ejemplo n.º 18
0
    def start_server(self, ip, po, op):

        self.outpath = op
        self.port = po
        self.ip = ip

        if self.timer == 'jack':
            self.jack_client = jack.Client('osc-recorder')
            self.jack_client.activate()

        # client.inports.register('input_1')

        if not os.path.exists(self.outpath):
            os.makedirs(self.outpath)

        self.dispatcher = dispatcher.Dispatcher()

        self.dispatcher.map("/*", self.generic_handler)

        self.dispatcher.map("/timer", self.external_time_handler)

        self.server = osc_server.ThreadingOSCUDPServer((self.ip, self.port),
                                                       self.dispatcher)

        print("Generic OSC recorder serving on {}".format(
            self.server.server_address))

        print("Writing files to " + self.outpath)

        #self.server.server_activate()

        self.server.serve_forever()
def run_pypatcher_voice_count(number_of_voices):
    jackClient = jack.Client('TestAutoPatcher')
    dry_run = True

    jacktrip_clients = [
        '..ffff.192.168.0.1',
        '..ffff.192.168.0.2',
        '..ffff.192.168.0.3',
        '..ffff.192.168.0.4',
        '..ffff.192.168.0.5',
        '..ffff.192.168.0.6',
        '..ffff.192.168.0.7',
        '..ffff.192.168.0.8',
        '..ffff.192.168.0.9',
        '..ffff.192.168.0.10',
        '..ffff.192.168.0.11',
        '..ffff.192.168.0.12',
    ]
    jacktrip_clients = jacktrip_clients[0:number_of_voices]

    jacktrip_stereo = jacktrip_clients[0:1]
    jacktrip_clients_stereo = list(
        map(lambda x: x in jacktrip_stereo, jacktrip_clients))

    # TODO: hacky way to use pytest - we know this assertion will fail, but at the moment
    # we can just inspect the stdout
    assert jacktrip_pypatcher.autopatch(jackClient, dry_run, jacktrip_clients,
                                        jacktrip_clients_stereo) == True
Ejemplo n.º 20
0
    def start(self, params):
        """Start JACK with relavent parameters"""

        Popen(self.generate_command(params), stdout=PIPE, stderr=PIPE)
        time.sleep(2)
        self.jackClient = jack.Client('noisebox',  no_start_server=True)
        self.jackClient.activate()
Ejemplo n.º 21
0
    def __init__(self):
        # jack client
        self.client = jack.Client("palette", no_start_server=True)

        # interface
        entities = [
            Entity.KEYBOARD, Entity.SAMPLER, Entity.DRUM_MACHINE, Entity.PUSH
        ]
        self.display = Interface(entities)

        # metronome
        self.metronome = Metronome(self.display, self.client)

        # backend
        constructors = [Keyboard, Sampler, DrumMachine, Push]
        self.be = Backend(self.client, self.metronome, constructors)

        # misc
        self.pressed_keys = []
        self.fifo = open("palette.pipe", mode="rt")
        self.current_inst_number = 0

        # let's go
        self.client.activate()
        self.display.paint_pad(0)
        self.metronome.sync_transport()
Ejemplo n.º 22
0
    def __init__(self, client_name='JackMCS', inport_name='input', outport_name='output', verbose=False):
        self.verbose = verbose

        self.verbosity('Starting JackMCS client as {}...'.format(client_name))
        self.client_name = client_name
        self.client = jack.Client(client_name)

        self.verbosity('Registering ports...')
        self.outport_name = outport_name
        self.outport = self.client.midi_outports.register(outport_name)

        self.inport_name = inport_name
        self.inport = self.client.midi_inports.register(inport_name)

        self._last_recv = None
        self._realtime_recv = None

        self._msg = None
        self._ch = 0

        self.time_code_display = Timecode_Display('', self, self.verbose)

        self.verbosity('Activating JackMCS...')
        @self.client.set_process_callback
        def process(frames):
            self.outport.clear_buffer()
            a = self.client.frame_time
            if self.inport.incoming_midi_events():
                self.rx()
            if self._msg:
                self.tx()


        self.verbosity('Successfully started JackMCS.')
Ejemplo n.º 23
0
 def __init__(self, config, section, main_loop):
     super().__init__(config, section, main_loop)
     target_ports_re = config[section].get("connect", ".*")
     if target_ports_re:
         self._target_ports_re = re.compile(target_ports_re)
     else:
         self._target_ports_re = None
     start_server = config[section].getboolean("start_server", False)
     self._active = 0
     self._queue = Queue()
     jack.set_error_function(partial(jack_logger.debug, "%s"))
     jack.set_info_function(partial(jack_logger.debug, "%s"))
     try:
         self._client = jack.Client("Badum-tss machine",
                                    no_start_server=not start_server)
     except jack.JackError as err:
         raise PlayerLoadError("Could not connect to Jack: {}".format(err))
     jack.set_error_function(partial(jack_logger.error, "%s"))
     jack.set_info_function(partial(jack_logger.info, "%s"))
     self._client.set_shutdown_callback(self._shutdown)
     self._client.set_port_registration_callback(self._port_registration)
     self._client.set_port_rename_callback(self._port_rename)
     self._client.set_xrun_callback(self._xrun)
     self._client.set_process_callback(self._process)
     self._port = None
Ejemplo n.º 24
0
Archivo: tape.py Proyecto: cskau/lil-t
    def __init__(self):
        self.client = jack.Client('tape')

        if self.client.status.server_started:
            logger.info('JACK server was started')
        else:
            logger.info('JACK server was already running')

        if self.client.status.name_not_unique:
            logger.warning('Unique client name generated: %s',
                           self.client.name)

        self.client.set_xrun_callback(self.xrun)
        self.client.set_process_callback(self.process)

        self.blocksize = self.client.blocksize
        self.samplerate = self.client.samplerate

        self.tracks = []

        self.buffer_size = 4 * self.blocksize
        self.quiet = '\x00' * self.buffer_size

        time_t = 0
        self.record = False
        self.play = False
        self.active_track = 0

        self.client.activate()

        self.tracks.append(self.create_track(self.client))
Ejemplo n.º 25
0
    def __init__(self, click_high, click_low, audio_files=[], bitrate=16, sample_rate=44100):
        self.client              = jack.Client("SimpleDAW")
        self.blocksize           = self.client.blocksize
        self.outport             = self.client.outports.register("out_0")
        self.bpm                 = 120
        self.timesig             = 4
        self.bitrate             = bitrate

        self.sample_rate         = sample_rate
        self.samples_per_beat    = 0
        self.samples_per_measure = 0
        self.measure             = 0            # counter
        self.beat                = 0            # counter
        self.click_on            = False
        self.click_outport       = self.client.outports.register("out_click")
        self.is_playing          = False

        self.queue               = []
        self.clips               = {}

        self.client.set_process_callback(self._process_callback)
        self.client.set_shutdown_callback(self._shutdown_callback)

        self.set_samples_per_beat()
        self.set_samples_per_measure()

        audio_files.append(click_high)
        audio_files.append(click_low)

        for audio_file in (audio_files):
            self.load_audio(audio_file)
Ejemplo n.º 26
0
def jack_proc(q, cmdQ, STATUS_TYPE):
    #Setup Jack
    client = jack.Client('anim-midi')
    midi_in = client.midi_inports.register('input')
    #~ audio_out = client.outports.register('audio')

    @client.set_process_callback
    def process(frames):
        for offset, data in midi_in.incoming_midi_events():
            if len(data) == 3:
                status, pitch, vel = struct.unpack('3B', data)
                #Status meanings are in STATUS_TYPE.
                #Pitch is the CC# - the MIDI channel/note value.

                try:
                    if STATUS_TYPE[status] == 'CONTROL':
                        #~ print("[JACK MIDI]", STATUS_TYPE[status], pitch, vel)
                        q.put((STATUS_TYPE[status], pitch, vel))
                except:
                    print("Status not mapped!")

    with client:
        #Blocks until QUIT is passed over cmdQ queue.
        while True:
            msg = cmdQ.get()
            if msg == "IS_ACTIVE": cmdQ
            elif msg == "QUIT": break
Ejemplo n.º 27
0
def _test_client_name_lock():
    """
    Test whether arbitrarily many clients with the same name can be instantiated consecutively
    (the old client will be terminated before creating the new one).

    This should not be a problem or an unusual use case for Jack to handle. However, this test
    revealed some problems as documented in https://github.com/jackaudio/jack2/issues/658 and
    https://github.com/spatialaudio/jackclient-python/issues/98.

    On macOS, creating the 99th instance fails with a jack.JackOpenError when initializing the
    client. This occurred neither on Linux nor on Windows based on the same Jack version.

    After the failure occurs no clients with that name can be instantiated at all. This persists
    even through a restart of Jack. AFAIK only a system restart helps to resolve the lock.
    """
    import jack

    try:
        i = 0
        while True:
            i += 1

            # name = f"Client{i:d}"  # runs for arbitrarily many clients
            name = f"Client"  # fails for the 99th instance

            print(f'Test {i:d}: creating "{name}" ...')
            client = jack.Client(name=name)
            client.activate()
            client.deactivate()
            client.close()
            del client

    except KeyboardInterrupt:
        print("... interrupted by user.")
Ejemplo n.º 28
0
    def _create_client(self):
        self.client = jack.Client(self.name)
        [
            self.client.inports.register('input_' + str(i))
            for i in range(self.num_channels)
        ]

        self.client.set_process_callback(self._process)
Ejemplo n.º 29
0
    def disconnect_inputs():

        try:
            tmp = jack.Client('tmp')
            unplug_sources_of(tmp, audio_ports.split())
            tmp.close()
        except:
            warnings.append('Something went wrong when diconnecting inputs')
Ejemplo n.º 30
0
    def __init__(self):
        self.output_rules = []
        self.started = False
        self.notification_queue = Queue()

        self.client = jack.Client("jack-juggler", True)
        self.client.set_port_registration_callback(
            self.jack_port_registration_callback)
        self.client.set_shutdown_callback(self.jack_shutdown_callback)