Minetest 5.9.0-dev
 
Loading...
Searching...
No Matches
SoundSpec Struct Reference

Describes the sound information for playback. More...

#include <sound.h>

+ Collaboration diagram for SoundSpec:

Public Member Functions

 SoundSpec (std::string_view name="", float gain=1.0f, bool loop=false, float fade=0.0f, float pitch=1.0f, float start_time=0.0f)
 
bool exists () const
 
void serializeSimple (std::ostream &os, u16 protocol_version) const
 Serialize a SimpleSoundSpec.
 
void deSerializeSimple (std::istream &is, u16 protocol_version)
 Deserialize a SimpleSoundSpec.
 

Public Attributes

std::string name
 
float gain = 1.0f
 
float fade = 0.0f
 
float pitch = 1.0f
 
float start_time = 0.0f
 
bool loop = false
 
bool use_local_fallback = true
 

Detailed Description

Describes the sound information for playback.

Positional handling is done separately.

SimpleSoundSpec, as used by modding, is a SoundSpec with only name, fain, pitch and fade.

Constructor & Destructor Documentation

◆ SoundSpec()

SoundSpec::SoundSpec ( std::string_view  name = "",
float  gain = 1.0f,
bool  loop = false,
float  fade = 0.0f,
float  pitch = 1.0f,
float  start_time = 0.0f 
)
inline

Member Function Documentation

◆ deSerializeSimple()

void SoundSpec::deSerializeSimple ( std::istream &  is,
u16  protocol_version 
)
inline

Deserialize a SimpleSoundSpec.

References deSerializeString16(), fade, gain, name, pitch, and readF32().

Referenced by ItemDefinition::deSerialize(), and ContentFeatures::deSerialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ exists()

bool SoundSpec::exists ( ) const
inline

References name.

Referenced by SoundMaker::playPlayerStep().

+ Here is the caller graph for this function:

◆ serializeSimple()

void SoundSpec::serializeSimple ( std::ostream &  os,
u16  protocol_version 
) const
inline

Serialize a SimpleSoundSpec.

References fade, gain, name, pitch, serializeString16(), and writeF32().

Referenced by ItemDefinition::serialize(), and ContentFeatures::serialize().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ fade

◆ gain

◆ loop

◆ name

◆ pitch

◆ start_time

◆ use_local_fallback

bool SoundSpec::use_local_fallback = true

The documentation for this struct was generated from the following file: