1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 04:02:59 +08:00

Nest temporary class

This commit is contained in:
Dean Herbert 2019-09-06 12:12:27 +09:00
parent 7d1f5310d2
commit bf6f803e69
2 changed files with 49 additions and 54 deletions

View File

@ -11,10 +11,13 @@ using osu.Game.Rulesets.Objects;
using osu.Game.Rulesets.Objects.Drawables;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Cursor;
@ -465,4 +468,50 @@ namespace osu.Game.Rulesets.UI
{
}
}
/// <summary>
/// A sample store which adds a fallback source.
/// </summary>
/// <remarks>
/// This is a temporary implementation to workaround ISampleStore limitations.
/// </remarks>
public class FallbackSampleStore : ISampleStore
{
private readonly ISampleStore primary;
private readonly ISampleStore secondary;
public FallbackSampleStore(ISampleStore primary, ISampleStore secondary)
{
this.primary = primary;
this.secondary = secondary;
}
public SampleChannel Get(string name) => primary.Get(name) ?? secondary.Get(name);
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? secondary.GetAsync(name);
public Stream GetStream(string name) => primary.GetStream(name) ?? secondary.GetStream(name);
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => throw new NotImplementedException();
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => throw new NotImplementedException();
public BindableDouble Volume => throw new NotImplementedException();
public BindableDouble Balance => throw new NotImplementedException();
public BindableDouble Frequency => throw new NotImplementedException();
public int PlaybackConcurrency
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public void Dispose()
{
}
}
}

View File

@ -1,54 +0,0 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading.Tasks;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track;
using osu.Framework.Bindables;
namespace osu.Game.Rulesets.UI
{
public class FallbackSampleStore : ISampleStore
{
private readonly ISampleStore primary;
private readonly ISampleStore secondary;
public FallbackSampleStore(ISampleStore primary, ISampleStore secondary)
{
this.primary = primary;
this.secondary = secondary;
}
public SampleChannel Get(string name) => primary.Get(name) ?? secondary.Get(name);
public Task<SampleChannel> GetAsync(string name) => primary.GetAsync(name) ?? secondary.GetAsync(name);
public Stream GetStream(string name) => primary.GetStream(name) ?? secondary.GetStream(name);
public IEnumerable<string> GetAvailableResources() => throw new NotImplementedException();
public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => throw new NotImplementedException();
public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => throw new NotImplementedException();
public BindableDouble Volume => throw new NotImplementedException();
public BindableDouble Balance => throw new NotImplementedException();
public BindableDouble Frequency => throw new NotImplementedException();
public int PlaybackConcurrency
{
get => throw new NotImplementedException();
set => throw new NotImplementedException();
}
public void Dispose()
{
}
}
}