Author Topic: Sound works and does not work  (Read 6420 times)

rotacak

  • Posts: 761
  • Turrets: +39/-64
Sound works and does not work
« on: January 28, 2009, 09:21:57 pm »
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.
« Last Edit: January 29, 2009, 02:30:20 pm by rotacak »

kevlarman

  • Posts: 2737
  • Turrets: +291/-295
Re: Sound work, not work
« Reply #1 on: January 29, 2009, 06:23:41 am »
use G_Sound if you're modifying only the server code.
Quote from: Asvarox link=topic=8622.msg169333#msg169333
Ok 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

  • Posts: 761
  • Turrets: +39/-64
Re: Sound work, not work
« Reply #2 on: January 29, 2009, 01:08:10 pm »
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

  • Posts: 647
  • Turrets: +135/-83
    • Amanieu
Re: Sound works and does not work
« Reply #3 on: January 29, 2009, 03:22:48 pm »
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

  • Posts: 761
  • Turrets: +39/-64
Re: Sound works and does not work
« Reply #4 on: January 30, 2009, 06:03:20 pm »
What is vsays?

rotacak

  • Posts: 761
  • Turrets: +39/-64
Re: Sound works and does not work
« Reply #5 on: January 31, 2009, 03:38:00 am »
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:
Code: [Select]
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).
« Last Edit: January 31, 2009, 03:40:24 am by rotacak »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: Sound works and does not work
« Reply #6 on: January 31, 2009, 07:52:38 am »
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

  • Posts: 761
  • Turrets: +39/-64
Re: Sound works and does not work
« Reply #7 on: January 31, 2009, 06:02:59 pm »
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.

Quote
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.
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

  • Posts: 2
  • Turrets: +0/-0
Re: Sound works and does not work
« Reply #8 on: April 21, 2009, 07:42:53 pm »
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?!?!
« Last Edit: April 21, 2009, 07:48:44 pm by montbot »

gimhael

  • Posts: 546
  • Turrets: +70/-16
Re: Sound works and does not work
« Reply #9 on: April 21, 2009, 08:00:17 pm »
Well technically you could replace all the calls to
Code: [Select]
Com_Error(ERR_FATAL, <stuff>); with
Code: [Select]
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
Code: [Select]
sfx = S_FindName( name ); into
Code: [Select]
if ((sfx = S_FindName( name )) == NULL) return 0;
Then the client shouldn't crash in this function.

montbot

  • Posts: 2
  • Turrets: +0/-0
Re: Sound works and does not work
« Reply #10 on: April 21, 2009, 08:04:23 pm »
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.