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; }
void UpdateResonance() { resonanceTextField.Text = resonanceParameter.GetString(null); resonanceSlider.Value = resonanceParameter.Value; }
void UpdateCutoff() { cutoffTextField.Text = cutoffParameter.GetString(null); cutoffSlider.Value = cutoffParameter.Value; }
public void FrequencyChanged(FilterView filterView, float frequency) { cutoffParameter.SetValue(frequency, parameterObserverToken); frequencyLabel.Text = cutoffParameter.GetString(frequency); UpdateFilterViewFrequencyAndMagnitudes(); }
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; }