Copyright © 2006-2019 MultiMedia Soft

How to add graphic items to the Waveform Analyzer

Previous pageReturn to chapter overviewNext page

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:

 

Vertical lines through the WaveformAnalyzer.GraphicItemVerticalLineAdd method
Horizontal lines through the WaveformAnalyzer.GraphicItemHorizontalLineAdd method
Wave ranges through the WaveformAnalyzer.GraphicItemWaveRangeAdd method

 

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:

 

 

Vertical lines

 

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 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 WaveformAnalyzer.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

 

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 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 WaveformAnalyzer.GraphicItemHorzPositionSet method or through the WaveformAnalyzer.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.

 

 

Wave ranges

 

Settings specific to horizontal lines can be obtained through the WaveformAnalyzer.GraphicItemWaveRangeParamsGet method and modified through the WaveformAnalyzer.GraphicItemWaveRangeParamsSet method.

 

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.

 

 

Buddy pictures

 

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.

 

 

Buddy texts

 

Settings specific to buddy texts can be obtained through the WaveformAnalyzer.GraphicItemBuddyTextParamsGet method and modified through the WaveformAnalyzer.GraphicItemBuddyTextParamsSet 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