Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set_freewheel documentation #142

Open
00sapo opened this issue Jul 22, 2021 · 0 comments
Open

set_freewheel documentation #142

00sapo opened this issue Jul 22, 2021 · 0 comments

Comments

@00sapo
Copy link

00sapo commented Jul 22, 2021

Hello,
to my understanding, set_freewheel should be put after any call to Client.activate() and before any call to Client.deactivate().

I have prepared a little example to play with this. I think it should be added to the documentation...

import time
import jack
import threading

ttt = None

def trial():
    A = jack.Client("A")
    event = threading.Event()

    @A.set_process_callback
    def process(frames):
        global ttt
        tt = time.time()
        print(tt)
        if tt - ttt > 1:
            event.set()

    global ttt
    ttt = time.time()
    # A.set_freewheel(True) # this makes `activate` fail
    A.activate()
    A.set_freewheel(True)
    event.wait()
    A.set_freewheel(False)
    A.deactivate()
    # A.set_freewheel(False) # this makes errors on the next run
    A.close()
    del A

print("trial 1")
trial()
print("trial 2")
trial()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant