I am currently working on a module userlib using the famous libmodplug engine. After fighting like a beast with the vc++ compiler, i get it working (or at least compilable) with purebasic without errors.
I ll explain the design of this userlib and telling you when the problem occurs :
C++ code :
------------
- i have a class wich manage libmodplug, for each module loaded, i create an instance and putting this instance in a vector,
- i have a class wich manage directsound, for each module loaded, i create an instance of a directsound buffer object, each directsound buffer object is attached to a libmodplug object instance (to play multiple modules simultaneously)
C code :
-------
- i have a C source code related to the API (ModuleInit, ModulePlay and so on ...) use to be called from purebasic, it works like this :
* moduleinit : here, i init directsound and i create a THREAD wich will loop for each module object loaded, if the object at pos n is playing, i call the update member of the directsound buffer object for the module object (simple hey ^_^)
* load a module (or multiple module),
* play module at index n (wich is the index inside the vector of module),
Then, to test my app, i ve coded a simple C example using winapi, all is working great without bugs (perhaps deadlocks ...).
Now, i am going to the purebasic part : i do exactly the same thing than the C example but when the update member function is called, the buffer locked consist of ZEROS !
I tried a lot of trick :
- i switch to the C DirectSound interface (IDirectSound_xxx),
- i ve added a usercallback wich is called to write the data,
- i dynamically load directsound function (typedef to func pointers ans using GetProcAddress).
All these trick worked with the C example and never with the purebasic one, i always get a buffer with zeros, the writecursor and playcursos are updated correctly by the directsound mixing manager so for me, it can only be a pointer issue.
But how can it be resolved ? I am searching for 2 nigths and i am really sick of that
Help would be GREATLY appreciated !!

