AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Solved Glitched Audio (https://forums.alliedmods.net/showthread.php?t=309200)

edon1337 07-17-2018 08:37

Glitched Audio
 
I'm emitting sounds to players but they're either not being emitted or glitch the audio.

I have 4 sounds:

#1, doesn't emit.
PHP Code:

public @HamSpawn_Postid )
{
    if( 
is_user_aliveid ) )
    {
        
client_cmdid"spk %s"g_iSoundsLanding_Sound ] );
    }
    return 
HAM_IGNORED;


#2, Glitches the audio, makes a weird un-pleasant noise.
PHP Code:

public @HamThinkInfoTarget_PreiEnt )
{
    if( ! 
pev_validiEnt ) )
    return 
HAM_IGNORED;
    
    new 
szClassName32 ];
    
peviEntpev_classnameszClassNamecharsmaxszClassName ) );

    if( 
equalszClassNameAIRDROP_CLASSNAME ) )
    {
        
set_peviEntpev_nextthinkget_gametime( ) + 0.01 );
        
        if( 
peviEntpev_flags ) & FL_ONGROUND )
        {
            
client_cmd0"spk %s"g_iSoundsAirDrop_Land_Sound ] );
        }
    }
    return 
HAM_IGNORED;


#3, doesn't emit
PHP Code:

public @HamThinkPlayer_Preid )
{
    if( ! 
is_user_aliveid ) )
    return 
HAM_IGNORED;
    
    if( 
g_bIsPlayerInParachuteid ] )
    {
        static 
Float:fVelocity]; 
        
pevidpev_velocityfVelocity ); 
        
        if( 
pevidpev_flags ) & FL_ONGROUND )
        {
            
g_bIsPlayerInParachuteid ] = false;    
            
client_cmdid"spk %s"g_iSoundsLanding_Sound ] );
        }
    }
    return 
HAM_IGNORED;


#4, Works properly
PHP Code:

MakeAirDropEnt( )
{
    
client_cmd0"spk %s"g_iSoundsAirDrop_Appear_Sound ] );


They're all 8 bit 22050 hz mono channel

HamletEagle 07-17-2018 08:44

Re: Glitched Audio
 
1. Show g_iSounds values.
2. Most likely because you set the entity to think each 0.01 seconds and you are always emitting the sound, without ever letting it play. You need to sync the entity think to the sound duration. For example if sound duration is 1 second then the entity should think each 1.0 seconds to let the sound play.

edon1337 07-17-2018 08:47

Re: Glitched Audio
 
Quote:

Originally Posted by HamletEagle (Post 2604219)
1. Show g_iSounds values.
2. Most likely because you set the entity to think each 0.01 seconds and you are always emitting the sound, without ever letting it play. You need to sync the entity think to the sound duration. For example if sound duration is 1 second then the entity should think each 1.0 seconds to let the sound play.

1)
PHP Code:

PARACHUTE_DEPLOY_SOUND CS_BattleRoyale_Sounds/Parachute_Deploy.wav
LANDING_SOUND 
CS_BattleRoyale_Sounds/Landing.wav
AIRDROP_APPEAR_SOUND 
CS_BattleRoyale_Sounds/AirDrop_Appear.wav
AIRDROP_LAND_SOUND 
CS_BattleRoyale_Sounds/AirDrop_Landing.wav 

2) Doesn't FL_ONGROUND get called only when entity/player hits the ground? So basically just once? I think it does. My entity doesn't jump around for it to get called more than once.

Natsheh 07-17-2018 08:53

Re: Glitched Audio
 
1. Make sure the sounds are suitable for the game.
2. Make sure the sounds are preached.
3. Make sure the sounds are in the correct path.
4. Make sure when you play the sound you dont spam playing.
5. Make sure you are using wav type sounds when playing with spk/speak.
6. Make sure your client volume is hearable.
7. Make sure your speakers are working :).
8. Make sure the length of the file path doesnt overcome the array size.

Some tips.

edon1337 07-17-2018 08:56

Re: Glitched Audio
 
Quote:

Originally Posted by Natsheh (Post 2604224)
1. Make sure the sounds are suitable for the game.
2. Make sure the sounds are preached.
3. Make sure the sounds are in the correct path.
4. Make sure when you play the sound you dont spam playing.
5. Make sure you are using wav type sounds when playing with spk/speak.
6. Make sure your client volume is hearable.
7. Make sure your speakers are working :).

Some tips.

1) I think they are
Quote:

Originally Posted by edon1337 (Post 2604215)
They're all 8 bit 22050 hz mono channel

2) Yes, they are, otherwise I'd get errors.
3) Same as 2)
4) Might be
5) Yes I am, look at the sound extensions.
6) It is
7) They are

Natsheh 07-17-2018 09:01

Re: Glitched Audio
 
#3

@HamThinkPlayer_Pre( id )

Is this forward hooked?

If it is, thats mean the landing sound has file error means its not suitable.

Visinescu 07-17-2018 09:04

Re: Glitched Audio
 
Why not use MP3 ?

edon1337 07-17-2018 09:08

Re: Glitched Audio
 
Quote:

Originally Posted by Natsheh (Post 2604227)
#3

@HamThinkPlayer_Pre( id )

Is this forward hooked?

If it is, thats mean the landing sound has file error means its not suitable.

It is hooked, how is it not suitable if I'm using the allowed settings?

edon1337 07-17-2018 09:10

Re: Glitched Audio
 
Quote:

Originally Posted by Visinescu (Post 2604228)
Why not use MP3 ?

Because if I want to use emit_sound, MP3 isn't supported.

Natsheh 07-17-2018 09:13

Re: Glitched Audio
 
Quote:

Originally Posted by edon1337 (Post 2604231)
It is hooked, how is it not suitable if I'm using the allowed settings?

Well i am helpless, the only way now is trying to debug and check if it get called or not.


All times are GMT -4. The time now is 12:40.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.