Esempio n. 1
0
        void ConnectViewWithAU()
        {
            var au = AudioUnit;

            if (au == null)
            {
                return;
            }

            var paramTree = au.ParameterTree;

            if (paramTree == null)
            {
                return;
            }

            cutoffParameter    = (AUParameter)paramTree.ValueForKey(cutoffKey);
            resonanceParameter = (AUParameter)paramTree.ValueForKey(resonanceKey);

            parameterObserverToken = paramTree.CreateTokenByAddingParameterObserver((address, value) =>
                                                                                    DispatchQueue.MainQueue.DispatchAsync(() => {
                if (address == cutoffParameter.Address)
                {
                    filterView.Frequency = value;
                    frequencyLabel.Text  = cutoffParameter.GetString(null);
                }
                else if (address == resonanceParameter.Address)
                {
                    filterView.Resonance = value;
                    resonanceLabel.Text  = resonanceParameter.GetString(null);
                }

                UpdateFilterViewFrequencyAndMagnitudes();
            })
                                                                                    );

            filterView.Frequency = cutoffParameter.Value;
            filterView.Resonance = resonanceParameter.Value;
        }
Esempio n. 2
0
 void UpdateResonance()
 {
     resonanceTextField.Text = resonanceParameter.GetString(null);
     resonanceSlider.Value   = resonanceParameter.Value;
 }
Esempio n. 3
0
 void UpdateCutoff()
 {
     cutoffTextField.Text = cutoffParameter.GetString(null);
     cutoffSlider.Value   = cutoffParameter.Value;
 }
Esempio n. 4
0
 public void FrequencyChanged(FilterView filterView, float frequency)
 {
     cutoffParameter.SetValue(frequency, parameterObserverToken);
     frequencyLabel.Text = cutoffParameter.GetString(frequency);
     UpdateFilterViewFrequencyAndMagnitudes();
 }
Esempio n. 5
0
 public void ResonanceChanged(FilterView filterView, float resonance)
 {
     resonanceParameter.SetValue(resonance, parameterObserverToken);
     resonanceLabel.Text = resonanceParameter.GetString(resonance);
     UpdateFilterViewFrequencyAndMagnitudes();
 }
		void ConnectViewWithAU ()
		{
			var au = AudioUnit;
			if (au == null)
				return;
			
			var paramTree = au.ParameterTree;
			if (paramTree == null)
				return;

			cutoffParameter = (AUParameter)paramTree.ValueForKey (cutoffKey);
			resonanceParameter = (AUParameter)paramTree.ValueForKey (resonanceKey);
		
			parameterObserverToken = paramTree.CreateTokenByAddingParameterObserver ((address, value) =>
				DispatchQueue.MainQueue.DispatchAsync (() => {
					if (address == cutoffParameter.Address) {
						filterView.Frequency = value;
						frequencyLabel.Text = cutoffParameter.GetString (null);
					} else if (address == resonanceParameter.Address) {
						filterView.Resonance = value;
						resonanceLabel.Text = resonanceParameter.GetString (null);
					}

					UpdateFilterViewFrequencyAndMagnitudes ();
				})
			);

			filterView.Frequency = cutoffParameter.Value;
			filterView.Resonance = resonanceParameter.Value;
		}