[EMAIL PROTECTED] wrote:
> 4. Hit the taptempo key "backslash" some times.
> On this point all works right. Tempochange do nothing.
> 5. Stop sequenzer and hit the "Backspace" key to reposition to start.
> 6. Start play.
> now the position is wrong. 
> also in state playing taptempo makes jumping in timeline.

Oh!  I see what you guys are fighting.  I ran in to this while writing 
InConcert: a stand-alone, midi-controllable, tap-tempo JACK transport master 
(http://www.teuton.org/~gabriel/InConcert/).

The problem is this:  It's generally assumed that at BBT 1:1:0000, you are at 
transport frame 0.  Often, the BBT info is updated by assuming *that* and a 
constant tempo, or it's calculated using a running counter and state variables 
(which is what H2 does, I think).  The problem is that when you change your 
state (i.e. tempo), 1:1:0000 is no longer at frame 0... and is often *before* 
frame 0.

I handled it by creating an Epoch class, and calculated BBT using it. 
Simplified, it looked like this:

struct Epoch {
   jack_nframes_t frame;
   unsigned bar;
   unsigned beat;
   unsigned tick;
   // Plus other stuff like tempo, bars per beat, frame rate info, etc.
};

Epoch time_basis;

When you start, your struct looks like {0, 1, 1, 0}.  If you change tempo at 
bar 
5:2:0000, you rewrite it to be something like { 45019, 5, 2, 0 }.  Any time you 
calculate BBT info, you know that frame 45019 is 5:2:0000, and you can 
calculate 
what else you need based on that.  Then, I created a special button/function to 
re-zero my time base.

To do it in Hydrogen, you might do something like:

typedef std::deque<Epoch> time_bases_t;
time_bases_t time_bases;

Whenever you update the tempo, you push a new Epoch onto the back... thus 
saving 
your previous Epochs... and thus you know the exact frame when your tempos 
changed.

This is the tricky part:  When a client calls jack_transport_reposition(client, 
pos) or jack_transport_locate(client, frame)... do you go to the literal FRAME 
(using our current Epoch), or do you go to the BBT that that frame was when you 
were there (using a previous Epoch)??  Do you want to use the _old_ tempo?  Or 
do you want to reposition and use the _new_ tempo?

In a live setting (where you want tap tempo), you don't usually use reposition 
much... except to go to 0 -- thus I created the re-zero method for InConcert. 
However, I might be inclined to go back to the old BBT with the new tempo (thus 
redefining several Epochs in time_bases).

In a studio setting where Hydrogen is part of a session with a recording 
program 
like Ardour... I think you would want to go back in time and use the _old_ 
tempo 
with the _old_ Epoch.  Thus, your tap-tempo changes will happen repeatably on 
replay.

You've got to make the same decision on what to do with 
jack_transport_query()... which will use your callback to find the BBT.

I hope this helps!

Peace,
Gabriel


-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Hydrogen-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/hydrogen-devel

Reply via email to