Copyright © 2001-2018 MultiMedia Soft

MIDI.SoundPositionGet method

Previous pageReturn to chapter overviewNext page

Remarks

 

Obtains the current position during playback of the MIDI stream.

 

The current position is calculated respect to the original sound duration and could not represent the effective playback time if a previous playback rate change, performed through a call to MIDI.TempoPercSet and MIDI.BPMSet methods, should occur. If you should need to obtain the effective position in terms of playback time you could use the SoundPositionGet method by setting the bKeepCountOfRateChange parameter to "BOOL_TRUE".

 

For further details about the use of MIDI protocol see the MIDI object section and the How to deal with MIDI protocol tutorial.

 

 

Syntax

 

[Visual Basic]

control.MIDI.SoundPositionGet (

nPlayer as Integer,

fPosition as Double,

nPositionUnit as enumMidiPositionUnits

) as enumErrorCodes


 

[C++]

short control.MIDI.SoundPositionGet (

short nPlayer,

double *fPosition,

short nPositionUnit

);


 

Parameter

Description

 

 

nPlayer

Number representing the zero-based index of the involved player

fPosition

Reference that, on return from the method call, will contain the current position; its value depends upon the value of the nPositionUnit parameter below.

nPositionUnit

The unit of measure used for the position value stored inside fPosition parameter above.

Supported values are the following:

Mnemonic constant

Value

Meaning

MIDI_POS_UNIT_TICKS

0

The fPosition parameter is expressed in MIDI ticks

MIDI_POS_UNIT_MS

1

The fPosition parameter is expressed in milliseconds. The position is always referred to the original sound duration, meaning that it won't keep count of eventual tempo and/or playback rate changes and will always move playback to the position on the song as it should be played at its original speed.

MIDI_POS_UNIT_PERCENTAGE

2

The fPosition parameter is expressed in percentage

 

 

 

Return value

 

Value

Meaning

 

 

Negative value

An error occurred, check the LastError property value in order to get the error code

enumErrorCodes.ERR_NOERROR (0)

The method call was successful