Skip to content

Commit

Permalink
Merge pull request #1227 from peppy/fix-early-track-disposal
Browse files Browse the repository at this point in the history
Fix tracks no longer getting processed when they complete playback
  • Loading branch information
smoogipoo authored Dec 4, 2017
2 parents e21fc5e + c4de425 commit d2c6d11
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 d2c6d11

Please sign in to comment.