Remove LINQ calls in hot paths

This commit is contained in:
Dean Herbert 2024-01-05 03:22:19 +09:00
parent b809d4c068
commit 9d9e6fcfdb
No known key found for this signature in database
1 changed files with 26 additions and 2 deletions

View File

@ -194,9 +194,33 @@ private void updateSamples()
/// <summary>
/// Whether any samples are currently playing.
/// </summary>
public bool IsPlaying => samplesContainer.Any(s => s.Playing);
public bool IsPlaying
{
get
{
foreach (PoolableSkinnableSample s in samplesContainer)
{
if (s.Playing)
return true;
}
public bool IsPlayed => samplesContainer.Any(s => s.Played);
return false;
}
}
public bool IsPlayed
{
get
{
foreach (PoolableSkinnableSample s in samplesContainer)
{
if (s.Played)
return true;
}
return false;
}
}
public IBindable<double> AggregateVolume => samplesContainer.AggregateVolume;