BASS.NET API for the Un4seen BASS Audio LibraryVisualsGetAmplitudeFromPosY Method BASS.NET API for the Un4seen BASS Audio Library
Returns the amplitude (power) as a float value which is represented by the given Y coordinate position of a visual control.

Namespace: Un4seen.Bass.Misc
Assembly: Bass.Net (in Bass.Net.dll) Version: 2.4.12.0
Syntax

public float GetAmplitudeFromPosY(
	int y,
	int height
)

Parameters

y
Type: SystemInt32
The Y coordinate from which to get the amplitude (between 0 and control.Height-1).
height
Type: SystemInt32
The maximum height of the visual control which was used to display the visual (e.g. pictureBox.Height).

Return Value

Type: Single
The amplitude or power as a float value (between 0.0 and 1.0) which is represented by the Y coordinate of the visual.
Remarks

The Y coordinate position represents the zero based pixel number of the visual control being rendered.
Examples

In the following example a pictureBox control is assumed being used:
VB
Private Sub pictureBoxSpectrum_MouseMove(sender As Object, e As System.Windows.Forms.MouseEventArgs)
  If _vis Is Nothing Then
    Return
  End If
  Dim freq As Integer = _vis.GetFrequencyFromPosX(e.X, 44100)
  Dim amp As Single = _vis.GetAmplitudeFromPosY(e.Y, Me.pictureBoxSpectrum.Height)
  Me.labelVis.Text = [String].Format("Freq={0}Hz, Amp={1}", freq, amp)
End Sub
private void pictureBoxSpectrum_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
  if (_vis == null)
    return;
  int freq = _vis.GetFrequencyFromPosX(e.X, 44100);
  float amp = _vis.GetAmplitudeFromPosY(e.Y, this.pictureBoxSpectrum.Height);
  this.labelVis.Text = String.Format( "Freq={0}Hz, Amp={1}", freq, amp );
}
See Also

Reference