本文整理汇总了C++中Playlist::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Playlist::begin方法的具体用法?C++ Playlist::begin怎么用?C++ Playlist::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Playlist
的用法示例。
在下文中一共展示了Playlist::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: database
int
main(int argc, char *argv[])
{
if (argc != PARAMS+1)
usage(argv[0]);
SimilarityStrategy similarity;
SQLiteDatabase database(argv[1]);
OptionList options("",1,3000,0,0,0,0,25);
Generator generator(database, similarity);
if(generator.initialization() == 0)
{
cout << "Erreur d'initialisation" << endl;
exit(EXIT_FAILURE);
}
Playlist playlist = generator.generate(options);
auto first = playlist.begin();
int i = 1;
for(auto it = playlist.begin(); it != playlist.end(); ++it)
cout << "Similarité entre le morceau 1 et " << i++ << " : " << similarity.compute(*first,*it) << endl;
return EXIT_SUCCESS;
}
示例2: regenerate
Playlist Generator::regenerate(OptionList optionList, Playlist playlist)
{
//Recupération d'une pool de morceaux
TrackPool pool = db.select(optionList,optionList.getSize()*POOL_SIZE_FACTOR);
selectionFeedback.notifyAll(pool.size(), pool);
if(pool.size() == 0)
return playlist;
//On remplit la pool avec les morceaux de la playlist précédente
for(auto it = playlist.begin(); it != playlist.end(); ++it)
pool.insert(*it);
Playlist newPlaylist;
//On lance la génération
generationLoop(&newPlaylist, pool, optionList.getSize());
return newPlaylist;
}
示例3: database
int
main(int argc, char *argv[])
{
if (argc != PARAMS+1)
usage(argv[0]);
int k = atoi(argv[2]);
SimilarityStrategy similarity;
SQLiteDatabase database(argv[1]);
OptionList options("",1,3000,0,0,0,0,25);
Generator generator(database, similarity);
if(generator.initialization() == 0)
{
cout << "Erreur d'initialisation" << endl;
exit(EXIT_FAILURE);
}
Playlist playlist = generator.generate(options);
int i = 1;
auto it = playlist.begin();
for(int n = 0; n < k-1; n++)
{
++i; ++it;
}
while(it != playlist.end())
{
++it; ++i;
auto next = it; ++next;
auto previous = it;
for(int n = 0; n < k; n++)
{
--previous;
}
if(next != playlist.end() && it != playlist.end())
{
cout << "Similarité entre le le morceau " << i << " et le morceau " << i+1 << " : " << similarity.compute(*it,*next) << endl;
cout << "Similarité entre le le morceau " << i-k << " et le morceau " << i+1 << " : " << similarity.compute(*previous,*next) << endl;
cout << "Différence " << i << "-" << i+1 << " | " << i-k << "-" << i+1 << " : "<< similarity.compute(*it,*next)-similarity.compute(*previous,*next) << endl;
}
}
return EXIT_SUCCESS;
}
示例4: print_playlist
void print_playlist(gPlay* player)
{
int ctr = 1;
Playlist playlist = player->getPlaylist();
Playlist::const_iterator playlistPosition = player->playlistPosition();
g_print("============= PLAYLIST =============\n");
for ( Playlist::const_iterator pos = playlist.begin(); pos != playlist.end(); ++pos){
const Track* t = *pos;
if (t->title.length() == 0){
gchar* filename = g_filename_from_uri(t->uri.c_str(), NULL, NULL);
gchar* basename = g_path_get_basename(filename);
if ( g_strcmp0((*pos)->uri.c_str(), (*playlistPosition)->uri.c_str()) == 0 ){
g_print("\033[31m%02d - %s by %s\033[39m\n", ctr, basename, t->artist.c_str());
}
else
g_print("%02d - %s by %s\n", ctr, basename, t->artist.c_str());
g_free(basename);
g_free(filename);
}
else{
if ( g_strcmp0((*pos)->uri.c_str(), (*playlistPosition)->uri.c_str()) == 0){
g_print("\033[31m%02d - %s by %s\n\033[39m", ctr, t->title.c_str(), t->artist.c_str());
}
else
g_print("%02d - %s by %s\n", ctr, t->title.c_str(), t->artist.c_str());
}
++ctr;
}
g_print("====================================\n");
}