-
Notifications
You must be signed in to change notification settings - Fork 424
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wait until sample gets loaded in SampleSDL2
- Loading branch information
Showing
2 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
// Copyright (c) ppy Pty Ltd <[email protected]>. Licensed under the MIT Licence. | ||
// See the LICENCE file in the repository root for full licence text. | ||
|
||
using System.Threading.Tasks; | ||
using osu.Framework.Bindables; | ||
|
||
namespace osu.Framework.Audio.Sample | ||
|
@@ -22,12 +23,18 @@ internal abstract class SampleFactory : AudioCollectionManager<AdjustableAudioCo | |
/// </summary> | ||
internal readonly Bindable<int> PlaybackConcurrency = new Bindable<int>(Sample.DEFAULT_CONCURRENCY); | ||
|
||
protected Task? LoadSampleTask; | ||
|
||
protected SampleFactory(string name, int playbackConcurrency) | ||
{ | ||
Name = name; | ||
PlaybackConcurrency.Value = playbackConcurrency; | ||
|
||
EnqueueAction(LoadSample); | ||
LoadSampleTask = EnqueueAction(() => | ||
{ | ||
LoadSample(); | ||
LoadSampleTask = null; | ||
}); | ||
|
||
PlaybackConcurrency.BindValueChanged(UpdatePlaybackConcurrency); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters