本文整理汇总了C++中Hydrogen::getCurrentDrumkitname方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::getCurrentDrumkitname方法的具体用法?C++ Hydrogen::getCurrentDrumkitname怎么用?C++ Hydrogen::getCurrentDrumkitname使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::getCurrentDrumkitname方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: functionDeleteInstrument
void MainForm::functionDeleteInstrument(int instrument)
{
Hydrogen * H = Hydrogen::get_instance();
Instrument *pSelectedInstrument = H->getSong()->get_instrument_list()->get( instrument );
std::list< Note* > noteList;
Song* song = H->getSong();
PatternList *patList = song->get_pattern_list();
QString instrumentName = pSelectedInstrument->get_name();
QString drumkitName = H->getCurrentDrumkitname();
for ( int i = 0; i < patList->size(); i++ ) {
H2Core::Pattern *pPattern = song->get_pattern_list()->get(i);
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 ) {
pNote->set_pattern_idx( i );
noteList.push_back( pNote );
}
}
}
示例2: 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();
}