How to add graphic items to the Waveform Analyzer
As seen inside the tutorial How to use the control in your projects, 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 item's description through the GraphicItemDescriptionGet and GraphicItemDescriptionSet methods|
|•||obtain or change the current position through the GraphicItemHorzPositionGet and GraphicItemHorzPositionSet methods|
|•||hide or show items the visibility through the GraphicItemShow method or through the GraphicItemsTypeShow method|
|•||remove items from the list of graphic items through the GraphicItemRemove method or through the GraphicItemsTypeRemove method|
Enumerating graphic items of a given type added to the waveform analyzer can be done using the GraphicItemsTypeCountGet method, the unique identification number of each graphic item can be obtained through the GraphicItemUniqueIdGet method; when knowing only the unique identification number, the respective type can be obtained through the 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 GraphicItemBuddyPictureSetFromFile, GraphicItemBuddyPictureSetFromHandle or 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 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:
Vertical lines can be manually moved through the mouse; this action will generate the combination of the following events:
|•||WaveAnalyzerLineMoveBegin raised when the movement begins|
|•||WaveAnalyzerLineMoving raised during the movement of the line: you could receive many of these events 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 GraphicItemHorzPositionSet method|
|•||WaveAnalyzerLineMoveEnd raised when the movement ends|
During playback you can be notified that the position of a vertical line has been reached through the WaveAnalyzerLineReached event.
Horizontal lines can be manually moved horizontally through the mouse; this action will generate the combination of the following events:
|•||WaveAnalyzerHorzLineMoveBegin raised when the movement begins|
|•||WaveAnalyzerHorzLineMoving raised during the movement of the line: you could receive many of these events 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 GraphicItemHorzPositionSet method or through the GraphicItemVertPositionSet method.|
|•||WaveAnalyzerHorzLineMoveEnd raised when the movement ends|
During playback you can be notified that the start position of a horizontal line has been reached through the WaveAnalyzerHorzLineReached event and that the end position of the line has been leaved through the WaveAnalyzerHorzLineLeaved event.
During playback you can be notified that the start position of a wave range has been reached through the WaveAnalyzerWaveRangeReached event and that the end position of the wave range has been leaved through the WaveAnalyzerWaveRangeLeaved event.
A memory copy of the buddy picture, accessible through a HBITMAP, can be obtained through the GraphicItemBuddyPictureGet method.
The current text string and the font used to render it on the screen can be retrieved through the 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: