mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-28 15:47:15 +01:00
TTS pitch now affects emote sounds (#87275)
## About The Pull Request Closes #87274 If TTS is enabled and supports vocal pitch, certain emotes will have a far smaller frequency range but will become affected by your chosen TTS pitch. Frequency equation is non-linear as pitch scales from -12 to 12 ## Why It's Good For The Game Makes vocal emotes a bit more immersive as now they'll fit your character's tone. ## Changelog 🆑 add: TTS pitch now affects emote sounds /🆑
This commit is contained in:
@@ -205,5 +205,10 @@ GLOBAL_LIST_INIT(announcer_keys, list(
|
||||
#define SFX_HALLUCINATION_I_M_HERE "hallucination_i_m_here"
|
||||
#define SFX_VOID_DEFLECT "void_deflect"
|
||||
#define SFX_LOW_HISS "low_hiss"
|
||||
|
||||
#define SFX_INDUSTRIAL_SCAN "industrial_scan"
|
||||
|
||||
// Default is 45kbps
|
||||
#define MIN_EMOTE_PITCH 42000
|
||||
#define MAX_EMOTE_PITCH 50000
|
||||
// ~0.6 - 1.4 at 0.12
|
||||
#define EMOTE_TTS_PITCH_MULTIPLIER 0.12
|
||||
|
||||
@@ -52,6 +52,8 @@
|
||||
var/sound
|
||||
/// Does this emote vary in pitch?
|
||||
var/vary = FALSE
|
||||
/// If this emote's sound is affected by TTS pitch
|
||||
var/affected_by_pitch = TRUE
|
||||
/// Can only code call this event instead of the player.
|
||||
var/only_forced_audio = FALSE
|
||||
/// The cooldown between the uses of the emote.
|
||||
@@ -105,7 +107,10 @@
|
||||
if(tmp_sound && should_play_sound(user, intentional) && TIMER_COOLDOWN_FINISHED(user, "general_emote_audio_cooldown") && TIMER_COOLDOWN_FINISHED(user, type))
|
||||
TIMER_COOLDOWN_START(user, type, specific_emote_audio_cooldown)
|
||||
TIMER_COOLDOWN_START(user, "general_emote_audio_cooldown", general_emote_audio_cooldown)
|
||||
playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore)
|
||||
var/frequency = null
|
||||
if (affected_by_pitch && SStts.tts_enabled && SStts.pitch_enabled)
|
||||
frequency = rand(MIN_EMOTE_PITCH, MAX_EMOTE_PITCH) * (1 + sqrt(abs(user.pitch)) * SIGN(user.pitch) * EMOTE_TTS_PITCH_MULTIPLIER)
|
||||
playsound(source = user,soundin = tmp_sound,vol = 50, vary = vary, ignore_walls = sound_wall_ignore, frequency = frequency)
|
||||
|
||||
var/is_important = emote_type & EMOTE_IMPORTANT
|
||||
var/is_visual = emote_type & EMOTE_VISIBLE
|
||||
|
||||
@@ -150,6 +150,7 @@
|
||||
message = "jumps!"
|
||||
// Allows ghosts to jump
|
||||
mob_type_ignore_stat_typecache = list(/mob/dead/observer)
|
||||
affected_by_pitch = FALSE
|
||||
|
||||
/datum/emote/jump/run_emote(mob/user, params, type_override, intentional)
|
||||
. = ..()
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
hands_use_check = TRUE
|
||||
emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE
|
||||
vary = TRUE
|
||||
affected_by_pitch = FALSE
|
||||
|
||||
/datum/emote/living/carbon/clap/get_sound(mob/living/user)
|
||||
if(!user.get_bodypart(BODY_ZONE_L_ARM) || !user.get_bodypart(BODY_ZONE_R_ARM))
|
||||
@@ -175,6 +176,7 @@
|
||||
message_param = "snaps their fingers at %t."
|
||||
emote_type = EMOTE_AUDIBLE | EMOTE_VISIBLE
|
||||
hands_use_check = TRUE
|
||||
affected_by_pitch = FALSE
|
||||
|
||||
/datum/emote/living/carbon/snap/get_sound(mob/living/user)
|
||||
if(ishuman(user))
|
||||
|
||||
Reference in New Issue
Block a user