1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 09:27:34 +08:00

Remove local workarounds to attempt to avoid crashes on skin change

This commit is contained in:
Dean Herbert 2021-03-22 14:05:37 +09:00
parent 09bc7267c0
commit 073dba5330

View File

@ -7,7 +7,6 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
@ -462,7 +461,7 @@ namespace osu.Game.Skinning
var sample = Samples?.Get(lookup);
if (sample != null)
return new LegacySkinSample(sample, this);
return sample;
}
return null;
@ -505,78 +504,5 @@ namespace osu.Game.Skinning
Textures?.Dispose();
Samples?.Dispose();
}
/// <summary>
/// A sample wrapper which keeps a reference to the contained skin to avoid finalizer garbage collection of the managing SampleStore.
/// </summary>
private class LegacySkinSample : ISample, IDisposable
{
private readonly Sample sample;
[UsedImplicitly]
private readonly LegacySkin skin;
public LegacySkinSample(Sample sample, LegacySkin skin)
{
this.sample = sample;
this.skin = skin;
}
public SampleChannel Play()
{
return sample.Play();
}
public SampleChannel GetChannel()
{
return sample.GetChannel();
}
public double Length => sample.Length;
public Bindable<int> PlaybackConcurrency => sample.PlaybackConcurrency;
public BindableNumber<double> Volume => sample.Volume;
public BindableNumber<double> Balance => sample.Balance;
public BindableNumber<double> Frequency => sample.Frequency;
public BindableNumber<double> Tempo => sample.Tempo;
public void BindAdjustments(IAggregateAudioAdjustment component)
{
sample.BindAdjustments(component);
}
public void UnbindAdjustments(IAggregateAudioAdjustment component)
{
sample.UnbindAdjustments(component);
}
public void AddAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
{
sample.AddAdjustment(type, adjustBindable);
}
public void RemoveAdjustment(AdjustableProperty type, IBindable<double> adjustBindable)
{
sample.RemoveAdjustment(type, adjustBindable);
}
public void RemoveAllAdjustments(AdjustableProperty type)
{
sample.RemoveAllAdjustments(type);
}
public IBindable<double> AggregateVolume => sample.AggregateVolume;
public IBindable<double> AggregateBalance => sample.AggregateBalance;
public IBindable<double> AggregateFrequency => sample.AggregateFrequency;
public IBindable<double> AggregateTempo => sample.AggregateTempo;
public void Dispose() => sample.Dispose();
}
}
}