A game framework written with osu! in mind.
at master 38 lines 1.4 kB view raw
1// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. 2// See the LICENCE file in the repository root for full licence text. 3 4using System; 5using osu.Framework.Bindables; 6 7namespace osu.Framework.Audio 8{ 9 public static class AggregateAdjustmentExtensions 10 { 11 /// <summary> 12 /// Get the aggregate result for a specific adjustment type. 13 /// </summary> 14 /// <param name="adjustment">The audio adjustments to return from.</param> 15 /// <param name="type">The adjustment type.</param> 16 /// <returns>The aggregate result.</returns> 17 public static IBindable<double> GetAggregate(this IAggregateAudioAdjustment adjustment, AdjustableProperty type) 18 { 19 switch (type) 20 { 21 case AdjustableProperty.Volume: 22 return adjustment.AggregateVolume; 23 24 case AdjustableProperty.Balance: 25 return adjustment.AggregateBalance; 26 27 case AdjustableProperty.Frequency: 28 return adjustment.AggregateFrequency; 29 30 case AdjustableProperty.Tempo: 31 return adjustment.AggregateTempo; 32 33 default: 34 throw new ArgumentOutOfRangeException(nameof(type), "Invalid adjustable property type."); 35 } 36 } 37 } 38}