libsaria: Don't track playlist length

There is no reason to track this on my own, iterating over all tracks
and calculating it on the fly is easier and basically unnoticable.

Signed-off-by: Bryan Schumaker <bjschuma@gmail.com>
This commit is contained in:
Bryan Schumaker 2012-11-03 15:59:54 -04:00
parent d9e343895c
commit 52c09ddb12
3 changed files with 4 additions and 6 deletions

View File

@ -30,7 +30,6 @@ namespace libsaria
private:
int number;
unsigned int flags;
unsigned int length;
DataState data_state;
unsigned int cur;
Index index;

View File

@ -17,7 +17,6 @@ namespace libsaria
void Playlist::add_track(Track *track, unsigned int ins_index)
{
length += (*track)[TRACK_LENGTH];
index.add_track(track);
track->add_playlist(this);
notify_ui(PLAYLIST_ADD, track, ins_index);
@ -31,8 +30,6 @@ namespace libsaria
unsigned int Playlist::remove_track_it(vector<Track *>::iterator it,
unsigned int rm_index)
{
Track *track = *it;
length -= (*track)[TRACK_LENGTH];
index.remove_track(*it);
(*it)->rm_playlist(this);
it = plist.erase(it);

View File

@ -11,7 +11,6 @@ namespace libsaria
{
number = -1;
flags = f;
length = 0;
cur = 0;
}
@ -117,7 +116,10 @@ namespace libsaria
unsigned int Playlist::get_length()
{
return length;
unsigned int res = 0;
for (unsigned int i = 0; i < plist.size(); i++)
res += (*plist[i])[TRACK_LENGTH];
return res;
}
void Playlist::reset_iterator()