Jump to content

Help with DllStructCreate("float")


Recommended Posts

Hi all, I love this forum! I've looked all over it and at the AutoIt help file but I just can't get the syntax right.

Here's the C code I'm trying to convert. Can anyone tell me what I'm doing wrong.

float matrix[1][2]={

{0.5, -0.5}, // mono out = left - right in

};

Here's My Function:

Global $left, $right

SetMatrix(0.5,-0.5)

Func SetMatrix($left, $right)
    Local $matrix[2][3]
    $matrix[1][1] = $left
    $matrix[1][2] = $right
    local $mstruct = DllStructCreate("float[2]")

    DllStructSetData($mstruct, 1, $matrix[1][1],1)
    DllStructSetData($mstruct, 1, $matrix[1][2],2)
    $StreamMatrix1 = _BASS_Mixer_ChannelSetMatrix($source, DllStructGetPtr($mstruct))
EndFunc   ;==>SetMatrix

I've also tried:

Global $left, $right

SetMatrix(0.5,-0.5)

Func SetMatrix($left, $right)
    Local $matrix[2][3]
    $matrix[1][1] = $left
    $matrix[1][2] = $right
    local $mstruct = DllStructCreate("float;float")

    DllStructSetData($mstruct, 1, $matrix[1][1])
    DllStructSetData($mstruct, 2, $matrix[1][2])
    $StreamMatrix1 = _BASS_Mixer_ChannelSetMatrix($source, DllStructGetPtr($mstruct))
EndFunc   ;==>SetMatrix

Thanks,

Joe

Edited by a440hz

Are you experienced?

Link to comment
Share on other sites

Try this:

Global $left, $right

SetMatrix(0.5,-0.5)

Func SetMatrix($left, $right)
    local $mstruct = DllStructCreate("float;float")
    DllStructSetData($mstruct, 1, $left)
    DllStructSetData($mstruct, 2, $right)
    MsgBox(0,"DllStruct","Struct Size: " & DllStructGetSize($mstruct) & @CRLF & _ ;for debugging only
    "Struct pointer: " & DllStructGetPtr($mstruct) & @CRLF & _
    "Data:" & @CRLF & _
    DllStructGetData($mstruct,1) & @CRLF & _
    DllStructGetData($mstruct,2))
    $StreamMatrix1 = _BASS_Mixer_ChannelSetMatrix($source, DllStructGetPtr($mstruct))
EndFunc ;==>SetMatrix

BR,

UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

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