16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 03:29:19 +02:00

Merge commit 'd8170c932b448ba6888e702746b5ae22632062d8' into sim

This commit is contained in:
milek7
2022-01-05 01:02:56 +01:00
76 changed files with 9277 additions and 5749 deletions

18
sound.h
View File

@@ -28,7 +28,7 @@ enum class sound_type {
enum sound_parameters {
range = 0x1,
amplitude = 0x2,
frequency = 0x4
frequency = 0x4,
};
enum sound_flags {
@@ -116,6 +116,11 @@ public:
start( float const Offset );
float const &
start() const;
// custom soundproofing setter/getter
auto &
soundproofing();
auto const &
soundproofing() const;
// returns true if there isn't any sound buffer associated with the object, false otherwise
bool
empty() const;
@@ -125,6 +130,12 @@ public:
// returns true if the source uses sample table
bool
is_combined() const;
// returns true if specified buffer is one of the optional bookends
bool
is_bookend( audio::buffer_handle const Buffer ) const;
// returns true if the source has optional bookends
bool
has_bookends() const;
// returns location of the sound source in simulation region space
glm::dvec3 const
location() const;
@@ -231,6 +242,7 @@ private:
std::vector<soundchunk_pair> m_soundchunks; // table of samples activated when associated variable is within certain range
bool m_soundchunksempty { true }; // helper, cached check whether sample table is linked with any actual samples
int m_crossfaderange {}; // range of transition from one chunk to another
std::optional< std::array<float, 6> > m_soundproofing; // custom soundproofing parameters
};
// owner setter/getter
@@ -245,6 +257,10 @@ inline std::string const & sound_source::name() const { return m_name; }
// playback starting point shift setter/getter
inline void sound_source::start( float const Offset ) { m_startoffset = Offset; }
inline float const & sound_source::start() const { return m_startoffset; }
// custom soundproofing setter/getter
inline auto & sound_source::soundproofing() { return m_soundproofing; }
inline auto const & sound_source::soundproofing() const { return m_soundproofing; }
// collection of sound sources present in the scene
class sound_table : public basic_table<sound_source> {