本文整理汇总了C++中Hydrogen::getSelectedPatternNumber方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::getSelectedPatternNumber方法的具体用法?C++ Hydrogen::getSelectedPatternNumber怎么用?C++ Hydrogen::getSelectedPatternNumber使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::getSelectedPatternNumber方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: upBtnClicked
///
/// Move up a pattern in the patternList
///
void SongEditorPanel::upBtnClicked( Button* btn )
{
UNUSED( btn );
Hydrogen *pEngine = Hydrogen::get_instance();
if( pEngine->getSelectedPatternNumber() < 0 || !pEngine->getSelectedPatternNumber() ) return;
int nSelectedPatternPos = pEngine->getSelectedPatternNumber();
SE_movePatternListItemAction *action = new SE_movePatternListItemAction( nSelectedPatternPos, nSelectedPatternPos -1 ) ;
HydrogenApp::get_instance()->m_undoStack->push( action );
}
示例2: downBtnClicked
///
/// Move down a pattern in the patternList
///
void SongEditorPanel::downBtnClicked( Button* btn )
{
UNUSED( btn );
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
PatternList *pPatternList = pSong->get_pattern_list();
if( pEngine->getSelectedPatternNumber() +1 >= pSong->get_pattern_list()->size() ) return;
int nSelectedPatternPos = pEngine->getSelectedPatternNumber();
SE_movePatternListItemAction *action = new SE_movePatternListItemAction( nSelectedPatternPos, nSelectedPatternPos +1 ) ;
HydrogenApp::get_instance()->m_undoStack->push( action );
}
示例3: revertaddEmptyPattern
void SongEditorPanel::revertaddEmptyPattern( int idx )
{
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
PatternList *pPatternList = pSong->get_pattern_list();
H2Core::Pattern *pPattern = pPatternList->get( idx );
if( idx == pEngine->getSelectedPatternNumber() ) pEngine->setSelectedPatternNumber( idx -1 );
pPatternList->del( pPattern );
delete pPattern;
pSong->set_is_modified( true );
updateAll();
}
示例4: getCurrentPattern
H2Core::Pattern* InstrumentLine::getCurrentPattern()
{
Hydrogen *pEngine = Hydrogen::get_instance();
PatternList *pPatternList = pEngine->getSong()->get_pattern_list();
assert( pPatternList != NULL );
int nSelectedPatternNumber = pEngine->getSelectedPatternNumber();
if ( nSelectedPatternNumber != -1 ) {
Pattern* pCurrentPattern = pPatternList->get( nSelectedPatternNumber );
return pCurrentPattern;
}
return NULL;
}
示例5: functionClearNotes
void InstrumentLine::functionClearNotes()
{
Hydrogen * pEngine = Hydrogen::get_instance();
int selectedPatternNr = pEngine->getSelectedPatternNumber();
Pattern *pPattern = getCurrentPattern();
Instrument *pSelectedInstrument = pEngine->getSong()->get_instrument_list()->get( m_nInstrumentNumber );
std::list< Note* > noteList;
const Pattern::notes_t* notes = pPattern->get_notes();
FOREACH_NOTE_CST_IT_BEGIN_END(notes,it) {
Note *pNote = it->second;
assert( pNote );
if ( pNote->get_instrument() == pSelectedInstrument ) {
noteList.push_back( pNote );
}
}
示例6: action_file_export_pattern_as
void MainForm::action_file_export_pattern_as()
{
if ( ( Hydrogen::get_instance()->getState() == STATE_PLAYING ) )
{
Hydrogen::get_instance()->sequencer_stop();
}
Hydrogen *engine = Hydrogen::get_instance();
int selectedpattern = engine->getSelectedPatternNumber();
Song *song = engine->getSong();
Pattern *pat = song->get_pattern_list()->get ( selectedpattern );
Instrument *instr = song->get_instrument_list()->get ( 0 );
assert ( instr );
QDir dir = Preferences::get_instance()->__lastspatternDirectory;
QFileDialog fd(this);
fd.setFileMode ( QFileDialog::AnyFile );
fd.setFilter ( trUtf8 ( "Hydrogen Pattern (*.h2pattern)" ) );
fd.setAcceptMode ( QFileDialog::AcceptSave );
fd.setWindowTitle ( trUtf8 ( "Save Pattern as ..." ) );
fd.setDirectory ( dir );
fd.setSidebarUrls( fd.sidebarUrls() << QUrl::fromLocalFile( Filesystem::patterns_dir() ) );
QString defaultPatternname = QString ( pat->get_name() );
fd.selectFile ( defaultPatternname );
LocalFileMng fileMng;
QString filename;
if ( fd.exec() == QDialog::Accepted )
{
filename = fd.selectedFiles().first();
QString tmpfilename = filename;
QString toremove = tmpfilename.section( '/', -1 );
QString newdatapath = tmpfilename.replace( toremove, "" );
Preferences::get_instance()->__lastspatternDirectory = newdatapath;
}
if ( !filename.isEmpty() )
{
QString sNewFilename = filename;
if(sNewFilename.endsWith( ".h2pattern" ) ){
sNewFilename += "";
}
else{
sNewFilename += ".h2pattern";
}
QString patternname = sNewFilename;
QString realpatternname = filename;
QString realname = realpatternname.mid( realpatternname.lastIndexOf( "/" ) + 1 );
if ( realname.endsWith( ".h2pattern" ) )
realname.replace( ".h2pattern", "" );
pat->set_name(realname);
HydrogenApp::get_instance()->getSongEditorPanel()->updateAll();
int err = fileMng.savePattern ( song, engine->getCurrentDrumkitname(), selectedpattern, patternname, realname, 2 );
if ( err != 0 )
{
QMessageBox::warning( this, "Hydrogen", trUtf8("Could not export pattern.") );
_ERRORLOG ( "Error saving the pattern" );
}
}
h2app->setStatusBarMessage ( trUtf8 ( "Pattern saved." ), 10000 );
//update SoundlibraryPanel
HydrogenApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->test_expandedItems();
HydrogenApp::get_instance()->getInstrumentRack()->getSoundLibraryPanel()->updateDrumkitList();
}
示例7: handleAction
//.........这里部分代码省略.........
}
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;
}
if( sActionString == "SELECT_NEXT_PATTERN_RELATIVE" ){
bool ok;
if(!Preferences::get_instance()->patternModePlaysSelected())
{
return true;
}
int row = pEngine->getSelectedPatternNumber() + pAction->getParameter1().toInt(&ok,10);
if( row> pEngine->getSong()->get_pattern_list()->size() -1 )
{
return false;
}
pEngine->setSelectedPatternNumber( row );
return true;
}
if( sActionString == "SELECT_PREV_PATTERN_RELATIVE" ){
bool ok;
if(!Preferences::get_instance()->patternModePlaysSelected())
return true;
int row = pEngine->getSelectedPatternNumber() - pAction->getParameter1().toInt(&ok,10);
if( row < 0 )
return false;
pEngine->setSelectedPatternNumber( row );
return true;
}
if( sActionString == "SELECT_NEXT_PATTERN_CC_ABSOLUT" ){
bool ok;
int row = pAction->getParameter2().toInt(&ok,10);
if( row> pEngine->getSong()->get_pattern_list()->size() -1 )
return false;
if(Preferences::get_instance()->patternModePlaysSelected())
pEngine->setSelectedPatternNumber( row );
else
return true;// only usefully in normal pattern mode
示例8: newPatBtnClicked
///
/// Create a new pattern
///
void SongEditorPanel::newPatBtnClicked( Button* btn )
{
UNUSED( btn );
Hydrogen *pEngine = Hydrogen::get_instance();
Song *pSong = pEngine->getSong();
PatternList *pPatternList = pSong->get_pattern_list();
Pattern *pNewPattern = new Pattern( trUtf8("Pattern %1").arg(pPatternList->size()+1));
PatternPropertiesDialog *pDialog = new PatternPropertiesDialog( this, pNewPattern, 0, true );
if ( pDialog->exec() == QDialog::Accepted ) {
SE_addEmptyPatternAction*action =
new SE_addEmptyPatternAction( pNewPattern->get_name() , pNewPattern->get_info(), pNewPattern->get_category(), pEngine->getSelectedPatternNumber()+1);
HydrogenApp::get_instance()->m_undoStack->push( action );
}
delete pNewPattern;
delete pDialog;
}