i think i've got the caldll extension more or less sussed now (dont know what the buffers are about yet?) but i'm still having a problem - this time with the bass dll (v2.1) which i think should be pretty compatible with mmf.
specifically, i need to pass a pointer to a structure to the calldll object. the thing is, i dont know exactly what that means or if its even possible.
someone had mentioned it could be extremely difficult to do in mmf in a reply to my last question.
this is the stuff that has to go into the structure;
fCenter Center frequency, in hertz, in the range from 80 to 16000. This value cannot exceed one-third of the frequency of the channel.
fBandwidth Bandwidth, in semitones, in the range from 1 to 36.
fGain Gain, in the range from -15 to 15.
is the idea to put all these values into a single string and use that as an argument?
Doubtful you'll be able to use a string since binary numbers will likely include characters that can't be displayed. Basically a structures a collection of variables. If structures are structured how I'd expect them to just be in a list, so I think passing your fCenter value, then your fBandwidth value and then your fGain value will work, just have to hope they wrote them variables in the order they actually appear in the structure.
That wouldn't work. Passing a pointer to a structure is completely different from passing the whole structure at once
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
Use the binary object. Make its size the size of the structure, set the values at the appropriate positions, and pass the address of the binary object.
i just found a post on the clickteam forum about using the binary object for this.
apparently someone has made an example but its no longer at 3ee (along with all the docs still). i dont suppose you or anyone else has a copy do you?
burkey gave a fairly in-depth description but without an example to look at or the binary documentation its pretty hard to follow.
You can't change the size of the arguments you're passing, it won't understand. you have to use the exact size specified by the struct (which is 12, yeah). Not sure about the subtracting thing, maybe that's just some easy way of converting an int to a float? And yup, the address is the memory location
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
A float is by definition 4 bytes, so that struct is 12 bytes, the order being:
fCenter: bytes 0-3
fBandwidth: bytes 4-7
fGain: bytes 8-11
(which is pretty much common sense, the order they're listed)
Doesn't the binary object have a Set Float action? If not, then I think firemonkey had an object which could convert floats to ints...
Subtracting 32768 is only if you want to sign a short, so you don't need to worry about that here.
I figured out why it kept crashing – it was because I was trying to set the fx parameters at the same time as reading the channel levels (something I’d started playing at when I couldn’t get the effects to work). With the level meter disabled I get the error messages to tell me the parameters are wrong.
Button clicked ->
* resize binary to 12 bytes
* insert long (5000) at 0
* insert long (20) at 4
* insert long (14) at 8
* reset argument list
* set argument 1 to calldll return value (the fx handle)
* set argument 2 to binary object memory location
* call function "bass_fxsetparameters"
anything scream out as obviously wrong?
All the parameters are within the allowed ranges (ie. Center 80-16000 & <1/3 channel freq which is 16khz on the sample i'm testing with, bandwidth 1-36, gain –15-15.
I still get the “illparam” error code – this at least tells me the handle is ok (which I already knew), so theres something wrong with the structure still. According to the Bass dll help "One or more of the parameters are invalid, make sure all the values are within the valid ranges."
ive been experimenting some more and i have been able to call the same function with different parameters, to set the gargle effect which does not use floats.
i think the problem is one of two things;
* im not creating the structure correctly, somehow due to the fact that it contains floats rather than dwords (whatever they are). maybe that i need to use something other than longs?
* im using illegal values for the parameters, though i cant see how - according to the manual they should be ok, and i've tried many combinations.
About converting floats to ints - mmf has a built in feature to do that does it not, but surely i want to convert an int to a float if anything since thats what the structure takes?
Long and DWORD are just the same thing. Floats and Longs use a totally different way of storing numbers (apart from 0), so you'll need to find a way to convert int->float, like the object Tigs mentioned
Edited by the Author.
"Say you're hanging from a huge cliff at the top of mt. everest and a guy comes along and says he'll save you, and proceeds to throw religious pamphlets at you while simultaniously giving a sermon." - Dustin G
has anyone actually been able to call a function using floats? i'm starting to think its not possible
i found an example of using the bass 1.6 dll with call dll, and it had the same problem - they couldnt set the effect parameters that used floats.
havent been able to find that extension - there doesnt seem to be one on the lists that would help. surely a float will only get converted back to an int anyway when its inserted into the binary, since theres no "insert float at" function. can you not convert a number to a float just by multiplying by 1.0 or something?
thanks for the help, but it looks like what i want to do is probably going to be impossible again.
not doing quite what i want, but not complaining either.
turns out there was another problem as well as the whole floats business - it didnt like me calling the function too soon after setting the values in the binary. im surprised it matters as i do both in the same event, but for some reason the binary stuff has to be the first few actions - guess it takes a while or something.
might write a tutorial on the bass dll sometime - there have been a few mp3 players made with mmf already i think, so people might be interested (and its not exactly easy).
A tutorial on the calldll basicly would be nice anyways (3EE docs be gone) You guys lose me when you start to talk about pointers, bytes, floats and ways of storing things... I have this great idea for a program but it's based on being able to ping IP's (function nowhere to be found in any extensions) The way I understood it, windows own icmp.dll can do this with the IcmpSendEcho ( http://msdn.microsoft.com/library/default.asp?url=/library/en-us/iphlp/iphlp/icmpsendecho.asp ) function but thats it for me, you can guess what happens when I try to do anything with that dll.
i remember this - i posted that question like 6 months ago (you might want to start a new thread next time). can't help you with the pings and echos an things though. sorry.