Commit graph

518 commits

Author SHA1 Message Date
toaster
a399aacb39 Fix voice flipping in encore/stereoreverse 2025-09-15 18:51:02 +01:00
Eidolon
0db1b16061 Adjust some voice chat parameters and behavior
1. If the sample queue is too long, frames will be skipped. This
   prevents bursting with a bunch of voice packets at once.
2. The Opus frame size is doubled to 20ms to reduce UDP overhead.
3. The Opus bitrate is reduced from its default to 10kbps, to prevent
   potential UDP MTU size overruns.
4. The server will ignore Opus frames past a certain limit per tic from
   each player, preventing excessive voice packet propagation
5. Push to talk no longer eats chat typing, and no longer responds while
   chat mode is on.
2025-09-13 15:56:51 -05:00
Antonio Martinez
6337e1d40f Staffsync: more pleasant sound 2025-08-19 22:05:31 -04:00
Eidolon
892a6b8620 Merge public master 2025-08-12 16:49:14 -05:00
Eidolon
255570cfca Dynamically allocate skins
This avoids an issue where the skins array takes up a fixed, but large
amount of memory at runtime. On x86_64 linux, that array is roughly 80
megabytes in memory, most of which is unused when the game is unmodded.
Instead, we treat `skins` as a dynamically resizing array, and it is an
array-of-pointers into separate allocated `skin_t`.

This is based on Lactozilla's skin limit MR for SRB2, but I've rewritten
it because RR has diverged quite a bit.

This was verified to check every access of `skins` by using clangd's
find-all-references function. However, I have only tested plain skins,
not Lua addons, so that could afford some extra checking.
2025-08-12 15:33:00 -05:00
VelocitOni
3e194b1a28 Missed a reversal
I sure hope there's not one of these for allowservervoice too...
2025-07-24 23:12:50 -04:00
VelocitOni
1881208d5f Caught 2 more variables that needed renaming
VoiceChat_OnChange -> VoiceSelfDeafen_OnChange, & voice_chat -> voice_selfdeafen
2025-07-24 23:02:25 -04:00
VelocitOni
29d1dcef2d "Deafen" and "Server Voice Chat" now have new variables
cv_voice_chat -> cv_voice_selfdeafen & cv_voice_servermute -> cv_voice_allowservervoice
2025-07-24 22:54:43 -04:00
VelocitOni
51ac6c250b "Undeafen" (still cv_voice_chat for now), flipped all bools
Flipped all bools on Undeafen since it's worded different
2025-07-24 22:37:51 -04:00
Eidolon
a0ede8101d Use a different voice attentuation distance for teammates
Separate cvar to control this. Double the normal distance by default.
2025-07-15 15:41:22 -05:00
Eidolon
cb7f437e60 Merge public master 2025-02-13 15:48:11 -06:00
Eidolon
a4d304a1f5 Update copyright years to 2025 2025-02-13 15:32:26 -06:00
Eidolon
22b20b5877 Add netgame voice chat
Implemented using libopus for the Opus codec, same as is used in Discord.
This adds the following cvars:

- `voice_chat` On/Off, triggers self-deafen state on server via weaponprefs
- `voice_mode` Activity/PTT
- `voice_selfmute` On/Off, triggers self-mute state on server via weaponprefs
- `voice_inputamp` -30 to 30, scales input by value in decibels
- `voice_activationthreshold` -30 to 0, if any peak in a frame is higher, activates voice
- `voice_loopback` On/Off, plays back local transcoded voice
- `voice_proximity` On/Off, enables proximity effects for server
- `voice_distanceattenuation_distance` distance in fracunits to scale voice volume over
- `voice_distanceattenuation_factor` distance in logarithmic factor to scale voice volume by distance to. e.g. 0.5 for "half as loud" at or above max distance
- `voice_stereopanning_factor` at 1.0, player voices are panned to left or right speaker, scaling to no effect at 0.0
- `voice_concurrentattenuation_factor` the logarithmic factor to attenuate player voices with concurrent speakers
- `voice_concurrentattenuation_min` the minimum concurrent speakers before global concurrent speaker attenuation
- `voice_concurrentattenuation_max` the maximum concurrent speakers for full global concurrent speaker attenuation
- `voice_servermute` whether voice chat is enabled on this server. visible from MS via bitflag
- `voicevolume` local volume of all voice playback

A Voice Options menu is added with a subset of these options, and Server Options has server mute.
2024-12-13 17:12:14 -06:00
Oni
7bb49a9f67 Merge branch 'always-musicdef-author' into 'master'
Always show author on song credit (resolves #1332)

Closes #1332

See merge request KartKrew/Kart!2333
2024-05-02 02:45:10 +00:00
toaster
641e397625 Always show author on song credit, even if it's wider than we'd like
Credit is more important than aesthetic
2024-05-01 14:50:05 +01:00
Eidolon
f9d70530ed Add snd_mixingbuffersize cvar
Allows the user to configure the mixing buffer size to reduce
latency at the cost of higher CPU usage, or vice versa.

This also raises the default buffer size from 1024 to 2048, to
address some underrun problems people have with the current buffer
size.
2024-04-30 23:31:24 -05:00
Eidolon
6a9fd1bf5f Add 'contentidunsafe' property to MUSICDEF
This allows marking music in MUSICDEF as unsafe for Content ID and
other similar content surveillance mechanisms.
2024-04-30 17:44:35 -05:00
toaster
7f6de407f1 Copyright update: Add Kart Krew (2024) in general for high-traffic inherited sourcefiles 2024-04-02 17:42:38 +01:00
toaster
75b4bdd4ea Catch all other instances of sounds which might have played where R_CanShowSkinInDemo is false
- Tally
- Generic S_StartSound call (where sfx_id is in skinsound region)
2024-03-27 04:01:58 +00:00
James R
a4f2712d8a WIP - credits audio/wipe fixes, document this later 2024-03-23 16:21:03 -07:00
toaster
6e46f97847 As promised, Encore (alt)music
- `EncoreMusic` on mapheader
    - Supports up to 3 alt musics, as with every other type
- Do not vape/nightcoreify if provided
- To avoid complicating the Alt Music logic too much, uses "side B" of the same Prison Egg CD
    - That is to say, if there are 2 encore tracks and 3 normal tracks, the second Encore track will only play if you've gotten the CD associated with the second normal track

I haven't actually tested it *with* any Encore music, but I've triplechecked literally everywhere to make sure it didn't break standard play
2024-03-10 21:18:15 +00:00
toaster
57d5e54983 Stereo Mode: Fix multi-Track musicdefs not having their first part loop under non-Seq conditions
Had to introduce a hacky Music_SetFadeOut func, but I didn't want to rework this section of code/menu too heavily for how little time we have left
2024-03-10 21:18:14 +00:00
toaster
f3af88200f S_PopulateSoundTestSequence: Show Tutorial maps before Cups
Previously after Cups, as part of Lost & Found tracks
2024-03-10 21:17:20 +00:00
Sally Coolatta
9b93f56111 Add pre-Podium intermission music 2024-03-10 14:08:59 -04:00
Eidolon
6dc6bb63a7 Play TIMENT for mode attack intermission 2024-02-21 19:13:14 -06:00
James R
4ee00d4333 Pass const pointer to all netxcmd handlers
Ensure buffer data is read-only and not modified by
handler
2024-02-11 05:42:07 -08:00
James R
d7e0a4d01a Add S_LoadSongCredit/S_UnloadSongCredit, refactor cursongcredit
- cursongcredit behaves the same as before
- Always compose song credit string
- g_realsongcredit always stores the song credit for the
  current music, even if no song credit is displayed on
  the HUD
2024-02-09 18:13:35 -08:00
AJ Martinez
4efaed3690 Fix sound falloff calculation overflow 2024-02-06 06:02:17 -07:00
Sal
3958c15dfe New Credits 2024-01-28 23:31:30 +00:00
James R
f12d4c275e music, sounds: toggle based on cvar's actual value 2024-01-12 17:32:25 -08:00
Eidolon
448b54c41c Make master volume an independent gain control
Master volume should control after-mixing gain; the idea is the mixed
output of sfx and music's amplitude should never exceed
`cv_mastervolume`. Setting each submixer's gain independently will
still allow the master mixer to exceed that preferred volume, which was
the main issue with the SDL_Mixer backend. So, instead we use a separate
gain control that is applied after everything is mixed.
2024-01-12 19:06:19 -06:00
James R
09fd14df98 musicvolume, soundvolume: do not unmute during config loading
- The order that cvars appear in the config is messy, so
  music appears before musicvolume
- When musicvolume is changed, music is forced to On,
  which would ignore the config value
2024-01-11 13:53:52 -08:00
Oni
df5c866573 Merge branch 'map-access-flingerdinger' into 'master'
Stronger Course progression restriction

Closes #832, #859, and #839

See merge request KartKrew/Kart!1795
2024-01-09 08:11:12 +00:00
toaster
83366b6507 More universal Course restriction based on progression
All courses are restricted in Match Race/Time Attack/Online if not visited in GP UNLESS:
- It is the first Race Course of a Cup
- Course has "NoVisitNeeded = True`
    - The Controls Tutorial and Test Run are the only two stages that will need this

The above replaces:
- A lot of restricted courses having to be marked with `FinishNeeded = True`
    - Hidden Palace
    - Sealed Stars 1-14
        - Once Special Mode is unlocked, it will now be possible to practice Sealed Stars before rematching them in GP
- Almost all Tutorial-specific behaviour, since it was heinously hacky

HOWEVER, `FinishNeeded = True` was left in specifically for future releases, and I reserve the right to use it on Adventure Example again before launch.
2024-01-07 13:57:05 +00:00
James R
b7c9c92749 Music_Seek: argument in milliseconds instead of tics 2024-01-05 15:56:23 -08:00
James R
076cea7047 Stereo Mode: stop Stereo after unlooped, unsequenced track ends 2023-12-29 07:30:54 -08:00
James R
95f4768e46 Stereo Mode: fix unsequenced track fading at the end
- Starts both stereo and stereo_fade in tandem
- Suspends the tune which is not to be heard
- Swaps suspension when toggling SEQ
- Special handling so fade-out can not be interrupted by
  switching off SEQ
2023-12-29 04:54:55 -08:00
James R
64aaf02b8a soundtest: refactor to track tune with integer instead of string 2023-12-29 04:30:54 -08:00
James R
a2abbdefde Master volume: alter both music/sound volume without changing balance 2023-12-23 13:38:15 -08:00
James R
79012d00e8 Sound options: merge playmusicifunfocused/playsoundifunfocused into one cvar 2023-12-23 13:17:04 -08:00
James R
0c251ee643 Sound options: add master volume slider
- Updates music and sound volumes simultaneously
- Changing music/sound volumes separately sets master
  volume to highest of the two
- Visually distinct slider
2023-12-23 13:17:04 -08:00
James R
375d87255e Re-enable music/sounds when volume cvars are changed 2023-12-23 13:17:04 -08:00
James R
2d450b05f8 TuneManager: clear current song if music is disabled, so music can resume later 2023-12-23 13:17:03 -08:00
SteelT
36f6c89ce1 Remove code that is behind SURROUND define 2023-12-19 13:36:49 -05:00
James R
d97fece311 S_ShowMusicCredit: use at most 3/4 screen width 2023-12-04 20:40:18 -08:00
James R
e1f2ed11c7 S_ShowMusicCredit: subtract indentation amount from available screen space 2023-12-03 17:06:01 -08:00
James R
764a692a5e P_IsLocalPlayer, P_IsMachineLocalPlayer, P_IsDisplayPlayer: let player pointer be const 2023-11-25 04:51:13 -08:00
James R
063d7946a3 mobj.hpp: add srb2::Mobj class, abstraction around mobj_t
API is still a work in progress and is not yet
comprehensive.
2023-11-22 19:04:30 -08:00
James R
61cad641bb Invincible player punts hazardous/solid things, unless MF_ELEMENTAL
If player is in one of these states:

- Invincibility
- Grow (K_IsBigger)
- Flame Shield dash
- Over 200% speed

And the other object:

- Does not have MF_DONTPUNT

Then, touching a solid object:

- Punts the object, unless the object has MF_ELEMENTAL
- Fizzles the object, if the object has MF_ELEMENTAL

Or, when an object damages the player:

- That object is punted, unless it has MF_ELEMENTAL
- The object fizzles, if it has MF_ELEMENTAL

Punting means:

- A copy of the object is made
- Both the player and copy receive 5 tics of hitlag
- The copy is thrust away from the player at a minimum of
  60 FU, or 2x either the player's or object's momentum,
  whichever is ultimately greater
- The copy despawns after 2 seconds
- The copy flickers constantly, while thrust away

Fizzling means:

- The object disappears completely
- A puff of smoke is spawned in place of the object
- No hitlag is applied to the player

Both punting and fizzling:

- Hide the original object (intangible and invisible)
- The original object reppears after 30 seconds
- For 2 seconds before reappearing, the object flickers
  back in, but is still intangible
2023-11-13 22:18:35 -08:00
AJ Martinez
e3fe3ed54a Handle sound falloff for exiting player sounds 2023-11-10 17:08:39 -07:00