Skip to content

Add set_timebase_callback() - #14

Closed
Vampouille wants to merge 6 commits into
spatialaudio:masterfrom
Vampouille:add_timebase_master
Closed

Vampouille wants to merge 6 commits into
spatialaudio:masterfrom
Vampouille:add_timebase_master

Conversation

@Vampouille

Copy link
Copy Markdown
Contributor

I add set_timebase_callback() method and set jack_transport_reposition() as TODO

@mgeier

mgeier commented May 22, 2015

Copy link
Copy Markdown
Member

To be honest, I don't understand what exactly such a callback is supposed to do ...

Could you please give a simple example?

Probably something I can use for testing?

I would wait with this until #7 is done, because then you can drop all this useless userdata stuff.
I'll try to finish #7 this weekend.

Are you planning to implement jack_transport_reposition(), too?

If yes, I think it would make sense to do that first, otherwise it may be hard to test the callback, right?

BTW, what do you think about #12?

@Vampouille

Copy link
Copy Markdown
Contributor Author

This callback is used to set bpm and bbt (and bbt_offset) : position in bar beat ticks. Server only fill 'frame' field of position struct. Then callback have to set BPM and then compute bar, beat, ticks fields according to current bpm and frame count.
https://github.com/Vampouille/superboucle/blob/master/gui.py at the end of this file, you can see an implementation of timebase callback.
In this callback, I use QSpinBox to get BPM from gui, then I set BPM (beat per bar, ticks per beats, ...) and finally I compute bar, beat, ticks from bpm and frame count.

In the original version of jack-Client jack_transport_reposition() was not declared as 'TODO' but was not implemented, so I just turn declaration into 'TODO'.

In my application, I have feature to jump to a specified position in song in 'bar' (and change tempo). My first idea was to use jack_transport_reposition() function to change position or to change bpm. But this is not the way to do in jack because bpm will be overwritten on next process cycle by timebasemaster. For jumping in song I use transport_locate() function. I use timebase_callback to change bpm.

For me jack_transport_reposition() is useless.

Are you interesting in testing my app ? I'm looking for tester... and maybe my app can be useful for you.

@mgeier mgeier added this to the 0.3.0 milestone May 23, 2015
Comment thread jack.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change the order of conditional and timebase_callback and make former optional with conditional=False (I guess this is the right default value?).

Please also rename timebase_callback to callback, like in the other callback setters.

@mgeier

mgeier commented May 26, 2015

Copy link
Copy Markdown
Member

Thanks for the explanations.
I'm starting to understand how this is supposed to work, but I'm not sure about every detail yet ...

In the meantime, I closed #7 and #12, can you please update your PR accordingly?

I also added a few comments within the code.

For me jack_transport_reposition() is useless.

OK, we can leave it as "TODO" for now.

@mgeier

mgeier commented May 31, 2015

Copy link
Copy Markdown
Member

It would be nice if set_timebase_callback() could also be used as a decorator, like the other callback setters.

This can be done by changing the signature to:

def set_timebase_callback(self, callback=None, conditional=False):

... and adding this in the very beginning of the function:

if callback is None:
    return lambda cb: self.set_timebase_callback(cb, conditional)

Comment thread jack.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In other places, the result variable is called err, you should also use this for consistency.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... and you should make the line break directly after (, then the rest would fit in 1 line.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just realized that if you change the name according to my first comment, my second comment becomes obsolete, so just forget it!

@mgeier

mgeier commented Jun 1, 2015

Copy link
Copy Markdown
Member

Thanks for the changes!

Did you already create an issue for JACK2?

I would like to add the issue URL as a comment in our code.

@Vampouille

Copy link
Copy Markdown
Contributor Author

Le 01/06/2015 17:09, Matthias Geier a écrit :

Thanks for the changes!

Did you already create an issue for JACK2?

jackaudio/jack2#122

I would like to add the issue URL as a comment in our code.

—
Reply to this email directly or view it on GitHub
#14 (comment).

@mgeier

mgeier commented Jun 2, 2015

Copy link
Copy Markdown
Member

Wow, that was quick, it's been already merged into master!

You should close jackaudio/jack2#122 and add jackaudio/jack2#123 as a comment here in this PR.

Something like this:

        # Because of a bug in JACK2 version <= 1.9.10, we also check for -1.
        # See https://github.com/jackaudio/jack2/pull/123.

mgeier pushed a commit that referenced this pull request Jun 2, 2015
@mgeier

mgeier commented Jun 2, 2015

Copy link
Copy Markdown
Member

I squashed your changes into ce009fe.

Thanks for the PR!

@mgeier mgeier closed this Jun 2, 2015
@Vampouille
Vampouille deleted the add_timebase_master branch June 3, 2015 07:56
@Vampouille

Copy link
Copy Markdown
Contributor Author

I have a test/example file for set_timebase_callback() if you want

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants