PocketMatrix forums

A read-only archive of the PocketMatrix forums (2001–2014). Posting and accounts are closed.

Multiple wavs playing at the same time?

Still trying to bang my first game together.

Is it possible to play two wav files simultaneously using sndPlaySound or any other function?

Karl,

Yes you can play two wavs together but I don't think it can be done with nsdPlaySound. More likely WaveOut will help you.

I am currently using fmodce from http://www.fmod.org and would thoroughly recommend it. It allows you to play multiple wavs and a backing mod music file without any noticeable speed reduction.

If you are intending to distribute your game for free then fmodce is free. For commercial products have a look at the licensing page, I have a multiple shareware license which for $250 I think is good value.

I hope this helps
Bad

PS I have nothing to do with fmod other than being an impressed customer :)
as far as I know, nope. You should mix all sound together by yourself into one wav and send it using waveout to get good results. You will create such a wav every 50-100ms or so. There's a basic waveout support in easyce1.6 as far as i remember, you will need to add some mixing routines by yourself, you can find some in midmod source code, i think.
Good luck
BadBazza is right.  FMOD is really the way to go.  Not only is it some of the fastest sound code available, it also supports all the MOD formats (which are a REAL bitch to get right), MP3s, multiple wave outs, etc.  I see no reason to write your own in this regard, unless sound coding is your bag ofcourse.

-Hosed
hosed:or unless you want to release your stuff as shareware or so and 100$ (or what was the price) is a lil much for you.
Lemmings is using MikMod. It works fine, but it is a little slow, IMO. It is free however.
IMO, the FMOD limitation that it can no longer play sound if the device is powered off / on places it one small step above worthless.

Dan East
hmm, how's that? couldn't they simple make a routine that checks if device was turned off/on and reinitialize if needed???
Jacco, is this the version of mikmod you use:
http://www.xsolution-online.de/mikmodce.htm

It says for ARM only. I just wondered if there were multiple ports of it to CE created by different coders, thus some may be better than others. Can mikmod be used to play synchronous wavs as well, or does it just do mods / music?

I think that is one of the most blaring, lacking things for CE gaming development at this time - a good, open source, free sound library. mikmod may be the solution, but is sounds like it at least needs optimizing. There are several gfx libraries, and even a few fixed point 3D engines that look pretty good. So maybe we can take mikmodce and optimize it into what it should be?

Dan East
Yeah, that's where I got it. And it compiles just fine on all other PPC's. No problem. Just stick with 22Khz or even 11Khz to keep the CPU hit reasonable.

Main issue with the performance is not the average CPU usage BWT, because that seems to be OK. MikMod does however seem to use more % in some frames, making games slightly jerky.
I looked at the source and didn't see anything too cludged together. It looked decent to me. It doesn't look like any of the actual core routines were even touched in the porting process. Of course being that they are all math none should be needed.

It would be interesting for someone with both MikMod and FMod to create a simple test app to play a mod file. Then each time you call the update function calc the milliseconds it required to process (GetTickCount) and generate a culmulative total of milliseconds processing required to play that mod. We could then see exactly which was more effecient, and how much so. That would ebe very interesting, hint, hint. :)

Jacco, various effects performed on the instruments could greatly increase processing while that one note was played. That of course is note-specific, so the artist would "cause" that problem. You could always edit the mod and strip out the effects, modify the player to not perform certain effects, or ask the artist to not use them if the music is custom-made for you.

Dan East
simonjacobs · 05 Jan 2002, 17:07 UTC
Dan:

With fmod you just call PlaySong and it gets on with things in its own thread, you dont need to call anything else. I'm not sure how you could count the processing time it uses except by monitoring processor usage.
Simon,

At a minimum, you could profile your app with the song playing, then again without it and note the difference in performance of other areas within the app (i.e. frame rate).  That's pretty easy to do and would at least give you a starting point in determining the overhead.


If anyone has actually paid the small fortune and has access to the source, they could do the timing in FMod's main loop. That would provide the most accurate result that could be compared directly to MikMod.

Dan East
if you would ask fmod's developer really nice he might do it for you. But as far as I know fmod for ce is still work in progress and it lacks optimizations and mp3 support.
Hey ,sources of quake are available ,and there is a little engine to play multiple wavs as I remember playing quake with musik,so isn't it possible to copy algo of quake to make a little multiple wav player for easyce?
Yes. Use the Pocket Quake source, because I've already made all the needed modifications for CE (removing DirectSound code, etc). It is GPL'ed, but you could create a separate, stand-alone sound DLL that your application could use.

Dan East
So I can take a part of PocketQuake
and paste it to my code with GPL License text?

why it must be a dll?
I'm no attorney, but from everything I've heard, if you use GPL'ed source in your project, then you must release the source to your entire project. If you make it into a separate, standalone library then you can just release the source to that library, and not your whole app.

Dan East
where can I download pocketquake source?
Click on the Pocket Quake link at the top-right corner of this page.

Dan East

I just looked to fmod,it looks great
but maybe too slow for mp3
anyone use pocketdivx to play mp3
in their programs?
cps · 12 Jan 2002, 16:57 UTC — LibMikMod on PocketPC
Hi, I ported LibMikMod to the PocketPC a while back. Works on all processors, but is just a quick and dirty port. It's available from my homepage.

(Phantom, I'm pretty sure my LibMikMod port is the one used in Lemmings -- when I was looking at the source, some of my comments were in there. Maybe xsolution took my port? Not a big deal in any case.)

I've also written a very basic sound/music wavemixing 'library'. You provide a number of music loop wavs and a number of sound effects, and can switch loops and trigger effects at will. Let me emphasize: it's very basic code. But, it might be useful for those trying to learn how to do this. I called it ZapPow and it's available here.. To test the sample app, copy the zap.wav and loop1.wav files to the PocketPC root directory, then build and run.

The BoomChick drumloop program source, also available from my homepage, might be similarly instructive (it mixes up to sixteen .wavs in realtime).

Note that both of the above only can handle 'canonical wave format' .wavs, google 'stripwav' for info and a converter.

Dan, I'd like to create or help create a freeware audio library at some point and have some ideas, but not much time. Email me if interested.
laurnet · 19 Jan 2002, 13:38 UTC — fmod
fmod is awesome and easy to integrate!
really good
It is also very expensive (unless you are producing freeware or "shareware" ), and stops working if the device is powered off / on while it is playing, which makes it practically useless.

Dan East
laurnet · 19 Jan 2002, 18:55 UTC — fmod
arf ..
didn't looked the price
yes its really expensive