本文整理汇总了C++中Hydrogen::setSong方法的典型用法代码示例。如果您正苦于以下问题:C++ Hydrogen::setSong方法的具体用法?C++ Hydrogen::setSong怎么用?C++ Hydrogen::setSong使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Hydrogen
的用法示例。
在下文中一共展示了Hydrogen::setSong方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadSong
/* This method is called by Event dispacher thread ( GUI ) */
bool Playlist::loadSong (int songNumber)
{
Hydrogen* pHydrogen = Hydrogen::get_instance();
Preferences *pPref = Preferences::get_instance();
if ( pHydrogen->getState() == STATE_PLAYING )
pHydrogen->sequencer_stop();
/* Load Song from file */
QString selected = pHydrogen->m_PlayList[ songNumber ].m_hFile;
Song *pSong = Song::load( selected );
if ( ! pSong ) return false;
setSelectedSongNr( songNumber );
setActiveSongNumber( songNumber );
pHydrogen->setSong( pSong );
pPref->setLastSongFilename( pSong->get_filename() );
vector<QString> recentFiles = pPref->getRecentFiles();
recentFiles.insert( recentFiles.begin(), selected );
pPref->setRecentFiles( recentFiles );
execScript( songNumber );
return true;
}
示例2: main
//.........这里部分代码省略.........
if ( ! playlistFilename.isEmpty() ) {
pPlaylist = Playlist::load ( playlistFilename );
if ( ! pPlaylist ) {
___ERRORLOG( "Error loading the playlist" );
return 0;
}
/* Load first song */
preferences->setLastPlaylistFilename( playlistFilename );
pPlaylist->loadSong( 0 );
pSong = pHydrogen->getSong();
show_playlist ( pHydrogen, pPlaylist->getActiveSongNumber() );
}
// Load song - if wasn't already loaded with playlist
if ( ! pSong ) {
if ( !songFilename.isEmpty() ) {
pSong = Song::load( songFilename );
} else {
/* Try load last song */
bool restoreLastSong = preferences->isRestoreLastSongEnabled();
QString filename = preferences->getLastSongFilename();
if ( restoreLastSong && ( !filename.isEmpty() ))
pSong = Song::load( filename );
}
/* Still not loaded */
if (! pSong) {
___INFOLOG("Starting with empty song");
pSong = Song::get_empty_song();
pSong->set_filename( "" );
}
pHydrogen->setSong( pSong );
preferences->setLastSongFilename( songFilename );
}
if ( ! drumkitToLoad.isEmpty() ){
Drumkit* drumkitInfo = Drumkit::load_by_name( drumkitToLoad, true );
if ( drumkitInfo ) {
pHydrogen->loadDrumkit( drumkitInfo );
} else {
___ERRORLOG ( "Error loading the drumkit" );
}
}
AudioEngine* AudioEngine = AudioEngine::get_instance();
Sampler* sampler = AudioEngine->get_sampler();
switch ( interpolation ) {
case 1:
sampler->setInterpolateMode( Sampler::COSINE );
break;
case 2:
sampler->setInterpolateMode( Sampler::THIRD );
break;
case 3:
sampler->setInterpolateMode( Sampler::CUBIC );
break;
case 4:
sampler->setInterpolateMode( Sampler::HERMITE );
break;
case 0:
default:
sampler->setInterpolateMode( Sampler::LINEAR );
}