News:

Come Chat with us live! Learn how HERE!

Main Menu

Sound works and does not work

Started by rotacak, January 28, 2009, 09:21:57 PM

rotacak

I trying to play sound with this function:
BG_AddPredictableEventToPlayerstate( EV_GENERAL_SOUND, G_SoundIndex( "sound/pokus/test.wav" ), &ent->client->ps );

That sound is in right path, in new pk3. But when I use that, then client will crash to blue console with message "S_FindName: empty name".
But - when I again run same client and again try play same sound, then it work OK. Same thing happen with sounds in data pk3, only sound/misc/fry.wav is possible to play without first client crash.

Anyone know why ???

BTW, when I write wrong path, then client will crash too (firsttime), but when I run it again and again use wrong path, then it will display error message "using default sound", and nothing will crash.

kevlarman

use G_Sound if you're modifying only the server code.
Quote from: Asvarox link=topic=8622.msg169333#msg169333Ok let's plan it out. Asva, you are nub, go sit on rets, I will build, you two go feed like hell, you go pwn their asses, and everyone else camp in the hallway, roger?
the dretch bites.
-----
|..d| #
|.@.-##
-----

rotacak

But G_Sound will create sound where I standing. I need carry that sound, similar to taunt. And BG_AddPredictableEventToPlayerstate can hear only myself, nobody else :-(

Amanieu

Tried doing something with the vsays subsystem?
Quote
< kevlarman> zakk is getting his patches from shady frenchmen on irc
< kevlarman> this can't be a good sign :P


rotacak

#5
I am lost. I used G_AddPredictableEvent only at registered sounds, so no more "S_FindName: empty name" errors. But in game sometime few players are suddently disconnected again with this error. But that make no sense, when they using all sounds 1000x and all is ok, but after 1001 - someone's client crash. I don't see any logic why was who disconnected.

I tryed to create my own temp entity (from G_sound) and move it together with player. Maybe it does not work or it works, don't know, but sound was not moving at all. Like with G_sound.

All problems are due to this piece of code in client/snd_dma.c. That probably not need be there at all, it only causing client crash and stupid error:
if (!name[0]) {
Com_Error (ERR_FATAL, "S_FindName: empty name\n");
}


If someone will help me with that I will raise his karma up to 100 :) There must be some way, how to make carriyng sound work without client mod. I have my half-function version on my server (R Unlimited CZ), so everybody can try it in map boxfield_b5. In game try command /playsound singing, /playsound forward, /playsound ahaha, /playsound this_is_madness and many more (manual is hidden in central room).

gimhael

Do you register all your sounds at the start of the game with G_SoundIndex or do you load them immediately before you call G_Sound ?

The error message indicates that the name of the sound is empty. The name is sent in a config string when G_SoundIndex is called, not in the entity created by G_Sound, so maybe if the client side entity is created before the config string is processed (UDP is not a reliable network protocol), it will use the empty name and crash the client.

Also there is a max. of 256 sounds that can be registered in G_SoundIndex, so if you create *lots* of different sound effects, you may eventually hit that limit.

rotacak

gimhael:
I not using G_sound, because that not carry sound with player. It's sad, because G_sound works without problems even when you use wrong sound name/index - only error mesage is displayed in console and default sound is played - no client crash.

And yes, I have all sounds registered. I created speaker entities in map with all sounds. That cause all sounds are in that map automatically registered.

Quotemaybe if the client side entity is created before the config string is processed (UDP is not a reliable network protocol), it will use the empty name and crash the client.
Hmm, that will be probably the problem. Is possible to resolve it somewhat? It's not need be played, but have to not crash.

I using only 21 sounds, so the limit is not touched.

I used this:
G_AddPredictableEvent (g_utils.c) -> BG_AddPredictableEventToPlayerstate (bg_misc.c) -> there is set ps->events.

Now I try this, but it will probably fix nothing:
G_AddEvent (g_utils.c)

montbot

#8
I am getting this same error after I incorporated the freeze tag mod into my quake3 source code.  It only happens right as a level is ended and I can't figure out what piece of code is causing this crash.  Has anyone found a fix for this elusive bug?!?!

gimhael

Well technically you could replace all the calls to Com_Error(ERR_FATAL, <stuff>); with Com_Printf( S_COLOR_YELLOW <stuff>); return NULL; in S_FindName but then you have to check for a NULL result where this function is called (in S_Base_RegisterSound), change sfx = S_FindName( name ); into if ((sfx = S_FindName( name )) == NULL) return 0;

Then the client shouldn't crash in this function.

montbot

Unfortunately I can't edit any of the client code.  Everyone that connects uses the standard client.  For this reason, whatever call I am making in the game code needs to be fixed at that point so it doesn't crash the client.