Reimplementation of SourceInputCallbacks into Session

Session should be the object holding the list of inputs parameters (e.g. synchrony) and the list of source callbacks. This also avoids mixing input when copying sources.  Code could be improved but is operational.
This commit is contained in:
Bruno Herbelin
2022-03-07 00:23:24 +01:00
parent 83e77681d9
commit 39b61fe331
18 changed files with 689 additions and 478 deletions

View File

@@ -247,6 +247,23 @@ void Metronome::executeAtPhase( std::function<void()> f )
std::thread( delay, f, timeToPhase() ).detach();
}
float Metronome::timeToSync(Synchronicity sync)
{
float ret = 0.f;
if ( sync > Metronome::SYNC_BEAT ) {
// SYNC TO PHASE
std::chrono::duration<float, std::milli> fp_ms = Metronome::manager().timeToPhase();
ret = fp_ms.count();
}
else if ( sync > Metronome::SYNC_NONE ) {
// SYNC TO BEAT
std::chrono::duration<float, std::milli> fp_ms = Metronome::manager().timeToBeat();
ret = fp_ms.count();
}
// SYNC NONE
return ret;
}
size_t Metronome::peers() const
{
return link_.numPeers();