Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

DLL Talk / Create Sound Plug-in

Author
Message
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 1st Aug 2011 09:25
When I began my journey with TGC forum. I found this thread on the Dark GDK board by Mista Wilson. Sound Generation with Memblocks. At that time I had a very basic understanding of C++ programming. I wrote a few worthless plug-ins purely through trial and error. I thought to myself this is cool, someone should make a plug-in with this function. Well I just got back to this idea and put myself through a one day crash course in C++ programming. By George I think I’ve got it!

Thank go to:
Ric: Original DB Code
Mista Wilson: DarkGDK Port
Tommy S: Original waveform code
Green Gandalf: Memblock format

Here is Ric's DBPro code modified and minus the function. Attached is the zipped Dll.



Wicked.

Attachments

Login to view attachments
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 21st Aug 2011 22:11 Edited at: 21st Aug 2011 22:15
Instead of starting a new thread, I thought I would post this here. Hopefully someone will happen along this thread that can assist me with a couple of issues I’m having. In the last few weeks I’ve been trying to learn C++. I have learned more in this time then in 30 years. For the above download I used Codeblocks, mingw compiler and Aaron Miller’s Dev-C++ DarkBASIC Professional Plugin Template. Now I’m trying to duplicate this function without depending on Aaron’s headers. For some reason Dbpro’s compiler is not loading the dependencies. I have added the messagebox into the GetDependencyID function, I get no message. Also in the above DLL I’m using DPBro’s Sin function, for some reason when using the C++ math library the sound is not the same. I have tried the sin and sinf functions with no difference. Other then these two issues the function performs as expected. Please help?



Cheers.
WickedX.
IanM
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 21st Aug 2011 22:57
Quote: "For some reason Dbpro’s compiler is not loading the dependencies."

The problem isn't that the DBPro compiler is doing something wrong, but that the g++ compiler doesn't export names in the way expected by DBPro.

There is a way to change the names to the correct format using a .DEF file, but you'll have to investigate as I've never used it myself (See http://stackoverflow.com/questions/2810118/how-to-tell-the-mingw-linker-not-to-export-all-symbols - the first answer lightly covers how to do this, and the third answer may be useful to you too).

Even then, the function is a C++ function, so you may have problems with the linkage - DBPro expects a windows C++ function and you're providing a g++ C++ function and they may or may not be compatible - I know that the class structures are quite different, but not about the functions. More investigation for you.

Alternatively, you could use VC++Express with an additional resource editor to do the job.

Quote: "Also in the above DLL I’m using DPBro’s Sin function, for some reason when using the C++ math library the sound is not the same"

The C++ library uses radians, not degrees - convert your degree values to radians before passing your value to the sin function.

WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 22nd Aug 2011 01:25 Edited at: 22nd Aug 2011 01:29
IanM, thank you so much. Your helped has been tremendous.

I decided to go with your alternate method and compile this using Visual C++ Express and converted degrees to radians. The function is now working flawlessly. Thanks again.

WickedX
WickedX
15
Years of Service
User Offline
Joined: 8th Feb 2009
Location: A Mile High
Posted: 22nd Aug 2011 02:46
I do have one last question. I just realized I didn’t update the resource file for the mangled function. DLL Export Viewer shows the function is not mangled. Why?

Attached is the complete Visual C++ Express project.

WickedX

Attachments

Login to view attachments

Login to post a reply

Server time is: 2024-04-23 17:42:00
Your offset time is: 2024-04-23 17:42:00