View previous topic :: View next topic |
Author |
Message |
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Thu Mar 04, 2010 10:01 am Post subject: DLL, loadlib and @lib() |
|
|
Hi,
I want to use a DLL (for the first time) in VDS but the only examples i have are in C but now i don't know how to translate them
Code: | loadlib EzAudDac.dll |
So far so good
From the manual:
int EzAudDacGetCardNum()
Called before any other functions
Return value: Number of available output DACs (1 currently) on success, 0 on failure.
This will be:
Code: | %%card = @lib(EzAudDac,EzAudDacGetCardNum,INT:) |
This works
bool EzAudDacClose()
Stops and closes all devices and output streams, clears internal memory buffers.
Return value: true if OK, false otherwise.
Code: | %T = @lib(EzAudDac,EzAudDacClose,BOOL:)
freelib EzAudDac.dll |
This works also (i gonna be good in this)
But now:
In the manual:
S_Dat data structure:
struct s_Dat {
__int16 X;
__int16 Y;
__int16 R;
__int16 G;
__int16 B;
__int16 I;
__int16 AL;
__int16 AR;
};
bool EzAudDacWriteFrame(int CardNum, s_Dat * buffer, int size, u_int16 pps)
Sends a frame to the output buffer , frame will repeat until output is stopped or another frame is fed.
CardNum: Destination card number 0-indexed (should be 0)
Buffer: pointer to a frame buffer for EzAudDac to copy size bytes from.
Size: size in bytes of the frame to be copied in buffer (number of points * 16, max 16k*16).
Pps: points per second for the frame to be displayed. Note that the audio DAC has a fixed point rate (typically 48k), so if entry is less or more than that, points will be occasionally repeated or dropped so that the end result frame occupies the same time at the sound card sample rate. Because of this, the calling program should ideally use a point rate equal to the sound card, but this is not required. (min 1k max 65535, to be extended in the future)
Return value: true if OK, false otherwise.
How should i translate this one?????
I try to do the next (don't laugh) but this doesn't work
Code: | %T = @chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)@chr(255)
%X = @lib(EzAudDac,EzAudDacWriteFrameNR,BOOL:,0,@addr("%T"),32,10000,10000) |
|
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Mar 04, 2010 4:18 pm Post subject: |
|
|
This is where I think VDS really drops the ball. It handles API types/structures terribly.
Here's what I think you need to replace your %T code with:
Code: |
REM Values 01-99
%X = 01
%Y = 01
%R = 50
%G = 50
%B = 50
%I = 10
%%AL = 10
%%AR = 10
%T = %X%Y%R%G%B%I%%AL%%AR
|
Each int16 is 2 bytes I believe, so your values need to be two characters. This way you don't need to use @fill.
Putting them all together creates your struct, and you can send it's address to the function like you already are.
Oh and change your buffer size in the function from 32 to 16. _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
SnarlingSheep Professional Member
Joined: 13 Mar 2001 Posts: 759 Location: Michigan
|
Posted: Thu Mar 04, 2010 4:25 pm Post subject: |
|
|
And if that doesn't work, try this:
Code: |
%X = @binary(WORD,01)
%Y = @binary(WORD,01)
%R = @binary(WORD,50)
%G = @binary(WORD,50)
%B = @binary(WORD,50)
%I = @binary(WORD,10)
%%AL = @binary(WORD,10)
%%AR = @binary(WORD,10)
%T = %X%Y%R%G%B%I%%AL%%AR
|
I'm thinking this is actually the way it needs to be done. _________________ -Sheep
My pockets hurt... |
|
Back to top |
|
|
Bart Valued Newbie
Joined: 24 Jun 2003 Posts: 41 Location: Netherlands
|
Posted: Fri Mar 05, 2010 8:36 am Post subject: |
|
|
Thanks a lot, the last one does work. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You can attach files in this forum You can download files in this forum
|
|