mirror of
https://github.com/clangen/musikcube.git
synced 2025-02-14 18:40:48 +00:00
Fixed bugs in auto-stop when arriving at the end of the playlist.
This commit is contained in:
parent
01c9b6cb3b
commit
39086c6145
@ -269,13 +269,29 @@ void CrossfadeTransport::OnPlayerError(Player* player) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void CrossfadeTransport::OnPlayerMixPoint(Player* player, int id, double time) {
|
void CrossfadeTransport::OnPlayerMixPoint(Player* player, int id, double time) {
|
||||||
if (id == END_OF_TRACK_MIXPOINT) {
|
bool stopped = false;
|
||||||
if (player == active.player) {
|
|
||||||
active.Reset(); /* fades out automatically */
|
{
|
||||||
next.TransferTo(active);
|
Lock lock(this->stateMutex);
|
||||||
active.Start(this->volume);
|
|
||||||
|
if (id == END_OF_TRACK_MIXPOINT) {
|
||||||
|
if (player == active.player) {
|
||||||
|
active.Reset(); /* fades out automatically */
|
||||||
|
next.TransferTo(active);
|
||||||
|
|
||||||
|
if (!active.IsEmpty()) {
|
||||||
|
active.Start(this->volume);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
stopped = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (stopped) {
|
||||||
|
this->SetPlaybackState(PlaybackStopped);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void CrossfadeTransport::OnCrossfaderEmptied() {
|
void CrossfadeTransport::OnCrossfaderEmptied() {
|
||||||
@ -335,9 +351,6 @@ void CrossfadeTransport::PlayerContext::Reset(
|
|||||||
Crossfader::FadeOut,
|
Crossfader::FadeOut,
|
||||||
CROSSFADE_DURATION_MS);
|
CROSSFADE_DURATION_MS);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
this->player->Destroy();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this->canFade = this->started = false;
|
this->canFade = this->started = false;
|
||||||
@ -348,6 +361,8 @@ void CrossfadeTransport::PlayerContext::Reset(
|
|||||||
void CrossfadeTransport::PlayerContext::TransferTo(PlayerContext& to) {
|
void CrossfadeTransport::PlayerContext::TransferTo(PlayerContext& to) {
|
||||||
to.player = player;
|
to.player = player;
|
||||||
to.output = output;
|
to.output = output;
|
||||||
|
to.canFade = canFade;
|
||||||
|
to.started = started;
|
||||||
|
|
||||||
/* don't call Reset() here! it'll trigger a fade. */
|
/* don't call Reset() here! it'll trigger a fade. */
|
||||||
this->canFade = false;
|
this->canFade = false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user