本文整理汇总了C++中Hydrogen::__get_selected_PatterNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::__get_selected_PatterNumber方法的具体用法?C++ Hydrogen::__get_selected_PatterNumber怎么用?C++ Hydrogen::__get_selected_PatterNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::__get_selected_PatterNumber方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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
}
}
}
}
}
}
}