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);
        }
        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));
        }
        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();
        }
 public void RemoveAllAdjustments(AdjustableProperty type) => throw new NotSupportedException();
 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);
 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
 public void AddAdjustment(AdjustableProperty type, IBindable <double> adjustBindable)
 {
     sample.AddAdjustment(type, adjustBindable);
 }
示例#22
0
 public void RemoveAllAdjustments(AdjustableProperty type)
 {
     sample.RemoveAllAdjustments(type);
 }
 public void AddAdjustment(AdjustableProperty type, BindableNumber <double> adjustBindable) =>
 adjustments.AddAdjustment(type, adjustBindable);
 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);
        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();