Exemplo n.º 1
0
    def check_if_jack_subclient_running(self):

        self.attach_to_jack()  # this is probably not the best spot for this...
        myname = jack.get_client_name()
        ports = jack.get_ports()

        res = [re.search(self.pcm, p) for p in ports]
        return any(res)
Exemplo n.º 2
0
Arquivo: ted.py Projeto: behrat/ted
    def __init__(self, client, name, number):
        self.client = client
        self.name = name
        self.number = number
        self.port = "%s:%s%d" %(self.client, self.name, self.number)
        self.monitor_port = "monitor_%s_%s%d" % (self.client, self.name, self.number)

        jack.register_port(self.monitor_port, jack.IsInput)
        jack.connect(self.port, "%s:%s" % (jack.get_client_name(), self.monitor_port))
Exemplo n.º 3
0
    def open(self):
        self.client = jack.attach('PythonClient')
        myname = jack.get_client_name()

        jack.register_port("in_1", jack.IsInput)
        jack.register_port("in_2", jack.IsInput)
        jack.register_port("out", jack.IsOutput)
        self.client.activate()

        print "Jack ports (before):", jack.get_ports()
        jack.connect("system:capture_1", myname+":in_1")
Exemplo n.º 4
0
def establish_connection(pcm, channel):
    myname = jack.get_client_name()
    capture_name = pcm + ":capture_" + channel
    port_name = "in_" + channel
    connection_name = myname + ":" + port_name

    print capture_name, port_name, connection_name
    print "Jack ports (before):", jack.get_ports()
    jack.register_port(port_name, jack.IsInput)
    jack.activate()
    print "Jack ports (after):", jack.get_ports()
    jack.connect(capture_name, connection_name)
    print jack.get_connections(connection_name)
Exemplo n.º 5
0
 def __init__(self, output='jack', numChannels = 2):
     self.numChannels = numChannels
     self.output = output
     if output == 'jack':
         # use pyjack
         import jack
         try:
             jack.get_client_name()
         except jack.NotConnectedError:
             jack.attach('remix')
             # not registering an input port makes the output sync
             # consistently break after processing 2 buffers
             # - bug in pyjack?
             jack.register_port("in_1", jack.IsInput)
             for i in range(0, self.numChannels):
                 jack.register_port("out_" + str(i+1), jack.IsOutput)
             jack.activate()
             for i in range(0, self.numChannels):
                 jack.connect("remix:out_" + str(i+1), "alsa_pcm:playback_" + str(i+1))
         self.n = jack.get_buffer_size()
         self.jackSampleRate = float(jack.get_sample_rate())
         # loosing a buffer, here, see below
         self._reset_jack()
Exemplo n.º 6
0
#!/usr/bin/python
# Capture 3 seconds of stereo audio from alsa_pcm:capture_1/2; then play it back.
#
# Copyright 2003, Andrew W. Schmeder
# This source code is released under the terms of the GNU Public License.
# See LICENSE for the full text of these terms.

import numpy
import jack
import time

jack.attach("captest")

myname = jack.get_client_name()
print "Client:", myname
print jack.get_ports()

jack.register_port("in_1", jack.IsInput)
jack.register_port("in_2", jack.IsInput)

jack.activate()

print jack.get_ports()

jack.connect("system:capture_1", myname+":in_1")
jack.connect("system:capture_2", myname+":in_2")

print jack.get_connections(myname+":in_1")

N = jack.get_buffer_size()
Sr = float(jack.get_sample_rate())
Exemplo n.º 7
0
#!/usr/bin/python
# Capture 3 seconds of stereo audio from alsa_pcm:capture_1/2; then play it back.
#
# Copyright 2003, Andrew W. Schmeder
# This source code is released under the terms of the GNU Public License.
# See LICENSE for the full text of these terms.

import numpy
import jack
import time

jack.attach("captest")

myname = jack.get_client_name()
print "Client:", myname
print jack.get_ports()

jack.register_port("in_1", jack.IsInput)
jack.register_port("in_2", jack.IsInput)

jack.activate()

print jack.get_ports()

jack.connect("system:capture_1", myname + ":in_1")
jack.connect("system:capture_2", myname + ":in_2")

print jack.get_connections(myname + ":in_1")

N = jack.get_buffer_size()
Sr = float(jack.get_sample_rate())