Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 12, 2006
- 470 views
Chris Burch wrote: > > record("AUDIOENVELOPE", > "aEnvelope : STRUCT : AUDIOPOINT " & -- AUDIO_MAX_POINTS = > 12 > "nPoints : uchar : 1 " & > "nSustain : uchar : 1 " & > "nLoopStart : uchar : 1 " & > "nLoopEnd : uchar : 1 " & > "wFlags : ushort : 1 " & > "nSpeed : ushort : 1 " ) > > so how can I define aEnvelope to be an array of 12 AUDIOPOINTS ? > Chris:
constant AUDIO_MAX_POINTS = 12 -- record("AUDIOPOINT", "nFrame : ushort : 1 " & "nValue : ushort : 1 ") -- record("AUDIO_PARAMS", "nPoints : uchar : 1 " & "nSustain : uchar : 1 " & "nLoopStart : uchar : 1 " & "nLoopEnd : uchar : 1 " & "wFlags : ushort : 1 " & "nSpeed : ushort : 1 " ) -- atom aEnvelope, aEnvelope_params -- aEnvelope = allocate((sizeof("AUDIOPOINT")*AUDIO_MAX_POINTS)+sizeof("AUDIO_PARAMS")) -- aEnvelope_params = aEnvelope+(sizeof("AUDIOPOINT")*AUDIO_MAX_POINTS) -- AssociatePtr(aEnvelope_params,"AUDIO_PARAMS") -- -- use putsArray and grabsArray to access the ARRAY PORTION -- using aEnvelope pointer. -- -- Example: putsArray(aEnvelope,2,"nValue",1000) -- nValue in second array -- -- use put and grab to access LOWER PART using the aEnvelope_params pointer -- -- Example: put(aEnvelope_params,"nSpeed",100) -- -- USE free_mem({aEnvelope,aEnvelope_params}) to free memory when your done.
Bernie My files in archive: WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API Can be downloaded here: http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan