From 322b0616322760dc162447563d8f4da7e024ca90 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 7 Jan 2014 21:39:47 +0100 Subject: DetachedSong: fork of struct Song From now on, struct Song will be used by the database only, and DetachedSong will be used by everybody else. DetachedSong is easier to use, but Song has lower overhead. --- src/DecoderControl.cxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'src/DecoderControl.cxx') diff --git a/src/DecoderControl.cxx b/src/DecoderControl.cxx index b63dba3a0..4e5e894e3 100644 --- a/src/DecoderControl.cxx +++ b/src/DecoderControl.cxx @@ -20,7 +20,7 @@ #include "config.h" #include "DecoderControl.hxx" #include "MusicPipe.hxx" -#include "Song.hxx" +#include "DetachedSong.hxx" #include @@ -36,8 +36,7 @@ DecoderControl::~DecoderControl() { ClearError(); - if (song != nullptr) - song->Free(); + delete song; } void @@ -53,7 +52,7 @@ DecoderControl::WaitForDecoder() } bool -DecoderControl::IsCurrentSong(const Song &_song) const +DecoderControl::IsCurrentSong(const DetachedSong &_song) const { switch (state) { case DecoderState::STOP: @@ -62,7 +61,7 @@ DecoderControl::IsCurrentSong(const Song &_song) const case DecoderState::START: case DecoderState::DECODE: - return SongEquals(*song, _song); + return song->IsSame(_song); } assert(false); @@ -70,16 +69,14 @@ DecoderControl::IsCurrentSong(const Song &_song) const } void -DecoderControl::Start(Song *_song, +DecoderControl::Start(DetachedSong *_song, unsigned _start_ms, unsigned _end_ms, MusicBuffer &_buffer, MusicPipe &_pipe) { assert(_song != nullptr); assert(_pipe.IsEmpty()); - if (song != nullptr) - song->Free(); - + delete song; song = _song; start_ms = _start_ms; end_ms = _end_ms; -- cgit v1.2.3