How to play a wav in PR4

Started by
0 comments, last by m1i1k 22 years, 4 months ago
Does anybody know how to play a wav using the Direct Sound interface in PR4? I tried using the MakeSound() function from the simpleland demo, but it did not work. I just need to attach a sound to an entity without the terrain engine involved. So if someone could give me the sequence of functions to call to get this done that would be great. Mike
Mike
Advertisement
I figured it out. The problem is that min distance is the distance where the sound starts fading out and not where the sound starts playing. So here is my code, just in case anybody has the same problem.

PR_DWORD sndnum;
SND_3DSOUND *soundptr;

SND_InitializeSound ();
SND_Allocate3DSoundList (10);
SND_AllocateChannelList (12);
SND_AllocateWAVList (10);
SND_LoadWAV ("ufo.wav");


sndnum = SND_FindSound ("ufo.wav");
soundptr = SND_Initialize3DSound (sndnum, SOUND_LOOP);

SND_SetListenerDopplerFactor(0.0f);
SND_SetListenerDistanceFactor (100.0f);

SND_AttachToEntity (soundptr, entity);

//before I had it set to 0,48000 and I couldn''t hear anything
SND_Set3DSoundDistance (soundptr, 40000, 48000);

SND_Set3DSoundVolume (soundptr, 1.0f);
SND_Play3DSound (soundptr);

while(1) //main loop
SND_Update3DSounds ();

SND_CloseSound (); //my Gforce2 card goes ape shit if I don''t close the sound.



Mike
Mike

This topic is closed to new replies.

Advertisement