Raised This Month: $ Target: $400
 0% 

Solved Glitched Audio


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 08:37   Glitched Audio
Reply With Quote #1

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
__________________

Last edited by edon1337; 07-17-2018 at 17:04.
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-17-2018 , 08:44   Re: Glitched Audio
Reply With Quote #2

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.
__________________
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 08:47   Re: Glitched Audio
Reply With Quote #3

Quote:
Originally Posted by HamletEagle View Post
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.
__________________
edon1337 is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 07-17-2018 , 09:31   Re: Glitched Audio
Reply With Quote #4

Quote:
Originally Posted by edon1337 View Post
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.
1. I have the impression that when using client_cmd and spk you need to use full path(i.e sound/CS_BattleRoyale_Sounds/Parachute_Deploy.wav) and when precaching you need only CS_BattleRoyale_Sounds/Parachute_Deploy.wav.

Try something like:
PHP Code:
client_cmdid"spk sound/%s"g_iSoundsLanding_Sound ] ); 
2.No. Once FL_ONGROUND flag is set then it remains on player flags until they are no longer on ground. Put a message in there, you'll see it keeps being printed.
It doesn't "get called", it's a flag so it is added/removed. Like you would do some_var = 1 and later to clear that value some_var = 0.
__________________

Last edited by HamletEagle; 07-17-2018 at 09:35.
HamletEagle is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 10:56   Re: Glitched Audio
Reply With Quote #5

Quote:
Originally Posted by HamletEagle View Post
1. I have the impression that when using client_cmd and spk you need to use full path(i.e sound/CS_BattleRoyale_Sounds/Parachute_Deploy.wav) and when precaching you need only CS_BattleRoyale_Sounds/Parachute_Deploy.wav.

Try something like:
PHP Code:
client_cmdid"spk sound/%s"g_iSoundsLanding_Sound ] ); 
2.No. Once FL_ONGROUND flag is set then it remains on player flags until they are no longer on ground. Put a message in there, you'll see it keeps being printed.
It doesn't "get called", it's a flag so it is added/removed. Like you would do some_var = 1 and later to clear that value some_var = 0.
So what should I use to be able to know player's first landing on ground, if he spawns in the sky?

Basically #1 code was okay, I just was emitting the wrong sound and at the wrong time. Fixed
#2 & #3 the problem is what you told me, I'm using Think and FL_OnGround
#4 works
__________________

Last edited by edon1337; 07-17-2018 at 11:00.
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2018 , 08:53   Re: Glitched Audio
Reply With Quote #6

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.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-17-2018 at 08:55.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 08:56   Re: Glitched Audio
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
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 View Post
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
__________________
edon1337 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2018 , 09:01   Re: Glitched Audio
Reply With Quote #8

#3

@HamThinkPlayer_Pre( id )

Is this forward hooked?

If it is, thats mean the landing sound has file error means its not suitable.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 07-17-2018 at 09:02.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-17-2018 , 09:08   Re: Glitched Audio
Reply With Quote #9

Quote:
Originally Posted by Natsheh View Post
#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 is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 07-17-2018 , 09:13   Re: Glitched Audio
Reply With Quote #10

Quote:
Originally Posted by edon1337 View Post
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.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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