diff options
| author | SmallJoker <SmallJoker@users.noreply.github.com> | 2022-06-20 21:56:12 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-06-20 21:56:12 +0200 |
| commit | a463620edbe57071a7101297d33226507567ca73 (patch) | |
| tree | 342d433ca55f4e3d1826508c303f2e6229d503f1 /src/server.h | |
| parent | 0b41533763bc9f104a2da2e4191f4654b8d8dab4 (diff) | |
| download | minetest-a463620edbe57071a7101297d33226507567ca73.tar.xz | |
Re-order sound-related code (#12382)
Dropped ServerSoundParams -> moved to ServerPlayingSound. This gets rid of the duplicated
'fade' and 'pitch' values on server-side where only one was used anyway.
SimpleSoundSpec is the basic sound without positional information, hence 'loop' is included.
Recursively added PROTOCOL_VERSION to most functions to reduce the versioning mess in the
future. Per-type version numbers are kept for now as a safety rope in a special case.
Diffstat (limited to 'src/server.h')
| -rw-r--r-- | src/server.h | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/server.h b/src/server.h index 79db913aa..00b6f897d 100644 --- a/src/server.h +++ b/src/server.h @@ -96,30 +96,26 @@ struct MediaInfo } }; -struct ServerSoundParams +// Combines the pure sound (SimpleSoundSpec) with positional information +struct ServerPlayingSound { enum Type { SSP_LOCAL, SSP_POSITIONAL, SSP_OBJECT } type = SSP_LOCAL; - float gain = 1.0f; - float fade = 0.0f; - float pitch = 1.0f; - bool loop = false; + + float gain = 1.0f; // for amplification of the base sound float max_hear_distance = 32 * BS; v3f pos; u16 object = 0; - std::string to_player = ""; - std::string exclude_player = ""; + std::string to_player; + std::string exclude_player; v3f getPos(ServerEnvironment *env, bool *pos_exists) const; -}; -struct ServerPlayingSound -{ - ServerSoundParams params; SimpleSoundSpec spec; + std::unordered_set<session_t> clients; // peer ids }; @@ -236,8 +232,7 @@ public: // Returns -1 if failed, sound handle on success // Envlock - s32 playSound(const SimpleSoundSpec &spec, const ServerSoundParams ¶ms, - bool ephemeral=false); + s32 playSound(ServerPlayingSound ¶ms, bool ephemeral=false); void stopSound(s32 handle); void fadeSound(s32 handle, float step, float gain); |
