Registering new sounds


(Madras) #1

Hi! I’ve got problem again! :slight_smile: This time with sound.
I registered new sounds effects, but when I want to use these sounds the game returns console error:
S_Startsound: handle [sequence of numbers] out of range.” and doesnt play of course. I think, there’s no free positions for new sounds, because mod which I based (ETPub) booked all free “sound slots” ?? Tell me what should I do to add new sounds without any errors.


(Smurfer) #2

what kind of sound?


(Shanks) #3

This is some very basic stuff you’re having problems with. Maybe you should read some tutorials before going any further…


(Madras) #4

I wanna add RTCW ricochet sounds. First I declared three effects in cg_Media_t, cg_local.h file:

sfxHandle_t	sfx_ric[3];

.
Next in CG_RegisterSounds(), cg_main.c file:

cgs.media.sfx_ric[0] = trap_S_RegisterSound ("sound/weapons/machinegun/ric1.wav", qfalse );
cgs.media.sfx_ric[1] = trap_S_RegisterSound ("sound/weapons/machinegun/ric2.wav", qfalse );
cgs.media.sfx_ric[2] = trap_S_RegisterSound ("sound/weapons/machinegun/ric3.wav", qfalse );

And I’m using these sounds in function called CG_MissileHitWall(), cg_weapons.c file, under “switch (weapon)” :

case WP_GARAND_SCOPE:
case WP_K43_SCOPE:
	// actually yeah.  meant that.  very rare.
	r = rand() % 3 ; // JPW NERVE increased spark frequency so players can tell where rounds are coming from in MP
	sfx = cgs.media.sfx_ric[r];

But in the game I ve got error instead sound effect. It is worth mentioning that when I’m declaring these sfx in cg_Media_t (cg_local.h), another elements from cg_Media_t are “mishmashed”, swapped in ET and many items from cg_Media_t don’t work correctly.


(Madras) #5

Okey, I solved the problem myself. I just did all the steps again. I dont know what was wrong.


(Rampag3) #6

Well, I don’t know what you did, but could be the file itself.

If you cutting a sound and just putting into a pk3 file, you need to make sure that the sound be:

Sample Rate: 22 050
Bit-depth: 8 bit
And mono.