本文整理汇总了C++中Hydrogen::triggerRelocateDuringPlay方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::triggerRelocateDuringPlay方法的具体用法?C++ Hydrogen::triggerRelocateDuringPlay怎么用?C++ Hydrogen::triggerRelocateDuringPlay使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::triggerRelocateDuringPlay方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: updateTransportInfo
void JackOutput::updateTransportInfo()
{
if ( locate_countdown == 1 )
locate( locate_frame );
if ( locate_countdown > 0 )
locate_countdown--;
if ( Preferences::get_instance()->m_bJackTransportMode != Preferences::USE_JACK_TRANSPORT ) return;
m_JackTransportState = jack_transport_query( client, &m_JackTransportPos );
// update m_transport with jack-transport data
switch ( m_JackTransportState ) {
case JackTransportStopped:
m_transport.m_status = TransportInfo::STOPPED;
//infoLog( "[updateTransportInfo] STOPPED - frames: " + to_string(m_transportPos.frame) );
break;
case JackTransportRolling:
if ( m_transport.m_status != TransportInfo::ROLLING && ( m_JackTransportPos.valid & JackPositionBBT ) ) {
must_relocate = 2;
//WARNINGLOG( "Jack transport starting: Resyncing in 2 x Buffersize!!" );
}
m_transport.m_status = TransportInfo::ROLLING;
//infoLog( "[updateTransportInfo] ROLLING - frames: " + to_string(m_transportPos.frame) );
break;
case JackTransportStarting:
m_transport.m_status = TransportInfo::STOPPED;
//infoLog( "[updateTransportInfo] STARTING (stopped) - frames: " + to_string(m_transportPos.frame) );
break;
default:
ERRORLOG( "Unknown jack transport state" );
}
// FIXME
// TickSize and BPM
Hydrogen * H = Hydrogen::get_instance();
H->setTimelineBpm(); // dlr: fix #168, jack may have re-located us anywhere, check for bpm change every cycle
if ( m_JackTransportPos.valid & JackPositionBBT ) {
float bpm = ( float )m_JackTransportPos.beats_per_minute;
if ( m_transport.m_nBPM != bpm ) {
if ( Preferences::get_instance()->m_bJackMasterMode == Preferences::NO_JACK_TIME_MASTER ){
// WARNINGLOG( QString( "Tempo change from jack-transport: %1" ).arg( bpm ) );
m_transport.m_nBPM = bpm;
must_relocate = 1; // The tempo change has happened somewhere during the previous cycle; relocate right away.
// This commenting out is rude perhaps, but I cant't figure out what this bit is doing.
// In any case, setting must_relocate = 1 here causes too many relocates. Jakob Lund
/* } else {
if ( m_transport.m_status == TransportInfo::STOPPED ) {
oldpo = H->getPatternPos();
must_relocate = 1;
//changer =1;
}*/
}
// Hydrogen::get_instance()->setBPM( m_JackTransportPos.beats_per_minute ); // unnecessary, as Song->m_BPM gets updated in audioEngine_process_transport (after calling this function)
}
}
if ( m_transport.m_nFrames + bbt_frame_offset != m_JackTransportPos.frame ) {
if ( ( m_JackTransportPos.valid & JackPositionBBT ) && must_relocate == 0 ) {
WARNINGLOG( "Frame offset mismatch; triggering resync in 2 cycles" );
must_relocate = 2;
} else {
if ( Preferences::get_instance()->m_bJackMasterMode == Preferences::NO_JACK_TIME_MASTER ) {
// If There's no timebase_master, and audioEngine_process_checkBPMChanged handled a tempo change during last cycle, the offset doesn't match, but hopefully it was calculated correctly:
//this perform Jakobs mod in pattern mode, but both m_transport.m_nFrames works with the same result in pattern Mode
// in songmode the first case dont work.
//so we can remove this "if query" and only use this old mod: m_transport.m_nFrames = H->getHumantimeFrames();
//because to get the songmode we have to add this "H2Core::Hydrogen *m_pEngine" to the header file
//if we remove this we also can remove *m_pEngine from header
#if 0 // dlr: fix #169, why do we have a different behaviour for SONG_MODE?
if ( m_pEngine->getSong()->get_mode() == Song::PATTERN_MODE ){
m_transport.m_nFrames = m_JackTransportPos.frame/* - bbt_frame_offset*/; ///see comment in svn changeset 753
}
else
{
m_transport.m_nFrames = H->getHumantimeFrames();
}
#else
m_transport.m_nFrames = m_JackTransportPos.frame;
bbt_frame_offset = 0; // dlr: stop re-syncing in every cycle when STOPPED
#endif
// In jack 'slave' mode, if there's no master, the following line is needed to be able to relocate by clicking the song ruler (wierd corner case, but still...)
if ( m_transport.m_status == TransportInfo::ROLLING )
H->triggerRelocateDuringPlay();
} else {
///this is experimantal... but it works for the moment... fix me fix :-) wolke
// ... will this actually happen? keeping it for now ( jakob lund )
m_transport.m_nFrames = H->getHumantimeFrames();
//.........这里部分代码省略.........
示例2: updateTransportInfo
//.........这里部分代码省略.........
case JackTransportStarting: // Waiting for sync ready. If
// there are slow-sync clients,
// this can take more than one
// cycle.
m_transport.m_status = TransportInfo::STOPPED;
//INFOLOG( "[updateTransportInfo] STARTING (stopped) - frames: " + to_string(m_transportPos.frame) );
break;
default:
ERRORLOG( "Unknown jack transport state" );
}
// Updating TickSize and BPM
Hydrogen * H = Hydrogen::get_instance();
// JACK may have re-located us anywhere. Therefore, we have to
// check for a bpm change every cycle. We will do so by
// updating both the global speed of the song, as well as the
// fallback speed (H->getNewBpmJTM) with the local tempo at
// the current position on the timeline.
H->setTimelineBpm();
// Check whether another JACK master is present (the second if
// clause won't evaluate to true if Hydrogen itself is the
// timebase master) and whether it changed the transport
// state. Note that only the JACK timebase master and not
// arbitrary clients can do this. If so, the speed is updated
// an a relocation according to the bar, beat, and tick
// information will be triggered right away.
if ( m_JackTransportPos.valid & JackPositionBBT ) {
float bpm = ( float )m_JackTransportPos.beats_per_minute;
if ( m_transport.m_nBPM != bpm ) {
if ( Preferences::get_instance()->m_bJackMasterMode ==
Preferences::NO_JACK_TIME_MASTER ){
// WARNINGLOG( QString( "Tempo change from jack-transport: %1" ).arg( bpm ) );
m_transport.m_nBPM = bpm;
must_relocate = 1;
}
}
}
// This clause detects a re-location, which was either
// triggered by an user-interaction (e.g. clicking the forward
// button or clicking somewhere on the timeline) or by a
// different JACK client.
if ( m_transport.m_nFrames + bbt_frame_offset != m_JackTransportPos.frame ) {
// Whether there is a JACK timebase master registered
// but the audio engine was neither (re)started nor a
// change in the speed was found beforehand.
if ( ( m_JackTransportPos.valid & JackPositionBBT ) && must_relocate == 0 ) {
// WARNINGLOG( "Frame offset mismatch; triggering resync in 2 cycles" );
must_relocate = 2; // re-locate at the end of
// the next cycle.
} else {
if ( Preferences::get_instance()->m_bJackMasterMode ==
Preferences::NO_JACK_TIME_MASTER ) {
// Just consider the transport
// position as dirty, reassign the
// one obtained in the query, and
// reset the offset.
m_transport.m_nFrames = m_JackTransportPos.frame;
bbt_frame_offset = 0;
// If not registered as JACK time
// master, the following line is
// needed to be able to relocate by
// clicking the song ruler (wired
// corner case, but still...)
if ( m_transport.m_status == TransportInfo::ROLLING )
// Setting
// H->m_nPatternStartTick = -1
// if in pattern mode.
H->triggerRelocateDuringPlay();
} else {
// Fallback to the transport position
// of the last cycle.
m_transport.m_nFrames = H->getHumantimeFrames();
}
}
}
// Only used if Hydrogen is in JACK timebase master
// mode. Updated every cycle.
if ( H->getHumantimeFrames() != m_JackTransportPos.frame ) {
H->setHumantimeFrames(m_JackTransportPos.frame);
// WARNINGLOG( QString( "fix Humantime: %1" ).arg( m_JackTransportPos.frame ) );
}
// Trigger the re-location based on the information provided
// by another JACK timebase master.
if ( must_relocate == 1 ) {
WARNINGLOG( QString( "Resyncing! bbt_frame_offset: %1" ).arg( bbt_frame_offset ) );
relocateBBT();
if ( m_transport.m_status == TransportInfo::ROLLING ) {
// Setting H->m_nPatternStartTick = -1 if in
// pattern mode
H->triggerRelocateDuringPlay();
}
}
if ( must_relocate > 0 ) must_relocate--;
}