alSourcefv help wanted

About Monkey 2 Forums Monkey 2 Programming Help alSourcefv help wanted

This topic contains 3 replies, has 3 voices, and was last updated by  Mark Sibly 1 year, 7 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #10028

    AdamStrange
    Participant

    I’m trying to work out stereo panning using alSourcefv, but can’t get it to compile.

    the function is:

    Function alSourcefv( source:ALuint, param:ALenum, values:ALfloat Ptr )

    Here’s the code I tried, but it won’t allow me to use the array:

    I am sure that I am just referencing angles with the wrong varptr or something ?

    anyone be able to help?

    #10031

    abakobo
    Participant

    I think you have to use

    [/crayon]

    which are technically the same. i.e. a pointer to ALFloat (pointing the first element of the array)

    “angles” alone is actually a pointer so “Varptr angles” is a pointer to a pointer (to be seen in C sys programming but probably not in mx2 sources)
    It’s common in C/C++ libs to send an array by sending a pointer to the first element (and a count if the number of elements is variable)

    #10033

    AdamStrange
    Participant

    Brilliant – thanks, the angles[0] was what I needed 😉

    #10042

    Mark Sibly
    Keymaster

    The ‘Data’ property of array also returns a pointer to the elements, ie: ‘blah.Data’ is same as ‘Varptr blah[0]’.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.