-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Sound refactor and improvements #12764
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
I hope this gets merged. I recognized several bugs from the description that I was annoyed at in the game without realizing it. |
Does this introduce any significant delay in sound playback? |
Yeah, sounds shouldn't be lazy loaded. Only music should be. Mods should then choose between music and sound based on what kind of latency then can tolerate However, I suspect they mean lazy loading from client cache on disk, rather than over the network, which isn't as bad |
|
I think Minetest should automatically decide whether to pre-load sounds, quoting #10603 (comment):
other feedback as already written on IRC:
|
(The loading I was referring to was just the decoding from ogg vorbis data (from ram, or sound-pack; not from network) to pcm data, and giving that data to OpenAL.) I'll split the PR and make it more reviewable. |
c5b592b to
1dc0a32
Compare
|
I consider this PR ready for review now. It would make sense to review and merge the dependencies first though. |
|
Rebased. |
|
Rebased. |
|
Rebased. |
|
I hope this gets merged soon. One of the biggest issues that the minetest engine has, is that playing soundtracks is very taxing for some reason. |
|
Rebased (+ 2 commits). (The now missing |
sfan5
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose the "just merge it and see" approach is best for this
|
Looked a last time over it, and removed some trivial changes left over from a rebase. Should be fine. |
PR is based on:
Changes
This PR includes the following changes (list may miss minor changes that I forgot):
sound.1.ogg,sound.2.ogg, ...).(fixes Music / large sound files significantly slow down game startup #10603, improves Slow loading times #10316)
(makes Game-provided menu music #8596/Add support for music #7867 possible)
time_offsetstart_timesound param (offset in seconds into file).(fixes Start a sound at a specific timestamp #11865; will be needed at some point anyways for players entering max_hear_distance)
(also fixes Fade and sound playback with gain <= 0 delete the handle (for mute) #4256)
sound_openal_internal.habout sound-space) (test with hrtf)Edit: Server sound change moved out to Put server sound handles into userdata #12780.
Fix: Shader animation timer is also paused. (Has nothing to do with sounds, but I was already at it.)Edit: Moved out to Pause shader animation timer in singleplayer pause menu #12766.
errorstreamwarningstream for positional stereo sounds,and don't play.(fixes Add warning when stereo sounds are loaded #6622)
(fixes Audio: Error opening file for decoding #10979)
(fixes Incomplete Documentation of 'params' sound parameter table, used by minetest.sound_play() #11414)
(fixes minetest.sound_fade [fading in] doesn't work with positional sounds. #6748)
stepis scaled correctly (used to be too slow by a factor of 3). And you can fade to gain>1/3.)Doppler effect.Edit: Disabled. It should be server-controlled.(see: Add Doppler effect #9172)
Fix/Enhancement: Footstep sounds of objects are played at feet (found via collisionbox). (Velocity is still 0, btw..)Edit: Moved out to [nosquash] Bigfoot and footstep at feet #12768.
SimpleSoundSpecstruct was renamed toSoundSpec, because it's not simple, and to differentiate from moddingSimpleSoundSpec.OnDemandSoundFetcherwas renamed toSoundLocalFallbackPathsGiver, as that describes better what it does.Review help
client/sound*files contain the most real changes. Everything else is essentially just adjusted to the new interface.You can compare behaviour of
sound_openal_internal.h/cppwith the oldsound_openal.cpp, but idk if it helps.Notice that the new interface handles client sound handles differently.
client/client.h/cppcontains two interesting changes: It creates sound groups based on base names, andm_sounds_client_to_servernow owns client-handles.game.cpp:GameOnDemandSoundFetcherwas moved toclient/sound.cpp. Also, sounds are paused here.guiEngine.h/cpp: Uses no more raw ptrs (creates some code-change-noise, but not really much).MenuMusicFetcheris simplified, by using base-class functions.GUIEngine::playSoundis removed, it's only used by mainmenu scripting.clientpackethandler.cpp: Uses ids. Andtime_offsetis added.l_sound.h/cpp: Is nowl_mainmenu_sound.h/cpp.SoundSpecrenames, and it uses the new id system.server.cpp: Sendstime_offset.src/sound.h: Theuse_local_fallbackis currently unused. But it's passed to the sound manager and should be functional, if the sound wasn't played before.SoundSpec) and smart-ptrs.To do
This PR is a Ready for Review.
How to test
/set sound_doppler_factorEdit: Doppler effect is disabled, and this setting does not exist.$ alsoft-config-> HRTF -> HRTF mode: Always on.