コード例 #1
0
        public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => EnqueueAction(() =>
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                if (balanceAdjustments.Contains(adjustBindable))
                {
                    throw new ArgumentException("An adjustable binding may only be registered once.");
                }

                balanceAdjustments.Add(adjustBindable);
                break;

            case AdjustableProperty.Frequency:
                if (frequencyAdjustments.Contains(adjustBindable))
                {
                    throw new ArgumentException("An adjustable binding may only be registered once.");
                }

                frequencyAdjustments.Add(adjustBindable);
                break;

            case AdjustableProperty.Volume:
                if (volumeAdjustments.Contains(adjustBindable))
                {
                    throw new ArgumentException("An adjustable binding may only be registered once.");
                }

                volumeAdjustments.Add(adjustBindable);
                break;
            }

            InvalidateState();
        });
コード例 #2
0
        public void RemoveAllAdjustments(AdjustableProperty type)
        {
            var aggregate = getAggregate(type);

            aggregate.RemoveAllSources();
            aggregate.AddSource(getProperty(type));
        }
コード例 #3
0
        public void TestMultiplicativeComponent(AdjustableProperty type)
        {
            var adjustments = new AudioAdjustments();

            adjustments.AddAdjustment(type, new BindableDouble(0.5));
            adjustments.AddAdjustment(type, new BindableDouble(0.5));

            Assert.AreEqual(0.25, adjustments.GetAggregate(type).Value);
        }
コード例 #4
0
        public void TestAddAdjustment([Values] AdjustableProperty type)
        {
            var adjustments = new AudioAdjustments();

            Assert.IsTrue(adjustments.GetAggregate(type).IsDefault);

            adjustments.AddAdjustment(type, new BindableDouble(0.5));

            Assert.IsFalse(adjustments.GetAggregate(type).IsDefault);
        }
コード例 #5
0
        private Func <double, double, double> getAggregateFunction(AdjustableProperty type)
        {
            switch (type)
            {
            default:
                return((a, b) => a * b);

            case AdjustableProperty.Balance:
                return((a, b) => a + b);
            }
        }
コード例 #6
0
        public void TestRemoveAllAdjustmentsRemovesExternalBindings([Values] AdjustableProperty type)
        {
            var adjustments = new AudioAdjustments();

            Assert.IsTrue(adjustments.GetAggregate(type).IsDefault);

            adjustments.AddAdjustment(type, new BindableDouble(0.5));
            adjustments.AddAdjustment(type, new BindableDouble(0.5));

            adjustments.RemoveAllAdjustments(type);

            Assert.IsTrue(adjustments.GetAggregate(type).IsDefault);
        }
コード例 #7
0
        public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable)
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                balanceAggregate.RemoveSource(adjustBindable);
                break;

            case AdjustableProperty.Frequency:
                frequencyAggregate.RemoveSource(adjustBindable);
                break;

            case AdjustableProperty.Volume:
                volumeAggregate.RemoveSource(adjustBindable);
                break;
            }
        }
コード例 #8
0
        private ref AggregateBindable <double> getAggregate(AdjustableProperty type)
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                return(ref balanceAggregate);

            case AdjustableProperty.Frequency:
                return(ref frequencyAggregate);

            case AdjustableProperty.Volume:
                return(ref volumeAggregate);

            case AdjustableProperty.Tempo:
                return(ref tempoAggregate);
            }

            throw new ArgumentException($"{nameof(AdjustableProperty)} \"{type}\" is missing mapping", nameof(type));
        }
コード例 #9
0
        public void RemoveAdjustment(AdjustableProperty type, BindableDouble adjustBindable) => EnqueueAction(() =>
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                balanceAdjustments.Remove(adjustBindable);
                break;

            case AdjustableProperty.Frequency:
                frequencyAdjustments.Remove(adjustBindable);
                break;

            case AdjustableProperty.Volume:
                volumeAdjustments.Remove(adjustBindable);
                break;
            }

            InvalidateState();
        });
コード例 #10
0
 public void PopulateAdjustableProperties()
 {
     if (_selectedResponse != null)
     {
         _adjustableProperties.Clear();
         var responseType           = _selectedResponse.GetType();
         var adjustablePropertyList = PlottingUtilities.GetAllAdjustableProperties(responseType);
         var headerItem             = new AdjustableProperty
         {
             PropertyName = AdjustableProperty._header,
         };
         AdjustableProperty1 = headerItem;
         AdjustableProperties.Add(headerItem);
         foreach (var adjustableProperty in adjustablePropertyList)
         {
             AdjustableProperties.Add(adjustableProperty);
         }
     }
 }
コード例 #11
0
        private BindableNumber <double> getProperty(AdjustableProperty type)
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                return(Balance);

            case AdjustableProperty.Frequency:
                return(Frequency);

            case AdjustableProperty.Volume:
                return(Volume);

            case AdjustableProperty.Tempo:
                return(Tempo);
            }

            throw new ArgumentException($"{nameof(AdjustableProperty)} \"{type}\" is missing mapping", nameof(type));
        }
コード例 #12
0
        public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable)
        {
            switch (type)
            {
            case AdjustableProperty.Balance:
                balanceAdjustments.Add(adjustBindable);
                break;

            case AdjustableProperty.Frequency:
                frequencyAdjustments.Add(adjustBindable);
                break;

            case AdjustableProperty.Volume:
                volumeAdjustments.Add(adjustBindable);
                break;
            }

            InvalidateState();
        }
コード例 #13
0
 public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
コード例 #14
0
 public void RemoveAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => throw new NotSupportedException();
コード例 #15
0
 public void RemoveAllAdjustments(AdjustableProperty type) => adjustments.RemoveAllAdjustments(type);
コード例 #16
0
 public void RemoveAdjustment(AdjustableProperty type, IBindable <double> adjustBindable)
 => adjustments.RemoveAdjustment(type, adjustBindable);
コード例 #17
0
 public IBindable <double> GetAggregate(AdjustableProperty type) => adjustments.GetAggregate(type);
コード例 #18
0
 public void AddAdjustment(AdjustableProperty type, BindableDouble adjustBindable) =>
 adjustments.AddAdjustment(type, adjustBindable);
コード例 #19
0
 public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable)
 => getAggregate(type).AddSource(adjustBindable);
コード例 #20
0
 public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotImplementedException();
コード例 #21
0
ファイル: Metronome.cs プロジェクト: omkelderman/osu
 public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable)
 {
     sample.AddAdjustment(type, adjustBindable);
 }
コード例 #22
0
ファイル: Metronome.cs プロジェクト: omkelderman/osu
 public void RemoveAllAdjustments(AdjustableProperty type)
 {
     sample.RemoveAllAdjustments(type);
 }
コード例 #23
0
 public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) =>
 adjustments.AddAdjustment(type, adjustBindable);
コード例 #24
0
 public IBindable <double> GetAggregate(AdjustableProperty type) => throw new NotSupportedException();
コード例 #25
0
 public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable) => throw new NotImplementedException();
コード例 #26
0
 public void RemoveAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable)
 => getAggregate(type).RemoveSource(adjustBindable);
コード例 #27
0
        public static IBindable <double> GetAggregate(this IAggregateAudioAdjustment adjustment, AdjustableProperty type)
        {
            switch (type)
            {
            case AdjustableProperty.Volume:
                return(adjustment.AggregateVolume);

            case AdjustableProperty.Balance:
                return(adjustment.AggregateBalance);

            case AdjustableProperty.Frequency:
                return(adjustment.AggregateFrequency);

            case AdjustableProperty.Tempo:
                return(adjustment.AggregateTempo);

            default:
                throw new ArgumentOutOfRangeException(nameof(type), "Invalid adjustable property type.");
            }
        }
コード例 #28
0
 public IBindable <double> GetAggregate(AdjustableProperty type)
 => getAggregate(type).Result;
コード例 #29
0
 public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) => throw new NotSupportedException();