Re: Bernie - mixedlib question
ChrisBurch2 wrote:
>
>
> Hi
>
> Sorry Bernie, more questions
>
> The AUDIOENVELOPE structure has now been created, in two contiguous parts,
> with
> a pointer to the first part (an array of AUDIOPOINTS structures), and a
> pointer
> to the second part (the new AUDIO_PARAMS record).
>
> Now I have (including the original c structure)
>
> }}}
<eucode>
> --/* audio patch structure */
> --typedef struct {
> -- CHAR szPatchName[32]; /* patch name */
> -- UCHAR aSampleNumber[AUDIO_MAX_NOTES]; /* multi-sample table */
> -- USHORT nSamples; /* number of samples */
> -- UCHAR nVibratoType; /* vibrato type */
> -- UCHAR nVibratoSweep; /* vibrato sweep */
> -- UCHAR nVibratoDepth; /* vibrato depth */
> -- UCHAR nVibratoRate; /* vibrato rate */
> -- USHORT nVolumeFadeout; /* volume fadeout */
> -- AUDIOENVELOPE Volume; /* volume envelope */
> -- AUDIOENVELOPE Panning; /* panning envelope */
> -- PAUDIOSAMPLE aSampleTable; /* sample table */
> --} AUDIOPATCH, *PAUDIOPATCH;
>
> record("AUDIOPATCH",
> "szPatchName : char : 32 " &
> "aSampleNumber : uchar : 96 " & --AUDIO_MAX_NOTES
> "nSamples : ushort : 1 " &
> "nVibratoType : uchar : 1 " &
> "nVibratoSweep : uchar : 1 " &
> "nVibratoDepth : uchar : 1 " &
> "nVibratoRate : uchar : 1 " &
> "nVolumeFadeout : ushort : 1 " &
> "Volume : STRUCT : AUDIOENVELOPE " &
> "Panning : STRUCT : AUDIOENVELOPE " &
> "aSampleTable : pointer : 1 " ) --careful here - its actually
> specified a pointer to a structure!
> --the handle to a created
> AUDIOSAMPLE structure?
> </eucode>
{{{
>
Chris:
This would be much easier.
constant
AUDIO_MAX_POINTS = 12
-- Create the point structures description.
sequence PTS PTS = {}
--
for i = 1 to AUDIO_MAX_POINTS do
PTS &= sprintf("AP%d: STRUCT : AUDIOPOINT ",{i})
end for
--
record("AUDIOPOINT",
"nFrame : ushort : 1 " &
"nValue : ushort : 1 ")
--
record("AUDIOENVELOPE",PTS& -- point structures description.
"nPoints : uchar : 1 " &
"nSustain : uchar : 1 " &
"nLoopStart : uchar : 1 " &
"nLoopEnd : uchar : 1 " &
"wFlags : ushort : 1 " &
"nSpeed : ushort : 1 " )
--
record("AUDIOPATCH",
"szPatchName : char : 32 " &
"aSampleNumber : uchar : 96 " &
"nSamples : ushort : 1 " &
"nVibratoType : uchar : 1 " &
"nVibratoSweep : uchar : 1 " &
"nVibratoDepth : uchar : 1 " &
"nVibratoRate : uchar : 1 " &
"nVolumeFadeout : ushort : 1 " &
"Volume : STRUCT : AUDIOENVELOPE " &
"Panning : STRUCT : AUDIOENVELOPE " &
"aSampleTable : pointer : 1 " )
-- Create a Pointer to an audio patch structure.
atom PAUDIOPATCH
-- Create the audio patch structure.
-- The complete structure will be initialized to all zeros.
PAUDIOPATCH = struc("AUDIOPATCH")
-- memory location of the created structure.
? PAUDIOPATCH
-- get size of entire structure
? sizeof(PAUDIOPATCH)
-- to access the structues.
put(PAUDIOPATCH,"Volume->AP3->nFrame",1000) -- 3rd volumne point structure.
? grab(PAUDIOPATCH,"Volume->AP3->nFrame")
put(PAUDIOPATCH,"Panning->AP7->nFrame",104) -- 7th panning point structure.
? grab(PAUDIOPATCH,"Panning->AP7->nFrame")
-- to access the other parts.
put(PAUDIOPATCH,"nVibratoDepth",5)
? grab(PAUDIOPATCH,"nVibratoDepth")
put(PAUDIOPATCH,"Volume->nSpeed",27)
? grab(PAUDIOPATCH,"Volume->nSpeed")
-- pause so we can see the above print
pause()
-- If want to clear the complete structure to all zeros.
-- clears(PAUDIOPATCH)
-- To free the memory that structure is using then.
-- free_mem(PAUDIOPATCH)
--
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
|
Not Categorized, Please Help
|
|