Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

Calling libplaysid2.dll functions from VB 6

Help
b_dole
2005-08-21
2013-10-16
  • b_dole
    b_dole
    2005-08-21

    Hi,

    i would like to utilize the libsidplay2.dll with one of my Visual Basic b6.0 projects.

    I can hook into the .dll with something like this :

    Declare Function SidTune Lib "libsidplay2.dll" Alias _
         "*DECORATED/MANGLED FUNCTION NAME*" (ByVal Filename As String, ByVal whatsthis _
         As String, ByVal dunno as Boolean)

    I tried looking at the .dll with de depenancy walker to figure out the function names, but they all show up as "decorated" or "Mangled". I cant figure out the function names exposed by the dll. When i try to access the function either vb tells me it cannot find the entrypoint or it just simply drops dead and exits.

    Can anyone help me here ?

     
    • Simon White
      Simon White
      2005-08-22

      From memory (unles this has changed) VB can only access pascal style function calls in dlls.  Libsidplay2 exports C++ function calls.

      C++ will decorate the functions (called mangling) so multiple functions can have the same name aslong as the parameters are different.

      You best bet would be to write some C++ code that exports some WINAPI functions to export to VB.

      COM may also be an option, but don't really know much about that (but should load as complete components to VB).

       
    • b_dole
      b_dole
      2005-09-03

      I have not a clue about c++ but for what its worth im trying my best with visualC++ (visual studio) to do something what you suggested. But i cant for the sake of my life get anything compiled yet. Im trying to figure out what files i need.

      I tried :

      cvs -z3 -d:pserver:anonymous@cvs.sourceforge.net:/cvsroot/sidplay2 co -P sidplay2

      and it got me a load of files.

      i tried doing a simple c++ dll in visual studio (using examples i found on google on how to make a c++ dll usable with VB60).

      I first just tried to compile a "empty" dll with the following includes :

      #include "sidplay\sidplay2.h"
      #include "sidplay\sidtune.h"
      #include "AudioDriver.h"
      #include "AudioConfig.h"

      (took from a example ive read here in the forum)

      but im having all sorts of problems with dependencies and missing files. I cant for the love of god find this "AudioDriver" stuff anywhere.

       
      • Simon White
        Simon White
        2005-09-06

        Hmm, does sidplay2 as a module name work, never tried.  The individual module names you want (and directories you should end up with are):

        libsidplay
        libsidutils
        builders
        sidplay

        Next grab the latest patched resid and unzip it at the same level calling the directory just resid and rename any *.cc files to *.cpp.  Then load the dsw file from sidplay/win/VC/ and build the whole lot.

        With regards to playback the libsidplay library only provides a block of data that needs sending to an audio device (normally mmsystem or directx on windows).  Not sure if VB provides a nice way to access those but there is always the AudioDriver code in the console frontend (sidplay module) that could be wrapped and used.

         
    • b_dole
      b_dole
      2005-09-03

      From what i understand (duh) is that i need to patch the output of the sidstuff to a audiodriver. does anyone have a clue what i can use under windows and does anyone have examples for this i could look at and try to figure out, thanks a plenty!

       
    • b_dole
      b_dole
      2005-09-06

      I was hoping to compile some sort of dll that would have the audiodriver and sidplay stuff inside and would just need a filename delivered to it and it would start playing.

       
      • Simon White
        Simon White
        2005-09-12

        Most people are writing plugins for programs or complete frontends so that automatically deals with the audio output issues.

        I would suggest that as a starting stab you see if you can compile the code ok "as is" and then work from there.  Once you get there have a look in the forums here at similiar questions for a minimum example for a c plugin (or to obtain sound data).

        From there you'll have to extract the AudioDriver code from the console front end (you don't need any of the other code from the console frontend except as a programming reference) and provide the functions to fill your needs.

         
  • Pete Slone
    Pete Slone
    2013-10-16

    this is at best difficult if not virtually impossible to get working , tried quite a few times and its beyond me , the whole thing resembles a mess to be truthful , it would be greatly apreciated if anyone could provide a solution to it. after compile the dll has no export for most of the major functions needed to actually play a sid. which to me seems rather strange.

     
    Last edit: Pete Slone 2013-10-16
  • Pete Slone
    Pete Slone
    2013-10-16

    btw for anyone interested in a sid library i eventually gave up on this and made my own , its not peticularly accurate but it gives quite a good representation of it , some minor fixups need to be in place but 99% of 'tunes' sound quite respectably reproduced , if anyone is interested drop me an email about it.

    emulates stereo on mono , has some nice features such as surround , and graphic equalisers etc , varying degree of filter replication etc , i thought why reinvent the wheel but i could not get this to compile so i had to.