Just starting out? Need help? Post your questions and find answers here.
spacefractal
User
Posts: 17 Joined: Tue Jan 24, 2006 7:05 pm
Post
by spacefractal » Thu Feb 16, 2006 7:33 pm
Code: Select all
ProcedureDLL BASS_setPosition(handle.l,secs.l)
sec.q
flo.f=1.0
sec=CallFunction(BASS_ID,"BASS_ChannelSeconds2Bytes",handle,flo) // position in sec
sec=sec*secs
CallFunction(BASS_ID,"BASS_ChannelSetPosition",handle,sec) // crash
EndProcedure
Here is the BASS document how to use setposition function (where sec is a QWORD):
BOOL WINAPI BASS_ChannelSetPosition(
DWORD handle,
QWORD pos
);
So how can I pass a QWORD with the new type?
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Thu Feb 16, 2006 7:35 pm
Callfunction can't be used for this, you will have to use a prototype to achieve this (or split the quad argument in 2 long, hi/low).
spacefractal
User
Posts: 17 Joined: Tue Jan 24, 2006 7:05 pm
Post
by spacefractal » Thu Feb 16, 2006 7:43 pm
Do you have a plan to support that in the next beta?
Otherwice how do I do with that prototype or split convertning (another workaround)?
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Thu Feb 16, 2006 8:01 pm
CallFunction() is kept only for backward compatibility, prototypes are much more flexible, so it's the way to go.
Ex:
Code: Select all
Prototype.l BASS_ChannelSetPositionPrototype(a.l, b.q)
BASS_ChannelSetPosition.BASS_ChannelSetPositionPrototype = GetFunction(#id, "BASS_ChannelSetPosition")
BASS_ChannelSetPosition(arg1, arg2)
spacefractal
User
Posts: 17 Joined: Tue Jan 24, 2006 7:05 pm
Post
by spacefractal » Thu Feb 16, 2006 8:56 pm
Got it to work
, Prototypes is the way to go.
Please update the manual, when you made the 4.0 final. I diddent know about it and have oversaw that thing.
You may want to move this topic to "Coding Questions", if you want.
dontmailme
Enthusiast
Posts: 537 Joined: Wed Oct 29, 2003 10:35 am
Post
by dontmailme » Fri Feb 17, 2006 12:54 am
Fo you have an example which returns a float but has no parameters ?
I have :-
prototype.f funcP()
func.funcP=getfunction(DLL, "func")
debug func
This will show 0 when the result should be 0.3
What am I doing wrong ?
Paid up PB User !
Fred
Administrator
Posts: 18162 Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:
Post
by Fred » Fri Feb 17, 2006 1:18 am
you miss the parentheses, you're calling a function here:
dontmailme
Enthusiast
Posts: 537 Joined: Wed Oct 29, 2003 10:35 am
Post
by dontmailme » Fri Feb 17, 2006 8:06 am
Yes, I realise that Fred
, but see below
Now I have managed to get it to work, I did have the openlbrary, prototype and getfunction in an include file and when I do this it fails when the debug func() is run from the main source with the error.... is not a function etc...
My include file must have a bug!
But it doesn't seem to matter, with or without the () I get the same result, the parenthesis are not required !!! , unless there are parameters to pass.
Paid up PB User !