PocketMatrix forums

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

What about sound?

GapiDraw is absolutely outstanding. However, it is for GAME development, and there is another thing which game programmer must think about - SOUND. As I know, Windows does not mix sounds. So, I have two questions.

1. Will GapiDraw have such ability? :roll: Or maybe it will be separate sound mixing library?

2. Developers, what mixing libraries you are using now? Just help me to choose...

Thanks.
DillRye · 22 Jul 2002, 18:00 UTC — Gapi(DRAW) ;)
I don't think GapiDraw will ever have sound incorperated(who knows though), It would be cool if there was a seperate sound library though. Its nice having a modular approach to things. If I wanted to use GapiDraw and then some other sound mixer I could. I used MikMod for my last game, and the newest game I am writing I am heavily debating this. MikMod is free, you can use it commercially, but it doesnt always produce the clearest sound If your not playing music with it all the time(If you were going to use MikMod, may I suggest recompiling it for S3m support instead of just .mod).

There are other sound utilities out there such as Fmod(very expensive if your going to do it commercially).

Also, There is PgnSoundLib which only costs 100 dollars but when I was using it, It would not load up alot of wave files saying they were not "PCM" format when they actually were. I emailed the author about this, but I don't think he speaks good english and didnt understand me :).

The other thing Im heavily debating is writing my own sound mixing library. I honestly have never done anything with sound before, but I found a good source code sample for mixing .wavs called "ZapPow". Ill have to go dig for a link to give you if you want to see it.

Hopefully you can make some sense of what I just said :).
One should never say never.. :) If Gapi--- some time in the future would get sound support, it would however only support sound effects and not music.

/Johan
but I found a good source code sample for mixing .wavs called "ZapPow". Ill have to go dig for a link to give you if you want to see it.

Please do. I'm also looking to write my own mixer, since what out there doesn't fit the bill.

Thanks!
InexorableTash · 23 Jul 2002, 08:15 UTC
Would something with this sort of API be helpful?

Code:


//----------------------------------------------------------------------
class GAPISOUND_API IGapiSound
//----------------------------------------------------------------------
{
public:
virtual ULONG AddRef() = 0;
virtual ULONG Release() = 0;

virtual HRESULT CreateSoundBuffer( IGapiSoundBuffer** ppSoundBuffer ) = 0;
virtual HRESULT DuplicateSoundBuffer( IGapiSoundBuffer* pGsbOriginal, IGapiSoundBuffer** ppGsbDuplicate ) = 0;

virtual HRESULT Activate( BOOL fActive ) = 0;
virtual HRESULT Rebuffer() = 0;
};


//----------------------------------------------------------------------
class GAPISOUND_API IGapiSoundBuffer
//----------------------------------------------------------------------
{
public:
virtual ULONG AddRef() = 0;
virtual ULONG Release() = 0;

// Information
virtual HRESULT GetFormat( WAVEFORMATEX* pwfxFormat, DWORD dwSize, LPDWORD lpdwSizeWritten ) = 0;
virtual HRESULT GetStatus( DWORD* pdwStatus ) = 0;
virtual HRESULT SetFormat( WAVEFORMATEX* pwfxFormat ) = 0; // NOTE: Applies to primary sound buffer

// Play management
virtual HRESULT GetCurrentPosition( DWORD* pdwCurrentPlayCursor ) = 0;
virtual HRESULT Play( DWORD dwReserved1, DWORD dwReserved2, DWORD dwFlags ) = 0;
virtual HRESULT SetCurrentPosition( DWORD dwNewPosition ) = 0;
virtual HRESULT Stop() = 0;

// Data management
virtual HRESULT LoadWaveResource( HMODULE hModule, LPCTSTR lpName, LPCTSTR lpType ) = 0;
virtual HRESULT LoadWaveFile( LPCTSTR szFileName ) = 0;

// Sound management
virtual HRESULT GetPan( LONG* plPan ) = 0;
virtual HRESULT GetVolume( LONG* plVolume ) = 0;

virtual HRESULT SetPan( LONG lPan ) = 0;
virtual HRESULT SetVolume( LONG lVolume ) = 0;
};



I've been cobbling this together by poking at various sources and examples. The DLL (GapiSound.DLL) is by no means complete (stereo and looping are the two big missing E_NOTIMPL features on the TODO list), and presumably full of bugs, but it's functional on WinXP and (last I checked) PPC2000.

I liked Johan's approach of basing the GapiDraw API on DirectDraw, so I stole the name format and hence "GapiSound" is mostly equivalent to DirectSound.

I have only about 2 hours per week to poke at it; if anyone feels like taking it over and hosting the source somewhere (e.g. sourceforge) I'd be happy to offload it.

I'd also love for someone to do a far better job than I'm doing on making Gapi3D:

Code:

//----------------------------------------------------------------------
class IGapi3DDevice
//----------------------------------------------------------------------
{
public:
virtual ULONG AddRef() = 0;
virtual ULONG Release() = 0;

virtual HRESULT SetTexture( TextureMap* pTexture ) = 0;
virtual HRESULT DrawTLPrimitive( DWORD dwPrimitiveType, G3DTLVERTEX* ptlVertices, DWORD dwVertexCount, DWORD dwFlags ) = 0;
virtual HRESULT DrawIndexedTLPrimitive( DWORD dwPrimitiveType, G3DTLVERTEX* ptlVertices, DWORD dwVertexCount, LPDWORD pdwIndices, DWORD dwIndexCount, DWORD dwFlags ) = 0;
};


Again, the 2 hours a week is keeping it from being a very efficient development process.
Sound: "mikmod", free, easy, good, supports mods, and can mix wavs, minimual CPU usage, what more could a programmer want!

-Brendan
Is MikMod available in source form? I've searched but could only find a lame compiled version from someone that said it wasn't working very well.

Maybe you could post a url if you have one?

Thanks!
With the EasyCE/lemmings demo there is a library project set up to be compiled with Easy CE. This is probably the easiest way to get mikmod for your pocket pc device. If you do use it and get some nice clear sound, I would like to know what you did. Because If im not playing music, I hear slight static in the background. Thing is, I know people will probably turn off the music, but keep the sounds on so this is sort of a problem.



http://home.earthlink.net/~cps46/ZapPow.zip Is the link to the ZapPow sample. One of the guys from this board wrote it, he also had a part in porting mikmod to wince.


Oh and efortier, If you start writing a mixer, maybe we can both write a really nice one. Might be a good thing to collaberate on.