Version 3.0

Contents

Events

Click()

This event is triggered when the user clicks any area of the control


DblClick()

This event is triggered when the user double clicks any area of the control


Error(Number as Long, Message As String)

This is event is triggered every time the control detects an internal error that can be handled. The Message variable will contain the description of the error and the Number the internal code of the error.
Unhanded errors will appear in the form of runtime/automation errors.


MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)

This is event is triggered when one of the mouse buttons is pressed over the control.


MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

This is event is triggered when the mouse is moved over the control.


MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)

This is event is triggered when a mouse button is depressed over the control.


PeakValues(Values() As Byte, FromPos as Long, ToPos as Long)

Triggered every time the internal buffer of the control is filled with new captured audio data.
The Values array will contain all the values of the captured audio in the form of bytes. Please note the following:

  • For 8 bit monophonic sampling rates
    • Every byte in the array corresponds to every sample of the captured audio
    • Values from 128 to 255 represent the positive slope of the waveform
    • Values from 127 to 0 represent the negative slope of the wave form
  • For 16 bit monophonic sampling rates
    • Every two bytes conform a word, and the value will range from -32768 to 32767
    • The first byte of the array, Value(0) is the less significant and the second, Value(1) is the most significant byte of the word
    • Values from 0 to 32767 represent the positive slope of the waveform
    • Values from -32768 to 0 represent the positive slope of the waveform
  • For stereo sampling rates, the same rules apply. The first byte (or word) corresponds to the left channel, and the following to the right channel.
    When sampling at 16bit, stereo the Big Endian or Motorola byte order is used.

The FromPos and the ToPos properties specify the area of the buffer that contains valid data.
Sometimes, the ToPos position may point to a position beyond the actual size of the buffer. This is because the buffer is circular, so when this happens, to calculate the valid positions beyond the buffer, use this formula:

ValidPos = Poisition - Size_ of_the_Buffer + 1

A sample code in VB would look something like this:

cPos = i - Ubound(Values) + 1

  • Where i is a variable that evaluates from FromPos to ToPos
  • Values is the array returned by the event
  • cPos is the correct position within the Values array for the i value

You may want to check the source code of the DXVU Meter Tester application. Among other things, this application implements an analog VU by reading the values of the sampled data through this event. There you will find a very good example on how to read the Values array.


SavedBytes(Bytes As Double)

Triggered every time a chunk of data is captured.
The Bytes variable will contain the accumulated number of bytes that have been saved.


StateChanged(NewState As StateConstants)

When the control initiates or finishes some internal process it will notify it using this event.