Re: Bernie - mixedlib question

new topic     » goto parent     » topic index » view thread      » older message » newer message

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 etop, ebot, aEnvSize, aEnvelope, aEnvelope_params
--
aEnvSize = (sizeof("AUDIOPOINT")*AUDIO_MAX_POINTS)+sizeof("AUDIO_PARAMS")
--
aEnvelope = allocate(aEnvSize)
-- clear to all zeros.
mem_set(aEnvelope,0,aEnvSize)
--  associate aEnvelope pointer to top half.
AssociatePtr(aEnvelope,sArray("AUDIOPOINT",AUDIO_MAX_POINTS))
-- calculate pointer to lower half.
aEnvelope_params = aEnvelope+sizeof("AUDIOPOINT")*AUDIO_MAX_POINTS
-- associate aEnvelope_params pointer to lower half.
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)
--
-- Free up memory when done with free_mem({aEnvelope_params,aEnvelope})
--


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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu