Closed 0Dmitry closed 5 years ago
Link does not schedule events. It immediately proposes the new tempo to the other peers. I can see how that is not obvious from the header comment.
The host time given to ABLLinkSetTempo
is used to let Link know, at which host time the new tempo is used by the client, in respect to audio hardware latency and position of the change in the current audio buffer.
In general you should not schedule tempo changes with Link. Only commit a new tempo to the Link session once you actually use it. When setting a tempo before using it, it is possible for other peers on the network to schedule changes too - so it is not guaranteed, that the change will actually when you expect it.
If your app requires scheduling, do that locally, and then commit the new tempo to Link when it is used by your app.
Got it. Thanks for the reply.
I was playing with the LinkHut project. I changed the line where the the new tempo is applied to the link session(AudioEngine.m, line 215).
From this:
ABLLinkSetTempo(sessionState, engineData.proposeBpm, hostTimeAtBufferBegin);
To this:ABLLinkSetTempo(sessionState, engineData.proposeBpm, hostTimeAtBufferBegin + (UInt64)linkData->secondsToHostTime*5.0);
I also changed the
decreaseBpm
andincreaseBpm
methods so the changes to tempo are more rapid.I thought that with these changes I would get a behaviour where every tempo change is postponed by 5 seconds. But it looks like the tempo still changes immediately after I tap on plus/minus buttons.
Can someone explain me what I am doing wrong?