Skip to content

Commit

Permalink
Fix tracks no longer getting processed when they complete playback
Browse files Browse the repository at this point in the history
Tracks have more manual lifetime management and should not be removed from their parent until disposed.
  • Loading branch information
peppy committed Dec 4, 2017
1 parent e21fc5e commit c4de425
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion osu.Framework/Audio/AudioCollectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected override void UpdateState()
{
var item = Items[i];

if (item.HasCompleted)
if (!item.IsAlive)
{
Items.RemoveAt(i--);
continue;
Expand Down
9 changes: 7 additions & 2 deletions osu.Framework/Audio/AudioComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,14 @@ public void Update()
}

/// <summary>
/// The component has completed its task and is potentially no longer needed.
/// This component has completed playback and is now in a stopped state.
/// </summary>
public virtual bool HasCompleted => IsDisposed;
public virtual bool HasCompleted => !IsAlive;

/// <summary>
/// This component has completed all processing and is ready to be removed from its parent.
/// </summary>
public virtual bool IsAlive => !IsDisposed;

public virtual bool IsLoaded => true;

Expand Down
2 changes: 1 addition & 1 deletion osu.Framework/Audio/Sample/SampleChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ protected override void UpdateState()

public virtual bool Played => WasStarted && !Playing;

public override bool HasCompleted => base.HasCompleted || Played;
public override bool IsAlive => base.IsAlive && !Played;
}
}

0 comments on commit c4de425

Please sign in to comment.