Fix sample store creation mutating shared resource store

This commit is contained in:
Bartłomiej Dach 2023-01-28 21:16:22 +01:00
parent a8f828d203
commit c5e1f54185
No known key found for this signature in database
3 changed files with 10 additions and 3 deletions

View File

@ -150,6 +150,8 @@ public void Dispose()
public IBindable<double> AggregateTempo => throw new NotImplementedException();
public int PlaybackConcurrency { get; set; }
public void AddExtension(string extension) => throw new NotImplementedException();
}
private class TestShaderManager : ShaderManager

View File

@ -157,6 +157,8 @@ public int PlaybackConcurrency
set => throw new NotSupportedException();
}
public void AddExtension(string extension) => throw new NotSupportedException();
public void Dispose()
{
if (primary.IsNotNull()) primary.Dispose();

View File

@ -69,12 +69,15 @@ protected Skin(SkinInfo skin, IStorageResourceProvider? resources, IResourceStor
storage ??= realmBackedStorage = new RealmBackedResourceStore<SkinInfo>(SkinInfo, resources.Files, resources.RealmAccess);
var samples = resources.AudioManager?.GetSampleStore(storage);
if (samples != null)
{
samples.PlaybackConcurrency = OsuGameBase.SAMPLE_CONCURRENCY;
// osu-stable performs audio lookups in order of wav -> mp3 -> ogg.
// The GetSampleStore() call above internally adds wav and mp3, so ogg is added at the end to ensure expected ordering.
(storage as ResourceStore<byte[]>)?.AddExtension("ogg");
// osu-stable performs audio lookups in order of wav -> mp3 -> ogg.
// The GetSampleStore() call above internally adds wav and mp3, so ogg is added at the end to ensure expected ordering.
samples.AddExtension(@"ogg");
}
Samples = samples;
Textures = new TextureStore(resources.Renderer, new MaxDimensionLimitedTextureLoaderStore(resources.CreateTextureLoaderStore(storage)));