本文整理汇总了C++中Hydrogen::setPatternPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::setPatternPos方法的具体用法?C++ Hydrogen::setPatternPos怎么用?C++ Hydrogen::setPatternPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::setPatternPos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleAction
/**
* The handleAction method is the heard of the MidiActionManager class.
* It executes the operations that are needed to carry the desired action.
*/
bool MidiActionManager::handleAction( MidiAction * pAction ){
Hydrogen *pEngine = Hydrogen::get_instance();
/*
return false if action is null
(for example if no Action exists for an event)
*/
if( pAction == NULL ) return false;
QString sActionString = pAction->getType();
if( sActionString == "PLAY" )
{
int nState = pEngine->getState();
if ( nState == STATE_READY ){
pEngine->sequencer_play();
}
return true;
}
if( sActionString == "PLAY/STOP_TOGGLE" || sActionString == "PLAY/PAUSE_TOGGLE" )
{
int nState = pEngine->getState();
switch ( nState )
{
case STATE_READY:
pEngine->sequencer_play();
break;
case STATE_PLAYING:
if( sActionString == "PLAY/STOP_TOGGLE" ) pEngine->setPatternPos( 0 );
pEngine->sequencer_stop();
pEngine->setTimelineBpm();
break;
default:
ERRORLOG( "[Hydrogen::ActionManager(PLAY): Unhandled case" );
}
return true;
}
if( sActionString == "PAUSE" )
{
pEngine->sequencer_stop();
return true;
}
if( sActionString == "STOP" )
{
pEngine->sequencer_stop();
pEngine->setPatternPos( 0 );
pEngine->setTimelineBpm();
return true;
}
if( sActionString == "MUTE" ){
//mutes the master, not a single strip
pEngine->getSong()->__is_muted = true;
return true;
}
if( sActionString == "UNMUTE" ){
pEngine->getSong()->__is_muted = false;
return true;
}
if( sActionString == "MUTE_TOGGLE" ){
pEngine->getSong()->__is_muted = !Hydrogen::get_instance()->getSong()->__is_muted;
return true;
}
if( sActionString == "BEATCOUNTER" ){
pEngine->handleBeatCounter();
return true;
}
if( sActionString == "TAP_TEMPO" ){
pEngine->onTapTempoAccelEvent();
return true;
}
if( sActionString == "SELECT_NEXT_PATTERN" ){
bool ok;
int row = pAction->getParameter1().toInt(&ok,10);
if( row> pEngine->getSong()->get_pattern_list()->size() -1 )
return false;
if(Preferences::get_instance()->patternModePlaysSelected())
pEngine->setSelectedPatternNumber( row );
else
pEngine->sequencer_setNextPattern( row, false, true );
return true;
}
//.........这里部分代码省略.........
示例2: diskWriterDriver_thread
//.........这里部分代码省略.........
std::vector<PatternList*> *pPatternColumns = Hydrogen::get_instance()->getSong()->get_pattern_group_vector();
int nColumns = pPatternColumns->size();
int nPatternSize;
int validBpm = engine->getSong()->__bpm;
float oldBPM = 0;
float ticksize = 0;
for ( int patternposition = 0; patternposition < nColumns; ++patternposition ) {
PatternList *pColumn = ( *pPatternColumns )[ patternposition ];
if ( pColumn->size() != 0 ) {
nPatternSize = pColumn->get( 0 )->get_length();
} else {
nPatternSize = MAX_NOTES;
}
ticksize = pDriver->m_nSampleRate * 60.0 / engine->getSong()->__bpm / engine->getSong()->__resolution;
// check pattern bpm if timeline bpm is in use
Timeline* pTimeline = engine->getTimeline();
if(Preferences::get_instance()->getUseTimelineBpm() ){
if( pTimeline->m_timelinevector.size() >= 1 ){
for ( int t = 0; t < pTimeline->m_timelinevector.size(); t++){
if(pTimeline->m_timelinevector[t].m_htimelinebeat == patternposition &&
pTimeline->m_timelinevector[t].m_htimelinebpm != validBpm){
validBpm = pTimeline->m_timelinevector[t].m_htimelinebpm;
}
}
}
pDriver->setBpm(validBpm);
ticksize = pDriver->m_nSampleRate * 60.0 / validBpm / Hydrogen::get_instance()->getSong()->__resolution;
pDriver->audioEngine_process_checkBPMChanged();
engine->setPatternPos(patternposition);
// delay needed time to calculate all rubberband samples
if( Preferences::get_instance()->getRubberBandBatchMode() && validBpm != oldBPM ){
EventQueue::get_instance()->push_event( EVENT_RECALCULATERUBBERBAND, -1);
int sleepTime = Preferences::get_instance()->getRubberBandCalcTime()+1;
while ((sleepTime = sleep(sleepTime)) > 0);
}
oldBPM = validBpm;
}
else
{
ticksize = pDriver->m_nSampleRate * 60.0 / Hydrogen::get_instance()->getSong()->__bpm / Hydrogen::get_instance()->getSong()->__resolution;
//pDriver->m_transport.m_nTickSize = ticksize;
}
//here we have the pattern length in frames dependent from bpm and samplerate
unsigned patternLengthInFrames = ticksize * nPatternSize;
unsigned frameNumber = 0;
int lastRun = 0;
while ( frameNumber < patternLengthInFrames ) {
int usedBuffer = pDriver->m_nBufferSize;
//this will calculate the the size from -last- (end of pattern) used frame buffer,
//which is mostly smaller than pDriver->m_nBufferSize
if( patternLengthInFrames - frameNumber < pDriver->m_nBufferSize ){
lastRun = patternLengthInFrames - frameNumber;
usedBuffer = lastRun;
};
示例3: rewindBtnClicked
void PlaylistDialog::rewindBtnClicked( Button* ref )
{
UNUSED( ref );
Hydrogen *pEngine = Hydrogen::get_instance();
pEngine->setPatternPos( pEngine->getPatternPos() - 1 );
}
示例4: RewindBtnClicked
void PlayerControl::RewindBtnClicked( Button* )
{
Hydrogen *pEngine = Hydrogen::get_instance();
pEngine->setPatternPos( pEngine->getPatternPos() - 1 );
Hydrogen::get_instance()->setTimelineBpm();
}