The Basics of CallDll (or calldll for dumbys)
Author: | The_Antisony
|
Submitted: | 27th December, 2002
|
Views: | 5497
| Rated: |
|
|
Ok... I've decited to spell all this out in plain ENGLISH. No huge words... no need for a technical dictionary. Nothing but your brain, your mouse and MMF/TGF.
I'll be giving instructions on how to use this wonderfull object and I'll tell you how to find resources for it. First thing's first... my last calldll article? Forge it ever happened. I don't know what I was thinking when I wrote that, but most of it is wrong. Now, on to the info.
First, I'd like to discribe a few terms I'll be using:
Set Argument:
An arguement is a condition that is read and followed before Call Function. As an example, it'd be like telling someone to slowly dance. Slowly would become an arguement as without it, the person being given the command wouldn't know which way to dance.
Call Function: Once all the arguments (conditions) are set, call function tells your program how to utilize the called DLL file. Much like the example above, if you call arguements without calling the function, it'd be like telling someone to slowly. How much sense does that make? lol.
Clear Argument List: This is done after a function is called and before more arguements can be listed before a second function call. Makes sense? Not really? Imagine this. Say MMF writes a grocery list and MMF sticks it in it's backpack to go to the store. MMF buys it's groceries and leaves. Once MMF gets home, MMF unloads everything and finds out it forgot to add 3 items to it's list, so MMF adds the items and goes back to the store. Well, without having crossed out the previous items (cleared the arguements list) MMF would end up trying to get all the groceries it previously had on the list before adding the 3 new items. MMF is dumb like that... so to prevent this, before returning to the store (before calling a second function), MMF should have crossed off the bought items (you should have cleared the argument list). Damn, this is a bad example! Lol.
Ok... I think we're ready here. Go grab a DLL file. Again, I'll be using Bass.Dll. Open MMF/TGF and add a CallDll object to the frame. Jump into the event editor and create a Start Of Level event. Within it, call the DLL.
Load Dll:"C:\Windows\System\Bass.Dll"
Return A Value
Set Arguement to 0 at 1
Set Arguement to 44100 at 2
Set Arguement to 0 at 3
Set Arguement to "hwnd" at 4
Call Function Bass_Init
These are the instructions I followed, included inthe bass.dll help file I d/lded off of the Bass homepage.
------------------------------------------------------
BOOL WINAPI BASS_Init(
int device,
DWORD freq,
DWORD flags,
HWND win
);
device - The device to use... 0 = first, -1 = default, -2 = no sound. BASS_GetDeviceDescription can be used to get the total number of devices.
freq - Output sample rate
flags - Any combination of these flags. Flags are then listed in the help file.
-----------------------------------------------------
If you did all that just as it's listed, that will open and initiate Bass.Dll, just as DMC2 does!
Ok, maybe it would be a *bit* more helpful if I explained what I just did...
Retrun A Value
Honestly, I don't know what the hell this thing does. I just see it in all the examples I saw when learning how to use the object. Could somebody please reply and tell me why we're supposed to use this and on what conditions it should be used?
Set Arguement to 0 at 1
This sets the sound device to the first device listed. If set to -1 MMF will use the default sound device and if -2 is used, no sound will be played.
Set Arguement to 44100 at 2
This sets the sample rate. Samples and music plays at what's called a sample rate. You can think of this as the play quality. The higher the better. 44100 is pretty much AWESOME for sound. 22050 is clear and good sounding though.
Set Arguement to 0 at 3
This is where flags come in. Flags, according to Bass.Dll are items that change the sound quality, add echo and reverb effects and such. This is something DMC2 never got into at all. Settig flags is as simple as typing in the name of the flag as a string value while setting your arguement. Not much to be explained there.
Set Areguement to "hwnd" at 5
Again, I don't know what HWND means. Something having to do with window control, maybe? Who knows. All I know is that it's there and it works. Lol.
Call Function Bass_Init
This is our funcion and once called, MMF will run back through all the arguements, taking each one into account. After knowing all the instructions it must follow it then sends all the commands and the function call into the DLL and awaits some sort of return. in this case, it initializes Bass.Dll. If you understand all that, then try this afterward:
In the same envent -> clear argurments list
In a new event... set to the space bar or something.
Set Argument to "http://www.xxxxxxx.com/radio/superap.mp3" at 1
Set Argument to 0 at 2
Set Argument to 262144 at 3
Set Argument to "superap.mp3" at 4
Return no value or string
Call Function "BASS_StreamCreateURL"
Yup... this playes an MP3 file off the net. Let's see DMC2 do that, damnit! Lol.
|
|
The_AntisonyAt least I'm not Circy Registered 01/07/2002
Points 1341
|