roflmuffin / CounterStrikeSharp

CounterStrikeSharp allows you to write server plugins in C# for Counter-Strike 2/Source2/CS2
https://docs.cssharp.dev
Other
741 stars 111 forks source link

Add EmitSound #386

Closed Yarukon closed 3 months ago

Yarukon commented 5 months ago

Allows to play sound on entity.

Yarukon commented 5 months ago

closing for now

B3none commented 5 months ago

Awesome! This will be a nice addition to the project 👍

chenbuyi2019 commented 5 months ago

test good on Windows:

ent.EmitSound("jungle_male.afm1_thankful_01");

it has to be a sound event name, not a vsnd filename. and which means SoundLevel, volume etc params are not working, since they are defined in sound events already. Filter is working good too.

roflmuffin commented 5 months ago

Do you think we should just omit the volume, pitch etc. if they are not actually working at the moment anyway? And this can be added in a later API once we have a way to modify the volume of an existing sound, similar to this implementation: https://gist.github.com/Metapyziks/88745748d90f8955e60b9831a7214cd2

chenbuyi2019 commented 5 months ago

Do you think we should just omit the volume, pitch etc. if they are not actually working at the moment anyway? And this can be added in a later API once we have a way to modify the volume of an existing sound, similar to this implementation: https://gist.github.com/Metapyziks/88745748d90f8955e60b9831a7214cd2

You're right, we should have a better way to emit sound with real volume changing. Sometimes, re-editing sound event file is really a mess.

Metapyziks commented 5 months ago

I've stalled a bit on being able to change sound parameters after emitting, I can't get it to work with custom sound events using MultiAddonManager.

Dliix66 commented 4 months ago

For now the only way to manage volume is to use the Hammer config when creating the map with the sounds. I remember somebody posted some code to update the volume but it was pretty unstable IIRC.

I'd say this is a cool feature to have and we can update it once we found a way for the volume ;)

Yarukon commented 4 months ago

draft this fn

Dliix66 commented 4 months ago

draft this fn

Is this working on the latest update? I’ll give it a try tonight

Yarukon commented 3 months ago

draft this fn

Is this working on the latest update? I’ll give it a try tonight

works on windows, you can try on linux if you have linux enviroment but since this might need some extra works so i draft this for now

Yarukon commented 3 months ago

closing