PDA

View Full Version : Sound



xGTx
26-05-2005, 09:48 PM
It's come time for me to put sound into my game. Now I don't understand much about it at all.

My major question is, can I play sound files from a MemoryStream?

Because in my game the idea is to use all it's resources from a pack file where I store all the resources (images, sounds, configuration files). This would be really good.

Also, what sound system should i use, how should i consider? I'd love to be able to play .midi and .ogg and .wav And I realize some of these sound systems are not free if you plan to sell your product.

My product, a game creation set, i plan to release as limited freeware. Everything works fine, but it'll have a player cap that can be removed if they pay x amount. Would that be against the sound system's EULA?

Thanks in advance!

cairnswm
27-05-2005, 04:44 AM
My guess is you want to look at OpenAL.

What Graphics library are you using - SDL has SDL_mixer, DirectX has DirectSound - maybe sticking to something close to your graphics might be a good idea.

But anyway - dont ask me - I never seem to get the sound stuff in my games right :(

But Also - one of the best places I found for sound was windows MMSystems PlaySound - and it can play from streams :)


Procedure PlayTheSound(Ptr : Pointer);
Begin
mmSystem.PlaySound(PChar(Ptr), 0, SND_MEMORY or SND_NODEFAULT or SND_ASYNC);
End;


procedure LoadWav(const Filename: string; var Ptr: pointer);
var
Strm: TFileStream;
Size: integer;
begin
Strm := TFileStream.Create(Filename, fmOpenRead);
GetMem(Ptr, Strm.Size);
Strm.ReadBuffer(Ptr^, Strm.Size);
Strm.Free;
end;


OK so it only plays Wavs - only plays one sound at a time - But it worked for my LD48 entry :)

xGTx
27-05-2005, 06:52 AM
Im using Omega SDK they have a sound component, should i stick with that?