Ejemplo n.º 1
0
 def Exit(self):
   """Exit Cleanly from Interactive VNA"""
   try:
     jacklib.deactivate(self.jackclient)
   except:
     pass
   try:
     jacklib.client_close(self.jackclient)
   except:
     pass
   exit()
Ejemplo n.º 2
0
def jack_client():
    status = jacklib.jack_status_t()
    client = jacklib.client_open("pyjacklib", jacklib.JackNoStartServer,
                                 status)

    if status.value:
        err = get_jack_status_error_string(status)

        if status.value & jacklib.JackNameNotUnique:
            print(f"Non-fatal JACK status: {err}", file=sys.stderr)
        elif status.value & jacklib.JackServerStarted:
            # Should not happen, since we use the JackNoStartServer option
            print(f"Unexpected JACK status: {err}", file=sys.stderr)
        else:
            raise OSError(f"Error creating JACK client: {err}")

    yield client

    jacklib.client_close(client)
Ejemplo n.º 3
0
        if doRunNow:
            if firstStart:
                firstStart = False
                print("cadence-aloop-daemon started, using %s and %i channels" % ("zita-a2j/j2a" if useZita else "alsa_in/out", channels))

            run_alsa_bridge()
            doRunNow = False

        elif isKernelGood and reactivateCounter >= 0:
            if reactivateCounter == 5:
                reactivateCounter = -1
                doRunNow = True
            else:
                reactivateCounter += 1

        sleep(1)

    # Close JACK client
    jacklib.deactivate(client)
    jacklib.client_close(client)

    if os.path.exists(checkFile):
        os.remove(checkFile)

    if procIn.state() != QProcess.NotRunning:
        procIn.terminate()
        procIn.waitForFinished(1000)
    if procOut.state() != QProcess.NotRunning:
        procOut.terminate()
        procOut.waitForFinished(1000)
Ejemplo n.º 4
0
        jack_port.is_new = True

        port_list.append(jack_port)

        if jacklib.port_flags(portPtr) & jacklib.JackPortIsInput:
            continue

        portConnectionNames = c_char_p_p_to_list(
                                jacklib.port_get_all_connections(jack_client,
                                                                 portPtr))

        for portConName in portConnectionNames:
            connection_list.append((portName, portConName))

    app = QCoreApplication(sys.argv)



    #needed for signals SIGINT, SIGTERM
    timer = QTimer()
    timer.start(200)
    timer.timeout.connect(lambda: None)

    connect_timer = ConnectTimer()
    dirty_checker = DirtyChecker()

    app.exec()

    jacklib.deactivate(jack_client)
    jacklib.client_close(jack_client)
                firstStart = False
                print(
                    "cadence-aloop-daemon started, using %s and %i channels" %
                    ("zita-a2j/j2a" if useZita else "alsa_in/out", channels))

            run_alsa_bridge()
            doRunNow = False

        elif isKernelGood and reactivateCounter >= 0:
            if reactivateCounter == 5:
                reactivateCounter = -1
                doRunNow = True
            else:
                reactivateCounter += 1

        sleep(1)

    # Close JACK client
    jacklib.deactivate(client)
    jacklib.client_close(client)

    if os.path.exists(checkFile):
        os.remove(checkFile)

    if procIn.state() != QProcess.NotRunning:
        procIn.terminate()
        procIn.waitForFinished(1000)
    if procOut.state() != QProcess.NotRunning:
        procOut.terminate()
        procOut.waitForFinished(1000)
Ejemplo n.º 6
0
 def exit(self):
     if self.jack_running:
         jacklib.deactivate(self.jack_client)
         jacklib.client_close(self.jack_client)
     self.remove_existence_file()
     del self.osc_server
Ejemplo n.º 7
0
 def close(self):
     if self.client:
         jacklib.deactivate(self.client)
         return jacklib.client_close(self.client)
Ejemplo n.º 8
0
                noteplaying = note

            elif (mode & MIDI_MASK) == MIDI_NOTEOFF:
                if note == noteplaying:
                    floppy.stop()

            elif (mode & MIDI_MASK) == MIDI_PITCH:
                pitch = velo * 256 + note
                floppy.pitchbend(pitch)

            elif (mode & MIDI_MASK) == MIDI_MODE:
                if note in (64, 120, 121, 123):
                    # print "Everything off(%s) on channel %s." % (note, mode&(~MIDI_MASK))
                    floppy.stop()

            else:
                print "ignoring", mode, note, velo
                pass
        except Queue.Empty:
            pass
        except ValueError as e:
            print e
        except KeyboardInterrupt:
            stop()
            raise

            # Close Jack
    if jack_client:
        jacklib.deactivate(jack_client)
        jacklib.client_close(jack_client)