AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] EngineSound (https://forums.alliedmods.net/showthread.php?t=56364)

Knagg0 06-12-2007 11:56

[EXTENSION] EngineSound
 
2 Attachment(s)
This extension allows you to call some functions of the enginesound interface

Install:
1. Extract 'enginesound.ext.dll' and 'enginesound.ext.so' to the 'addons/sourcemod/extensions' folder.
2. Extract 'enginesound.inc' to the 'addons/sourcemod/scripting/include' folder.

Natives:
Code:

/**
 * Prefetchs a given sound.
 *
 * @param sample                Name of the sound.
 * @noreturn
 */

native PrefetchSound(const String:sample[]);

/**
 * Gets the duration of a given sound.
 *
 * @param sample                Name of the sound.
 * @return                        The duration.
 */

native Float:GetSoundDuration(const String:sample[]);

/**
 * Emit a given sound to one/all client(s).
 *
 * @param client                Index of the client to 'emit' the sound to (0 = all).
 * @param entity                Index of the entity to 'emit' the sound from.
 * @param channel                Channel of the sound.
 * @param sample                Name of the sound.
 * @param volume                Volume of the sound.
 * @param attenuation                Attenuation of the sound.
 * @param flags                        Flags of the sound.
 * @param pitch                        Pitch of the sound.
 * @param origin                Origin of the sound ({0.0,0.0,0.0} = ignore)
 * @param direction                Direction of the sound ({0.0,0.0,0.0} = ignore)
 * @param updateposition        Update the position of the sound (e.g. when the sound is attached to a player and he moves)
 * @param soundtime                How long the sound should play.
 * @param speakerentity
 * @noreturn
 */

native EmitSound(client, entity, channel, const String:sample[], Float:volume, Float:attenuation, flags=0, pitch=PITCH_NORM, Float:origin[3]={0.0,0.0,0.0}, Float:direction[3]={0.0,0.0,0.0}, bool:updateposition=true, Float:soundtime=0.0, speakerentity=-1);

/**
 * Emit a given sound to one/all client(s).
 * Same as EmitSound but it uses the soundlevel instead of attenuation.
 *
 * @param client                Index of the client to 'emit' the sound to (0 = all).
 * @param entity                Index of the entity to 'emit' the sound from.
 * @param channel                Channel of the sound.
 * @param sample                Name of the sound.
 * @param volume                Volume of the sound.
 * @param level                        Soundlevel of the sound.
 * @param flags                        Flags of the sound.
 * @param pitch                        Pitch of the sound.
 * @param origin                Origin of the sound ({0.0,0.0,0.0} = ignore)
 * @param direction                Direction of the sound ({0.0,0.0,0.0} = ignore)
 * @param updateposition        Update the position of the sound (e.g. when the sound is attached to a player and he moves)
 * @param soundtime                How long the sound should play.
 * @param speakerentity
 * @noreturn
 */

native EmitSoundL(client, entity, channel, const String:sample[], Float:volume, soundlevel_t:level, flags=0, pitch=PITCH_NORM, Float:origin[3]={0.0,0.0,0.0}, Float:direction[3]={0.0,0.0,0.0}, bool:updateposition=true, Float:soundtime=0.0, speakerentity=-1);

/**
 * I don't know ^^
 * "Emit a sentence and also a close caption token for the sentence as appropriate."
 *
 * @param client                Index of the client to 'emit' the sound to (0 = all).
 * @param entity                Index of the entity to 'emit' the sound from.
 * @param channel                Channel of the sound.
 * @param sentence                Sentence of the sound.
 * @param volume                Volume of the sound.
 * @param level                        Soundlevel of the sound.
 * @param flags                        Flags of the sound.
 * @param pitch                        Pitch of the sound.
 * @param origin                Origin of the sound ({0.0,0.0,0.0} = ignore)
 * @param direction                Direction of the sound ({0.0,0.0,0.0} = ignore)
 * @param updateposition        Update the position of the sound (e.g. when the sound is attached to a player and he moves)
 * @param soundtime                How long the sound should play.
 * @param speakerentity
 * @noreturn
 */

native EmitSentenceByIndex(client, entity, channel, sentence, Float:volume, soundlevel_t:level, flags=0, pitch=PITCH_NORM, Float:origin[3]={0.0,0.0,0.0}, Float:direction[3]={0.0,0.0,0.0}, bool:updateposition=true, Float:soundtime=0.0, speakerentity=-1);

/**
 * Stops an 'emited' sound of a given entity.
 *
 * @param entity                Index of the entity.
 * @param channel                Channel of the sound.
 * @param sample                Name of the sound.
 * @noreturn
 */

native StopSound(entity, channel, const String:sample[]);

/**
 * Emit an 'ambient' sound that isn't spatialized.
 *
 * @param sample                Name of the sound.
 * @param volume                Volume of the sound.
 * @param pitch                        Pitch of the sound.
 * @param flags                        Flags of the sound.
 * @param soundtime                How long the sound should play.
 * @noreturn
 */

native EmitAmbientSound(const String:sample[], Float:volume, pitch=PITCH_NORM, flags=0, Float:soundtime=0.0);

Changelog:
Quote:

1.0.0.0 (5/12/07)
  • First release


FlyingMongoose 06-12-2007 12:09

Re: [EXTENSION] EngineSound
 
neat, good work, I'm using tempent's emitsound right now tho and it works for me....

Olly 06-12-2007 13:25

Re: [EXTENSION] EngineSound
 
hehe nice.. I was playing around with EmitSound using a sigscan, but nothing happened hehe, i think i used a bad channel or something though ><

1695 07-13-2007 07:59

Re: [EXTENSION] EngineSound
 
Does it still usefull since sound extention is included in sourcemod build ?

Knagg0 07-13-2007 08:27

Re: [EXTENSION] EngineSound
 
Quote:

Originally Posted by 1695 (Post 502833)
Does it still usefull since sound extention is included in sourcemod build ?

Yes, for plugins that still use this extension.
But they should be updated and use the build in natives.

.Dare Devil. 02-11-2012 09:02

Re: [EXTENSION] EngineSound
 
thakns, its very useful for me.

I have question about it.
I dont understand 2 params.

PHP Code:

 * @param origin        Origin of the sound ({0.0,0.0,0.0} = ignore)
 * @
param direction        Direction of the sound ({0.0,0.0,0.0} = ignore

If origin is 0.0,0.0,0.0 and i call this func player index, will this sound follow the player?
Or i need to check player origin all the time?


param direction question.
------------------------

What is it, and what it do? :)

naris 02-15-2012 20:04

Re: [EXTENSION] EngineSound
 
Quote:

Originally Posted by .Dare Devil. (Post 1648343)
thakns, its very useful for me.

Actually, no it isn't.

You should not use this EVER.

Use the built in SourceMod natives instead!

http://docs.sourcemod.net/api/index....ad=file&id=34&

Powerlord 02-16-2012 10:08

Re: [EXTENSION] EngineSound
 
Quote:

Originally Posted by naris (Post 1651288)
Actually, no it isn't.

You should not use this EVER.

Use the built in SourceMod natives instead!

http://docs.sourcemod.net/api/index....ad=file&id=34&

Except for GetSoundDuration, for which Sound Info Library's GetSoundLengthFloat can be used.

naris 02-20-2012 22:52

Re: [EXTENSION] EngineSound
 
Quote:

Originally Posted by Powerlord (Post 1651561)
Except for GetSoundDuration, for which Sound Info Library's GetSoundLengthFloat can be used.

The SourceMod natives also includes GetSoundDuration().
However, GetSoundDuration() is deprecated in the SourceMod version because it doesn't work. The one in this extension won't work either because they both call the same underlaying, broken, valve method...

So yeah, you are much better off using the Sound Info Library which, among other things, actually works.


All times are GMT -4. The time now is 09:10.

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