Copyright © 2005-2023 MultiMedia Soft

OnMidiMarkerEvents event

Previous pageReturn to chapter overviewNext page

Remarks

 

Occurs when a specific type of MIDI marker, previously enabled for notification, has been found inside the MIDI stream during playback.

Notifications of a specific MIDI marker can be enabled/disabled through the MIDI.MarkersEnableNotifications method.

 

This event replaces the usage of the CallbackForMidiMarkerEvents delegate and is only intended for usage with applications developed using Visual Basic 6 (which results unreliable when dealing with delegates and callbacks) and, in order to be enabled, requires a call to the COMEventEnable method with the nEventType parameter set to EVENT_TYPE_MIDI_MARKER.

 

For further details about callback delegates see the How to synchronize the container application with the API tutorial.

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

 

 

Syntax

 

[Visual Basic 6]

Private Sub DjStudioApi_OnMidiMarkerEvents ( _

ByVal nMarkerType as enumMidiMarkerNotifications, _

ByVal nPlayerIndex as Int16, _

ByVal nTrack as Int32, _

ByVal fPositionInMs as Double, _

ByVal fPositionInTicks as Double, _

ByVal fPositionInPercentage as Double, _

ByVal pBufferUnicode as IntPtr, _

ByVal nBufferLength as Int32 _

)

 

where "DjStudioApi" is declared in Visual Basic 6 code as:

 

Dim WithEvents DjStudioApi As AudioDjStudioApi.AudioDjStudioApiObj


 

 

Event Data

 

Parameter

Description

 

 

nMarkerType

Type of MIDI marker.

Supported values are the following:

Mnemonic constant

Value

Meaning

MIDI_NOTIFICATION_LYRIC

0

Lyrics (MIDI meta event 5)

MIDI_NOTIFICATION_TEXT

1

Text (MIDI meta event 1)

MIDI_NOTIFICATION_MARKER

2

Marker (MIDI meta event 6)

MIDI_NOTIFICATION_CUE

3

Cue point (MIDI meta event 7)

MIDI_NOTIFICATION_TIME_SIGNATURE

4

Time signature (MIDI meta event 88). The reported text is in the form of "a b", where a is the number of sharps, if positive, or flats, if negative, and b signifies major, if 0, or minor, if 1.

MIDI_NOTIFICATION_KEY_SIGNATURE

5

Key signature (MIDI meta event 89). The reported text is in the form of "a/b c d", where a is the numerator, b is the denominator, c is the metronome pulse and d is the number of 32nd notes per MIDI quarter-note.

MIDI_NOTIFICATION_COPYRIGHT

6

Copyright notice (MIDI meta event 2).

MIDI_NOTIFICATION_TRACK

7

Track name (MIDI meta event 3).

MIDI_NOTIFICATION_INSTRUMENT

8

Instrument name (MIDI meta event 4).

nPlayerIndex

Zero-based index of the player reporting the event

nTrack

Number representing the zero-based index of the MIDI track. The total number of available MIDI tracks can be obtained through the MIDI:TrackCountGet method.

fPositionInMs

Position of the marker, expressed in milliseconds, inside the MIDI stream

fPositionInTicks

Position of the marker, expressed in MIDI ticks, inside the MIDI stream

fPositionInPercentage

Position of the marker, expressed in percentage, inside the MIDI stream

pBufferUnicode

Pointer to a buffer containing a string of Unicode characters with the text of the marker. Below a couple of snippets that show how to convert the buffer contents into a .NET string through marshaling:

 

Visual Basic .NET

 

Imports System.Runtime.InteropServices

 

Dim strInfo As String = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength)

strInfo = strInfo.Trim()

 

 

Visual C#

 

using System.Runtime.InteropServices;

 

string strInfo = Marshal.PtrToStringUni(pBufferUnicode, nBufferLength);

strInfo = strInfo.Trim();

 

 

nBufferLength

The length in characters of the buffer above