示例#1
0
    def _clientConnect(self):
        log.info("Connecting client '%s'" % self._cfg.get('name', 'guitarix'))
        self._client = JSONRPCConnect('localhost',
                                      self._cfg.get('rpc_port', 8881))
        self.version()

        if self._cfg.get('web'):
            self._webprocess = GuitarixWeb(control=self._control,
                                           config=self._cfg,
                                           logout=self._logout,
                                           logerr=self._logerr,
                                           pidpath=self._pidpath + '.web.pid')
            self._webprocess.wait()
示例#2
0
    def _clientConnect(self):
        log.info("Connecting client '%s'" % self._cfg.get("name", "guitarix"))
        self._client = JSONRPCConnect("localhost", self._cfg.get("rpc_port", 8881))
        self.version()

        if self._cfg.get("web"):
            self._webprocess = GuitarixWeb(
                control=self._control,
                config=self._cfg,
                logout=self._logout,
                logerr=self._logerr,
                pidpath=self._pidpath + ".web.pid",
            )
            self._webprocess.wait()
示例#3
0
import logging
from jsonrpctcp import logger, config as JSONRPCConfig, connect as JSONRPCConnect

if __name__ == '__main__':
    logger.addHandler(logging.StreamHandler())  # sends to stdout
    logger.setLevel(logging.DEBUG)

    JSONRPCConfig.append_string = '\n'
    client = JSONRPCConnect('board-1.psa', 8881)
    #print(client.getversion())
    client.setstate("bypassed")
示例#4
0
class Guitarix(Process):
    """Guitarix controller"""
    _webprocess = None

    def start(self):
        JSONRPCConfig.append_string = '\n'
        self._command = [
            'guitarix', '--nogui', '--name',
            self._cfg.get('name', 'guitarix'), '--rpcport',
            self._cfg.get('rpc_port', 8881), '--server-name',
            self._cfg.get('jack', 'jack')
        ]
        Process.start(self)

    def _clientConnect(self):
        log.info("Connecting client '%s'" % self._cfg.get('name', 'guitarix'))
        self._client = JSONRPCConnect('localhost',
                                      self._cfg.get('rpc_port', 8881))
        self.version()

        if self._cfg.get('web'):
            self._webprocess = GuitarixWeb(control=self._control,
                                           config=self._cfg,
                                           logout=self._logout,
                                           logerr=self._logerr,
                                           pidpath=self._pidpath + '.web.pid')
            self._webprocess.wait()

    def stop(self):
        log.info("Stopping '%s'" % self._cfg.get('name', 'guitarix'))
        if self._webprocess:
            self._webprocess.stop()
            del self._webprocess
        Process.stop(self)

    def version(self):
        return self._client.getversion()

    def connectJack(self, jacks):
        log.info("Connecting ports of Guitarix to Jack...")
        jack = filter(lambda j: j.name() == self._cfg.get('jack', 'jack'),
                      jacks)[0]

        # TODO: bad way to make bypass working, please rewrite it
        jack._guitarix = self

        m = self._cfg.get('mapping', {})

        for i in m.get('inputs', {}):
            log.debug("  Connecting my_out:%d to jack_in:%d" %
                      (i['out'], i['in']))
            jack_outs = jack.getPorts(name_pattern='system:capture_%d' %
                                      i['out'],
                                      is_audio=True,
                                      is_output=True)
            log.debug("    Jack output ports: %s" % jack_outs)
            my_ins = jack.getPorts(name_pattern='%s_%s:in_%d' %
                                   (self.name(), i['module'], i['in']),
                                   is_audio=True,
                                   is_input=True)
            log.debug("    My input ports: %s" % my_ins)

            jack.connectPorts(jack_outs[0], my_ins[0])

        for o in m.get('outputs', {}):
            log.debug("  Connecting my_out:%d to jack_in:%d" %
                      (o['out'], o['in']))
            my_outs = jack.getPorts(name_pattern='%s_%s:out_%d' %
                                    (self.name(), o['module'], o['out']),
                                    is_audio=True,
                                    is_output=True)
            log.debug("    My output ports: %s" % my_outs)
            jack_ins = jack.getPorts(name_pattern='system:playback_%d' %
                                     o['in'],
                                     is_audio=True,
                                     is_input=True)
            log.debug("    Jack input ports: %s" % jack_ins)

            jack.connectPorts(my_outs[0], jack_ins[0])

        log.debug("  Connecting Guitarix amp to fx...")
        my_outs = jack.getPorts(name_pattern='%s_amp:out_0' % self.name(),
                                is_audio=True,
                                is_output=True)
        my_ins = jack.getPorts(name_pattern='%s_fx:in_0' % self.name(),
                               is_audio=True,
                               is_input=True)
        jack.connectPorts(my_outs[0], my_ins[0])
示例#5
0
import logging
from jsonrpctcp import logger, config as JSONRPCConfig, connect as JSONRPCConnect

if __name__ == '__main__':
  logger.addHandler(logging.StreamHandler()) # sends to stdout
  logger.setLevel(logging.DEBUG)

  JSONRPCConfig.append_string = '\n'
  client = JSONRPCConnect('board-1.psa', 8881)
  #print(client.getversion())
  client.setstate("bypassed")
示例#6
0
class Guitarix(Process):
    """Guitarix controller"""

    _webprocess = None

    def start(self):
        JSONRPCConfig.append_string = "\n"
        self._command = [
            "guitarix",
            "--nogui",
            "--name",
            self._cfg.get("name", "guitarix"),
            "--rpcport",
            self._cfg.get("rpc_port", 8881),
            "--server-name",
            self._cfg.get("jack", "jack"),
        ]
        Process.start(self)

    def _clientConnect(self):
        log.info("Connecting client '%s'" % self._cfg.get("name", "guitarix"))
        self._client = JSONRPCConnect("localhost", self._cfg.get("rpc_port", 8881))
        self.version()

        if self._cfg.get("web"):
            self._webprocess = GuitarixWeb(
                control=self._control,
                config=self._cfg,
                logout=self._logout,
                logerr=self._logerr,
                pidpath=self._pidpath + ".web.pid",
            )
            self._webprocess.wait()

    def stop(self):
        log.info("Stopping '%s'" % self._cfg.get("name", "guitarix"))
        if self._webprocess:
            self._webprocess.stop()
            del self._webprocess
        Process.stop(self)

    def version(self):
        return self._client.getversion()

    def connectJack(self, jacks):
        log.info("Connecting ports of Guitarix to Jack...")
        jack = filter(lambda j: j.name() == self._cfg.get("jack", "jack"), jacks)[0]

        # TODO: bad way to make bypass working, please rewrite it
        jack._guitarix = self

        m = self._cfg.get("mapping", {})

        for i in m.get("inputs", {}):
            log.debug("  Connecting my_out:%d to jack_in:%d" % (i["out"], i["in"]))
            jack_outs = jack.getPorts(name_pattern="system:capture_%d" % i["out"], is_audio=True, is_output=True)
            log.debug("    Jack output ports: %s" % jack_outs)
            my_ins = jack.getPorts(
                name_pattern="%s_%s:in_%d" % (self.name(), i["module"], i["in"]), is_audio=True, is_input=True
            )
            log.debug("    My input ports: %s" % my_ins)

            jack.connectPorts(jack_outs[0], my_ins[0])

        for o in m.get("outputs", {}):
            log.debug("  Connecting my_out:%d to jack_in:%d" % (o["out"], o["in"]))
            my_outs = jack.getPorts(
                name_pattern="%s_%s:out_%d" % (self.name(), o["module"], o["out"]), is_audio=True, is_output=True
            )
            log.debug("    My output ports: %s" % my_outs)
            jack_ins = jack.getPorts(name_pattern="system:playback_%d" % o["in"], is_audio=True, is_input=True)
            log.debug("    Jack input ports: %s" % jack_ins)

            jack.connectPorts(my_outs[0], jack_ins[0])

        log.debug("  Connecting Guitarix amp to fx...")
        my_outs = jack.getPorts(name_pattern="%s_amp:out_0" % self.name(), is_audio=True, is_output=True)
        my_ins = jack.getPorts(name_pattern="%s_fx:in_0" % self.name(), is_audio=True, is_input=True)
        jack.connectPorts(my_outs[0], my_ins[0])