mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
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.
This commit is contained in:
parent
0b41533763
commit
a463620edb
20 changed files with 140 additions and 188 deletions
21
src/server.h
21
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);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue