snd_play handle is not freed [SOLVED]

Posted By: VoroneTZ

snd_play handle is not freed [SOLVED] - 02/08/23 09:11

Hello!
I have small game with 3 levels (1 outdoor and 2 interiors, you can change level about 10-15 times for a game)
They have some (from 1 to 5 to level) fire entities with ent_playloop in action
Player action have 2 ent_playloop local handles for water and underwater effect (snd_tune when camera.z<50 for water snd and when camera.z<0 for underwater) and snd_play footsteps\attack sounds
And i have NPC who talk with Player by ent_playsound

All sounds are declared at the header (SOUND* bla-bla-bla, all of them are *.OGG)
all handles are local

I use A8 Pro

Problem

When i play about 5 minutes, sounds starts to behave very stange.
If i walk when NPC is talking- NPC sound handle stops after player footstep is sound (or another snd like attack sound)

or another case
i used snd_play for music too
and music was changed every footstep after 5mins
if (!snd_playing(music)){snd_play(new_tack);}
i fix it with using media_play and mp3 tracks, but i want use ent_playsound with NPC dialogs
Anyway, media_play can't play OGG file!

I know about 32 direct play sounds limit, but i try to use:

- add one global handle for all attack sound (mine and npc)
- use snd_stopall(4) before NPC dialog;
- add snd_stop before new footstep sound;
- exit all entity loops and snd_stop all their handles before new level_load (like a fire, underwater, water sounds);
- add if(vec_dist(fire.x,my,x)<500){snd_play}else{snd_stop} for fire action

but it solve my problem partially, and i still have this problem after ~10 minutes of playing (at final scene!)

PLS tell my how can i fix it, or tell me how i need use sounds correcly (maybe i need to use snd_add?)
Posted By: VoroneTZ

Re: snd_play handle is not freed [SOLVED] - 02/08/23 09:55

oh
it's looked what after my manipulations abowe it's really solve my problem, but 2 final npcs conflicted each other with snd_stopall(4)
© 2024 lite-C Forums