-
Notifications
You must be signed in to change notification settings - Fork 425
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Expose async track Start
/Stop
/Play
/Restart
methods
#5294
Conversation
Sample usage at https://github.com/ppy/osu/compare/master...peppy:osu:async-track-operations?expand=1. I'm not sure this is the correct direction to take with audio threading in general, but it's definitely the path of least resistance with how things stand at the moment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rest looks fine
public override Task StopAsync() | ||
{ | ||
stopInternal(); | ||
isRunning = isPlayed = false; | ||
}); | ||
return EnqueueAction(() => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure about not calling the base
method... Both here and in TrackVirtual
's overrides... If I were to guess, you did this because you don't want the overhead.
I suppose it's fine for now... It's basically a smoking gun if Track
itself ever gets changed to do something (like a disposal check) there.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah it's a bit weird. Could change Stop
to be abstract
instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably all of them abstract yeah? I mean the existing TrackVirtual.Start()
also elides the base call which does an IsDisposed
check. Going by that, it should just be moved to TrackBass
.
osu.Framework/Audio/Track/Track.cs
Outdated
await StopAsync().ConfigureAwait(false); | ||
await SeekAsync(RestartPoint).ConfigureAwait(false); | ||
await StartAsync().ConfigureAwait(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure how correct this is, because it's 3 different async operations rather than a grouped one. Have you considered the following instead?:
EnqueueAction(() =>
{
Stop();
Seek();
Start();
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might work better yeah.
No description provided.