OK, I’ve spent like 2 days trying to make an simpel pocketpc app playing a mp3 file. Now at last I got it to work and perhaps this will help some newbies (like me:)) out there!
Well what you need is VS2005 (I used pro ed.) and .net CF 2 should come with this version. What you need next is a C# wrapper for fmodce library. To make this clear, a wrapper could be a class or DLL/library containing the methods needed to call the functions in fmodce library (fmodce.dll).
Now this fmodce wrapper written in C# is already available here in the forum: http://126.96.36.199/forum/viewtopic.php?t=4874.
Remember the wrapper is only the first section of the codes (there two sections of codes in that post). The second part of the codes is used to play/stop a mp3 file.
Great thanks to dankrusi for the wrapper!
There are two 2 ways of implementing the wrapper into your codes.
we’ll talk about the first way first:
The first way is to create a new cs file where you copy the whole wrapper found in the post into this file. Remember to change the names of the class/file if you want to. The next step is to add this cs file to your project: in vs2005: file->move *.cs into.
In order to run any of the methods in the wrapper file we’ve just created we must have a main class. In vs2005, creation of a project will give the main class calls form1.cs. To test the app. works, simply add a button on the form1.cs, double-click on the button and you will get to the button method. Now you add this code into this button method:
// Declare our handles
// Initialize fmod with mixrate equal to 44.1kHz
FMOD.PPC.Init(44100, 16, 0);
// Initialize the handle with the track file.
// Note that you must provide the full Pocket PC path. See http://msdn.microsoft.com/library/defau … ppc_io.asp for more info…
soundStream = FMOD.PPC.GetStream("test.mp3");
// Open the stream in Normal mode, which is combination of Mono sound, 16 bits, Signed
soundHandle = FMOD.PPC.Open(soundStream, 0x100, 0, 0);
// Start playing
Remember pieces of this code is taken from the second section of the codes posted by dankrusi. Remember also to change the path of the mp3 file.
The program should be able to be compiled with no errors.
However do not use the pocketpc emulator that comes with vs2005,
because it won’t allow you to place fmodce.dll into emulatoren when compilling/debugging. Hence the app. won’t be able to find the fmodce.dll.
So use a real pocketpc to try this out. The next thing is important; the choice of fmodce.dll. There are plenty of them in the sdk 3.75, please choose the corresponding one. I personally used the one found in: \api\wce4\armv4 and I got a HP hx4700.
After compiling you’ll get the .exe file. Copy this to your pocketpc to try out. Remember to put the fmodce.dll IN THE SAME PATH/DIRECTORY AS THE .exe. You could add a test.mp3 in the same directory to test if you havent altered the code above.
Now you should have a program with a single button, which play the mp3 file if pressed.
The other way to implement the wrapper is through use of DLL/library. This can be done by choosing library instead pocketpc app when creating a project in vs2005. Next is to copy the wrapper code into the main class(form1.cs) and build the dll project. You should get an dll file (instead of a .exe).
Now create another project to test whether things work. First, you must add the dll file as reference into the project; right click the references(in solution explorer)->browse->choose ur dll and add. Your project should now have the dll implemented. Now the dll is implemented into your project, you can try to create a button to test whether it works. This can be achieved as first method. Just remember that to call any functions in the dll you must specify following; namespace.class.method. These should correspond with the names you created in the dll project.
Thats it, and good luck!
- nibbana asked 13 years ago
Does anyone have a c# wrapper to fmodce.dll that allows sounds from buffer?
I’m a game programmer and its important for us to keep our sounds locked away in a resource file; my only option is to play sounds from memory. However the wrappers I’ve seen all want a file name or a file handle.
If its not already available, I’ll be working on this myself.
( I’m sad that FMOD EX does not support Windows CE :/ )
- zp answered 10 years ago
Please login first to submit.