Skip to content

Commit

Permalink
tts radio sound mixer (tgstation#113)
Browse files Browse the repository at this point in the history
## About The Pull Request
Теперь разделена громкость звука между TTS рации и TTS локальным

# Проверьте на локалке с доступным TTS

## Changelog
:cl:
add: Теперь разделена громкость звука между TTS рации и TTS локальным
/:cl:
  • Loading branch information
larentoun authored Apr 18, 2024
1 parent 6352e68 commit 76375be
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
11 changes: 11 additions & 0 deletions modular_bandastation/tts/code/tts_preferences.dm
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,14 @@

/datum/preference/text/tts_seed/apply_to_human(mob/living/carbon/human/target, value)
target.AddComponent(/datum/component/tts_component, SStts220.tts_seeds[value])

/datum/preference/numeric/sound_tts_volume_radio
category = PREFERENCE_CATEGORY_GAME_PREFERENCES
savefile_key = "sound_tts_volume_radio"
savefile_identifier = PREFERENCE_PLAYER

minimum = 0
maximum = 100

/datum/preference/numeric/sound_tts_volume_radio/create_default_value()
return maximum
9 changes: 7 additions & 2 deletions modular_bandastation/tts/code/tts_subsystem.dm
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,12 @@ SUBSYSTEM_DEF(tts220)
queue_sound_effect_processing(pure_filename, effect, filename2play, output_tts_cb)

/datum/controller/subsystem/tts220/proc/output_tts(atom/speaker, mob/listener, filename2play, is_local = TRUE, preSFX = null, postSFX = null)
var/volume = listener?.client?.prefs?.read_preference(/datum/preference/numeric/sound_tts_volume)
var/volume
if(findtext(filename2play, "radio"))
volume = listener?.client?.prefs?.read_preference(/datum/preference/numeric/sound_tts_volume_radio)
else
volume = listener?.client?.prefs?.read_preference(/datum/preference/numeric/sound_tts_volume)

if(!volume)
return

Expand All @@ -362,7 +367,7 @@ SUBSYSTEM_DEF(tts220)
output.status = SOUND_STREAM
if(!is_local || isnull(speaker))
output.wait = TRUE
output.volume = volume * 0.75 // non-local is slightly less loud // TODO220: Make volume different
output.volume = volume
output.environment = SOUND_ENVIRONMENT_NONE

if(output.volume <= 0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Feature, FeatureSliderInput } from '../base';

// BANDASTATION SOUND PREFS

export const sound_tts_volume_radio: Feature<number> = {
name: 'TTS - громкость рации',
category: 'ЗВУК',
description: 'Громкость text-to-speech, когда используется рация.',
component: FeatureSliderInput,
};

0 comments on commit 76375be

Please sign in to comment.