Copyright © 2001-2019 MultiMedia Soft

Waveform.BitmapViewDrawToHdc method

Previous pageReturn to chapter overviewNext page

Remarks

 

Renders the bitmap view of the given waveform range inside a graphical Device Context (HDC).

Before calling this method it's mandatory performing a previous sound's analysis through a call to the Waveform.AnalyzeFullSound method and waiting its completion through the WaveAnalysisDone event.

 

For further details about generating a waveform bitmap of the loaded sound, before starting its playback, refer to the How to obtain the sound's waveform tutorial.

 

 

Syntax

 

[Visual Basic]

control.Waveform.BitmapViewDrawToHdc (

hDC as OLE_HANDLE,

nPosLeft as Long,

nPosTop as Long,

nWidth as Long,

nHeight as Long,

nWaveformStereoMode as enumWaveformStereoModes,

bUseHalfColorsForPeaks as enumBoolean,

bShowVerticalLines as enumBoolean,

nStartPos as Long,

nEndPos as Long

) as enumErrorCodes


 

[C++]

short control.Waveform.BitmapViewDrawToHdc (

OLE_HANDLE hDC,

long nPosLeft,

long nPosTop,

long nWidth,

long nHeight,

short nWaveformStereoMode,

short bUseHalfColorsForPeaks,

short bShowVerticalLines,

long nStartPos,

long nEndPos

);


 

 

Parameter

Description

 

 

hDC

Handle to the output graphical Device Context

nPosLeft

Horizontal left position, expressed in pixels, of the destination rectangle where the bitmap will be rendered on the Device Context

nPosTop

Vertical top position, expressed in pixels, of the destination rectangle where the bitmap will be rendered on the Device Context

nWidth

Width, expressed in pixels, of the destination rectangle on the Device Context

nHeight

Height, expressed in pixels, of the destination rectangle on the Device Context

nWaveformStereoMode

Visualization mode used for displaying stereo sounds

Supported values are the following:

Mnemonic constant

Value

Meaning

STEREO_MODE_CHANNELS_BOTH

0

Right and left channels are displayed separately on two different panes as seen on the pictures A and B above.

STEREO_MODE_CHANNELS_LEFT

1

Only the left channel content is displayed on a single pane

STEREO_MODE_CHANNELS_RIGHT

2

Only the right channel content is displayed on a single pane

STEREO_MODE_CHANNELS_MIXED

3

Right and left channels contents are mixed together and displayed on a single pane

bUseHalfColorsForPeaks

Boolean value that determines if waveform peaks will have a half intensity color.

Supported values are the following:

Mnemonic constant

Value

Meaning

False

0

Doesn't use half color for peaks

True (default)

1

Uses half color for peaks

bShowVerticalLines

Boolean value that determines if eventual vertical lines, added through previous calls to the WaveformAnalyzer.BitmapViewVerticalLineAdd method, should be rendered as well.

Supported values are the following:

Mnemonic constant

Value

Meaning

False

0

Doesn't render vertical lines

True (default)

1

Renders vertical lines

nStartPos

Number representing the sound's position, expressed in milliseconds, where the waveform visualization begins.

The value 0 represents the sound's beginning.

 

This position can assume negative values as well; if for example you should need to display a 10 seconds range (10000 milliseconds), with the beginning of the sound on the center of the device context, you could set this value to -5000 and the nEndPos parameter to 5000; in this case position 0 of the sound would be rendered exactly on the center of the device context.

 

On the screenshots below you can see two portions of the same sound; in the first case the vertical white line represents the position 0 ms of the song ranging from -5000 ms to +5000 ms; as you can see, the negative portion on the left, where no sound exists, is rendered as absence of audible sound.

 

In this seconds case the vertical white line represents the position 5000 ms of the song ranging from 0 ms to +10000 ms

 

 

nEndPos

Number representing the sound's position, expressed in milliseconds, where the waveform visualization ends.

The value -1 represents the sound's end.

 

This position can assume values higher respect the effective sound duration; for portions of sounds outside of the effective duration, the waveform is rendered as absence of audible sound as seen above for the nStartPos parameter when rendering negative positions.

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred (see the LastError property for further error details)

enumErrorCodes.NOERROR (0)

The method call was successful