Jump to content

MIdiStream functions


Recommended Posts

I'm attempting to work with the stream functions found in Eynstyne's midi udf, but I've run into an obstacle that I cannot for the life of me overcome. MSDN says that midiStreamProperty needs a pointer to either a MIDIPROPTEMPO or a MIDIPROPTIMEDIV struct. The problem is that the struct has to be cast to an LPBYTE?

MMRESULT midiStreamProperty(
    HMIDISTRM hm,
    LPBYTE lppropdata,   <-- "Pointer to the property data." ???
    DWORD dwProperty
);

Here is what I have so far:

Func _midiStreamProperty_GetTimeDiv( Const $hmidiStream )
    Local Const $midiprop_timediv = DllStructCreate( "dword;dword" )

    DllStructSetData( $midiprop_timediv , 1 , DllStructGetSize( $midiprop_timediv ) )

    Local Const $ret = DllCall( $winmm_dll , $MMRESULT , "midiStreamProperty" , _
                                "handle" , $hmidiStream , _
                                "ptr"   , DllStructGetPtr( $midiprop_timediv ) , _
                                "dword"  , BitOR( $MIDIPROP_GET , $MIDIPROP_TIMEDIV ) )

    If Not @error Then
        Switch $ret[ 0 ]
            Case 1 To 20
                SetError( 1 , $ret[ 0 ] )
            Case 0
                Return DllStructGetData( $midiprop_timediv , 2 )
        EndSwitch
    Else
        SetError( 2 , @error )
    EndIf
EndFunc

I've read that lpbyte is a long pointer to a byte. So, essentially a pointer to an array of bytes?

One possibility I just found is to use the undocumented VarPtr. I have my doubts though.

I've also come across _WinAPI_StringFromGUID() but that doesn't satisfy midiStreamProperty() either.

Edited by LaCastiglione
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...