How to add graphic items to the Waveform Analyzer
As seen inside the tutorial How to use the Waveform Analyzer, the waveform analyzer allows selecting through the mouse a specific position on the visible waveform range, visualized through a vertical line, and to display the current playback position through a second vertical line.
The waveform analyzer allows adding through code further custom graphic items:
On the screenshot below you can find a waveform with several graphic items inside, each having its own colors and positioning:
For each of these graphic items, through the mentioned methods you can define a friendly name, a description, the exact position expressed in milliseconds, the colors used for being drawn and some more specific parameter.
All of the methods mentioned above return a unique identification number that will be used by other methods to access settings of each graphic item at a later time; for example you may want to:
|•||obtain or change the friendly name through the WaveformAnalyzer.GraphicItemNameGet and WaveformAnalyzer.GraphicItemNameSet methods|
|•||obtain or change the item's description through the WaveformAnalyzer.GraphicItemDescriptionGet and WaveformAnalyzer.GraphicItemDescriptionSet methods|
|•||obtain or change the current position through the WaveformAnalyzer.GraphicItemHorzPositionGet and WaveformAnalyzer.GraphicItemHorzPositionSet methods|
|•||hide or show items the visibility through the WaveformAnalyzer.GraphicItemShow method or through the WaveformAnalyzer.GraphicItemsTypeShow method|
|•||remove items from the list of graphic items through the WaveformAnalyzer.GraphicItemRemove method or through the WaveformAnalyzer.GraphicItemsTypeRemove method|
All of the graphic items added to the waveform analyzer can be saved into a disk file for later use through the WaveformAnalyzer.GraphicItemsSave and reloaded when needed through the WaveformAnalyzer.GraphicItemsLoad method.
Enumerating graphic items of a given type added to the waveform analyzer can be done using the WaveformAnalyzer.GraphicItemsTypeCountGet method, the unique identification number of each graphic item can be obtained through the WaveformAnalyzer.GraphicItemUniqueIdGet method; when knowing only the unique identification number, the respective type can be obtained through the WaveformAnalyzer.GraphicItemTypeGet method.
Graphic items can be rendered with other "buddy" elements that may help giving a more specific visual meaning to each item:
|•||Buddy pictures through the WaveformAnalyzer.GraphicItemBuddyPictureSetFromFile, WaveformAnalyzer.GraphicItemBuddyPictureSetFromHandle or WaveformAnalyzer.GraphicItemBuddyPictureSetFromMemory methods; the screenshot below shows a waveform containing a short conversation between two employees: with vertical lines and a couple of buddy pictures it's very immediate understanding the position where a specific employee starts speaking:|
|•||Buddy texts through the WaveformAnalyzer.GraphicItemBuddyTextSet; the screenshot below shows the same conversation with buddy texts in place of buddy pictures:|
Each type of graphic item implements further methods for acting on their settings and may generate specific events; let's see them in detail:
Settings specific to vertical lines can be obtained through the WaveformAnalyzer.GraphicItemVerticalLineParamsGet method and modified through the WaveformAnalyzer.GraphicItemVerticalLineParamsSet method.
Vertical lines can be manually moved through the mouse; this action will cause the component invoking the CallbackWaveformAnalyzerLineMoved delegate: you could receive many of these calls in order to be up to date with the current line position; this event is also generated when the line position is modified through the WaveformAnalyzer.GraphicItemHorzPositionSet method.
During playback you can be notified that the position of a vertical line has been reached through the CallbackWaveformAnalyzerLineReached delegate.
Settings specific to horizontal lines can be obtained through the WaveformAnalyzer.GraphicItemHorizontalLineParamsGet method and modified through the WaveformAnalyzer.GraphicItemVerticalLineParamsSet method.
Horizontal lines can be manually moved through the mouse; this action will cause the component invoking the CallbackWaveformAnalyzerHorzLineMoved delegate: you could receive many of these calls in order to be up to date with the current line position; this event is also generated when the line position is modified through the WaveformAnalyzer.GraphicItemHorzPositionSet and WaveformAnalyzer.GraphicItemVertPositionSet methods.
During playback you can be notified that the start position of a horizontal line has been reached through the CallbackWaveformAnalyzerHorzLineReached delegate and that the end position of the line has been leaved through the CallbackWaveformAnalyzerHorzLineLeaved delegate.
During playback you can be notified that the start position of a wave range has been reached through the CallbackWaveformAnalyzerWaveRangeReached delegate and that the end position of the wave range has been leaved through the CallbackWaveformAnalyzerWaveRangeLeaved delegate.
Settings specific to buddy pictures can be obtained through the WaveformAnalyzer.GraphicItemBuddyPictureParamsGet method and modified through the WaveformAnalyzer.GraphicItemBuddyPictureParamsSet method.
A memory copy of the buddy picture, accessible through a HBITMAP, can be obtained through the WaveformAnalyzer.GraphicItemBuddyPictureGet method.
The current text string and the font used to render it on the screen can be retrieved through the WaveformAnalyzer.GraphicItemBuddyTextGet method.
Samples of usage of graphic items applied to the waveform analyzer in Visual C# and Visual Basic.NET can be found inside the following samples installed with the product's setup package:
- WaveformAnalyzer (available also in Unmanaged Visual C++ and Visual Basic 6)