本文整理汇总了C++中Hydrogen::getPatternPos方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::getPatternPos方法的具体用法?C++ Hydrogen::getPatternPos怎么用?C++ Hydrogen::getPatternPos使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::getPatternPos方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleAction
//.........这里部分代码省略.........
int mult = 1;
bool ok;
mult = pAction->getParameter1().toInt(&ok,10);
Song* pSong = pEngine->getSong();
if (pSong->__bpm < 300) {
pEngine->setBPM( pSong->__bpm + 1*mult );
}
AudioEngine::get_instance()->unlock();
return true;
}
if( sActionString == "BPM_DECR" ){
AudioEngine::get_instance()->lock( RIGHT_HERE );
int mult = 1;
bool ok;
mult = pAction->getParameter1().toInt(&ok,10);
Song* pSong = pEngine->getSong();
if (pSong->__bpm > 40 ) {
pEngine->setBPM( pSong->__bpm - 1*mult );
}
AudioEngine::get_instance()->unlock();
return true;
}
if( sActionString == ">>_NEXT_BAR"){
pEngine->setPatternPos(pEngine->getPatternPos() +1 );
pEngine->setTimelineBpm();
return true;
}
if( sActionString == "<<_PREVIOUS_BAR"){
pEngine->setPatternPos(pEngine->getPatternPos() -1 );
pEngine->setTimelineBpm();
return true;
}
if( sActionString == "PLAYLIST_SONG"){
bool ok;
int songnumber = pAction->getParameter2().toInt(&ok,10);
return setSong( songnumber );
}
if( sActionString == "PLAYLIST_NEXT_SONG"){
int songnumber = Playlist::get_instance()->getActiveSongNumber();
return setSong( ++songnumber );
}
if( sActionString == "PLAYLIST_PREV_SONG"){
int songnumber = Playlist::get_instance()->getActiveSongNumber();
return setSong( --songnumber );
}
if( sActionString == "RECORD_READY"){
if ( pEngine->getState() != STATE_PLAYING ) {
if (!Preferences::get_instance()->getRecordEvents()) {
Preferences::get_instance()->setRecordEvents(true);
}
else {
示例2: rewindBtnClicked
void PlaylistDialog::rewindBtnClicked( Button* ref )
{
UNUSED( ref );
Hydrogen *pEngine = Hydrogen::get_instance();
pEngine->setPatternPos( pEngine->getPatternPos() - 1 );
}
示例3: setPlayingNotelength
void Sampler::setPlayingNotelength( Instrument* instrument, unsigned long ticks, unsigned long noteOnTick )
{
if ( instrument ) { // stop all notes using this instrument
Hydrogen *pEngine = Hydrogen::get_instance();
Song* mSong = pEngine->getSong();
int selectedpattern = pEngine->__get_selected_PatterNumber();
Pattern* currentPattern = NULL;
if ( mSong->get_mode() == Song::PATTERN_MODE ||
( pEngine->getState() != STATE_PLAYING )){
PatternList *pPatternList = mSong->get_pattern_list();
if ( ( selectedpattern != -1 )
&& ( selectedpattern < ( int )pPatternList->size() ) ) {
currentPattern = pPatternList->get( selectedpattern );
}
}else
{
std::vector<PatternList*> *pColumns = mSong->get_pattern_group_vector();
// Pattern *pPattern = NULL;
int pos = pEngine->getPatternPos() +1;
for ( int i = 0; i < pos; ++i ) {
PatternList *pColumn = ( *pColumns )[i];
currentPattern = pColumn->get( 0 );
}
}
if ( currentPattern ) {
int patternsize = currentPattern->get_length();
for ( unsigned nNote = 0; nNote < currentPattern->get_length(); nNote++ ) {
const Pattern::notes_t* notes = currentPattern->get_notes();
FOREACH_NOTE_CST_IT_BOUND(notes,it,nNote) {
Note *pNote = it->second;
if ( pNote!=NULL ) {
if( !Preferences::get_instance()->__playselectedinstrument ){
if ( pNote->get_instrument() == instrument
&& pNote->get_position() == noteOnTick ) {
AudioEngine::get_instance()->lock( RIGHT_HERE );
if ( ticks > patternsize )
ticks = patternsize - noteOnTick;
pNote->set_length( ticks );
Hydrogen::get_instance()->getSong()->__is_modified = true;
AudioEngine::get_instance()->unlock(); // unlock the audio engine
}
}else
{
if ( pNote->get_instrument() == pEngine->getSong()->get_instrument_list()->get( pEngine->getSelectedInstrumentNumber())
&& pNote->get_position() == noteOnTick ) {
AudioEngine::get_instance()->lock( RIGHT_HERE );
if ( ticks > patternsize )
ticks = patternsize - noteOnTick;
pNote->set_length( ticks );
Hydrogen::get_instance()->getSong()->__is_modified = true;
AudioEngine::get_instance()->unlock(); // unlock the audio engine
}
}
}
}
}
}
}
示例4: RewindBtnClicked
void PlayerControl::RewindBtnClicked( Button* )
{
Hydrogen *pEngine = Hydrogen::get_instance();
pEngine->setPatternPos( pEngine->getPatternPos() - 1 );
Hydrogen::get_instance()->setTimelineBpm();
}