I have created a simple application in VS.NET using the full framework and some wrappers which kind people on this forum have sent me. Many thanks guys!!
My question however is this: is it possible to harness the fmodce.dll from a “SmartDevice” application?? I have used pretty much the same code (changing the relevant stuffs like the DLL name on the DllImport tags), and whenever I call the imported Init function, I recieve a System.MissingMethodException. Now I know that the DLL is being sent across (I see that being copied across to the emulator in the deployment stage!) I also get the same behaviour on my actual PDA.
Any help on this would be GREATLY recieved.
- DGlover asked 14 years ago
backslash wasn’t it.
I will post in details but in short, you have to pass a byte array terminated with \0. I figured this out by looking at sample code that comes with fmodce api and a lot of trial and error.
I think things work straight on Windows but not on Pocket PC because on Pocket PC, string is always marshalled as unicode by default. And there is no way to specify otherwise using MarshalAs. Basically I had to use some unsafe blocks…
[quote="brett":1nltbnko]yes it is unicode in places, but as you may have seen, non of the fmod examples use unicode, it always uses char *, and the docs say char * (as does fmod.h) so wctombs is needed if you’re using some os function that specifies otherwise[/quote:1nltbnko]
Two way this can be resolved – if we didn’t want to employ unsafe code blocks like I have –
One would be for .NET Compact Framework to support MarshallAs attribute just like its big brother.
The other would be for FMOD to provide unicode overloaded functions or have someone provide a wrapper API so that fmod functions can accept wchar_t * as well as char *.
Which do you think would be easier? 😀 It’d probably be a good idea for FMOD to support unicode anyway. Not all song titles are in English you know.
I am trying the same thing but right now it’s failing to load the sample.
When I test it on xp it’s fine(using non-ce API), but when I download it to pocketpc it the load function fails to return a valid pointer.
Anyone gotten it to work?
Here’s my own post in another, wrong forum:
I am using Compact .NET Framework on pocket pc 2002 in c#.
I used win32 version of fmod.dll for testing on my xp using Compact .NET Framework and everything worked. However, downloading the app to my pocket pc and using ARM version of fmodce.dll(3.63), the .ogg file(any file) refuses to load. I am using the following to load:
[DllImport("fmod.dll", EntryPoint="FSOUND_Sample_Load", SetLastError=false)]
private static extern IntPtr FSOUND_Sample_Load(int index, string name_or_data, uint inputmode, int memlength);
MarshallAs attribute is not supported by CNF of course, and CharSet attribyte also doesn’t seem to affect the outcome.
The error code I do get is 9. I assume it’s “File Not Found” error. CNF code just right before the pinvoke confirms that the file exists, and I am wondering why FMOD is not able to. I suspect the function is not getting the filename correctly. Note that the code works perfectly on my xp using the same CNF. The culprit must be either FMOD itself or how CNF is passing the filename string to FMOD.
Any ideas? :x[/quote:3timf3jn]
I remember that when I had this kind of problem, it was all in the path locations. Windows CE has its file/directory structure in a strange way.
For example: \Program Files\usingwrapper\mp.mp3 is the location I am passing to FMOD. There are a few technical articles on MSDN about this.
However I have not as yet managed to import the FMOD.DLL into a .NET project in fact I have given up!
I am instead creating a wrapper dll in eMbedded VC++ 3. This simply exports some functions in way dictated by the MSDN articles. These in turn call the FMOD functions. It is less than ideal as if I want to consume another feature/function from FMOD, I have to alter my DLL – but it works.
Hope this helps.
Thanks for the input.
I actually never thought about this before you showed me an example path. I am going to try to double up my backslashes (), to see if that helps. .NET seems to be ok with it but maybe .NET is doubling it up before it passes it to the OS anyway.
I’ll keep you guys posted.
Please login first to submit.