libsaria: Implement a next() function

This will pick the next song from the library to play.
This commit is contained in:
Bryan Schumaker 2011-11-06 19:17:15 -05:00
parent 9379a2cf33
commit e908f46c21
4 changed files with 31 additions and 0 deletions

View File

@ -0,0 +1,9 @@
#ifndef LIBSARIA_CONTROLS_H
#define LIBSARIA_CONTROLS_H
namespace libsaria
{
void next();
};
#endif /* LIBSARIA_CONTROLS_H */

View File

@ -23,6 +23,7 @@ namespace libsaria
void update_path(string);
void refresh();
void next();
void add_path(string);
void remove_path(string);
void play_id(ino_t &);

13
libsaria/controls.cpp Normal file
View File

@ -0,0 +1,13 @@
#include <libsaria/controls.h>
#include <libsaria/library.h>
namespace libsaria
{
void next()
{
library::next();
}
}; /* Namespace: libsaria */

View File

@ -119,6 +119,14 @@ namespace libsaria
return false;
}
void library::next()
{
cur_track++;
if (cur_track == play_list.end())
cur_track = play_list.begin();
libsaria::audio::load((*cur_track)->get_filepath());
}
unsigned int library::size()
{
return play_list.size();