1. Bernie - mixedlib question
- Posted by Chris Burch <chriscrylex at aol.com> Sep 12, 2006
- 512 views
- Last edited Sep 13, 2006
Hi I'm trying to do this --typedef struct { -- USHORT nFrame; /* envelope frame */ -- USHORT nValue; /* envelope value */ --} AUDIOPOINT, *PAUDIOPOINT; record("AUDIOPOINT", "nFrame : ushort : 1 " & "nValue : ushort : 1 ") --/* audio envelope structure */ --typedef struct { -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ --/* audio envelope structure */ --typedef struct { -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ record("AUDIOENVELOPE", "aEnvelope : STRUCT : AUDIOPOINT" & -- AUDIO_MAX_POINTS = 12 (heavily snipped) However, I can't get my head round how to create a repeating structure (aEnvelope) AUDIO_MAX_POINTS long (12) for the AUDIOENVELOPE record. Any hints? Cheers in advance Chris http://euallegro.wikispaces.com http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
2. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 12, 2006
- 496 views
- Last edited Sep 13, 2006
Chris Burch wrote: > > Hi > > I'm trying to do this > > --typedef struct { > -- USHORT nFrame; /* envelope frame */ > > -- USHORT nValue; /* envelope value */ > > --} AUDIOPOINT, *PAUDIOPOINT; > > record("AUDIOPOINT", > "nFrame : ushort : 1 " & > "nValue : ushort : 1 ") > > --/* audio envelope structure */ > --typedef struct { > -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ > > > --/* audio envelope structure */ > --typedef struct { > -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ > > > record("AUDIOENVELOPE", > "aEnvelope : STRUCT : AUDIOPOINT" & -- AUDIO_MAX_POINTS = 12 > > (heavily snipped) > > However, I can't get my head round how to create a repeating structure > (aEnvelope) > AUDIO_MAX_POINTS long (12) for the AUDIOENVELOPE record. > Chris:
constant AUDIO_MAX_POINTS = 12 record("AUDIOPOINT", "nFrame : ushort : 1 " & "nValue : ushort : 1 ") -- This creates an Array of AUDIO_MAX_POINTS ( 12 ) structures. -- The structures will be initialize to all zeros. -- -- use putsArray and grabsArray to access the array. -- atom aEnvelope aEnvelope = sArray("AUDIOPOINT",AUDIO_MAX_POINTS)
You can do this same thing with any of my libraries. 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
3. Re: Bernie - mixedlib question
- Posted by Chris Burch <chriscrylex at aol.com> Sep 12, 2006
- 486 views
- Last edited Sep 13, 2006
Bernie Ryan wrote: > > Chris Burch wrote: > > > > Hi > > > > I'm trying to do this > > > > --typedef struct { > > -- USHORT nFrame; /* envelope frame */ > > > > -- USHORT nValue; /* envelope value */ > > > > --} AUDIOPOINT, *PAUDIOPOINT; > > > > record("AUDIOPOINT", > > "nFrame : ushort : 1 " & > > "nValue : ushort : 1 ") > > > > --/* audio envelope structure */ > > --typedef struct { > > -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ > > > > > > --/* audio envelope structure */ > > --typedef struct { > > -- AUDIOPOINT aEnvelope[AUDIO_MAX_POINTS]; /* envelope points */ > > > > > > record("AUDIOENVELOPE", > > "aEnvelope : STRUCT : AUDIOPOINT" & -- AUDIO_MAX_POINTS = 12 > > > > (heavily snipped) > > > > However, I can't get my head round how to create a repeating structure > > (aEnvelope) > > AUDIO_MAX_POINTS long (12) for the AUDIOENVELOPE record. > > > > Chris: > > > }}} <eucode> > constant > AUDIO_MAX_POINTS = 12 > > record("AUDIOPOINT", > "nFrame : ushort : 1 " & > "nValue : ushort : 1 ") > > -- This creates an Array of AUDIO_MAX_POINTS ( 12 ) structures. > -- The structures will be initialize to all zeros. > -- > -- use putsArray and grabsArray to access the array. > -- > atom aEnvelope > > aEnvelope = sArray("AUDIOPOINT",AUDIO_MAX_POINTS) > > </eucode> {{{ > > You can do this same thing with any of my libraries. > > Bernie > > My files in archive: > WMOTOR, XMOTOR, W32ENGIN, MIXEDLIB, EU_ENGIN, WIN32ERU, WIN32API > > Can be downloaded here: > <a > href="http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan">http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=bernie+ryan</a> That was quick! but, the entire structure is 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 http://euallegro.wikispaces.com http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
4. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 12, 2006
- 493 views
- Last edited Sep 13, 2006
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
5. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 12, 2006
- 518 views
- Last edited Sep 13, 2006
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") -- set the aEnvelope_params structure to all zeros. clears(aEnvelope_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 up the memory
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
6. Re: Bernie - mixedlib question
- Posted by Chris Burch <chriscrylex at aol.com> Sep 12, 2006
- 494 views
- Last edited Sep 13, 2006
Hi Thanks Bernie, that's fantastic, you are a guru. Chris http://euallegro.wikispaces.com http://members.aol.com/chriscrylex/euphoria.htm http://uboard.proboards32.com/ http://members.aol.com/chriscrylex/EUSQLite/eusql.html
7. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 13, 2006
- 498 views
Chris: IGNORE THE LAST TWO POST THEY ARE INCORRECT ALL GET BACK WITH YOU WITH THE CORRECT LATER. 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
8. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 13, 2006
- 518 views
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
9. Re: Bernie - mixedlib question
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Sep 13, 2006
- 507 views
Thanks, thats brilliant Chris
10. Re: Bernie - mixedlib question
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Sep 13, 2006
- 548 views
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)
--/* 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?
As you can see, it requires an AUDIENVELOPE structure, and the question is, do I have to build it by hand again, as you did before? Cheers Chris
11. Re: Bernie - mixedlib question
- Posted by Bernie Ryan <xotron at bluefrog.com> Sep 13, 2006
- 530 views
- Last edited Sep 14, 2006
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
12. Re: Bernie - mixedlib question
- Posted by ChrisBurch2 <crylex at freeuk.co.uk> Sep 14, 2006
- 525 views
Hi Of course it would, and thanks once again. Chris