From 11a5ebe38a83383970425baf53d4595ae56efe70 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 25 Feb 2010 22:24:25 +0000 Subject: looped sound support for fx_sound model tags --- src/client/soundext.h | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) (limited to 'src/client/soundext.h') diff --git a/src/client/soundext.h b/src/client/soundext.h index b0fc17a..9991b69 100644 --- a/src/client/soundext.h +++ b/src/client/soundext.h @@ -10,6 +10,9 @@ #include "core/extension.h" #include "core/cvar.h" +#include +#include + namespace client { @@ -17,6 +20,47 @@ extern core::Cvar *snd_engines; extern core::Cvar *snd_doppler; extern core::Cvar *snd_volume; +/// a sound playing +class Sound { +public: + Sound(); + Sound(const std::string & name); + + inline size_t buffer() const { + return sound_buffer; + } + + inline size_t source() const { + return sound_source; + } + + inline math::Vector3f const & location() { + return sound_location; + } + + inline math::Vector3f & get_location() { + return sound_location; + } + + inline void set_location(const math::Vector3f & location) { + sound_location.assign(location); + } + + inline void set_source(size_t source) { + sound_source = source; + } + + inline void set_buffer(size_t buffer) { + sound_buffer = buffer; + } + +private: + size_t sound_buffer; + size_t sound_source; + + math::Vector3f sound_location; +}; + /// the sound extension of an entity class SoundExt : public core::Extension { @@ -26,7 +70,9 @@ public: virtual void frame(float elapsed); + typedef std::list Sounds; private: + void clear(); /// index of the audio buffer containing the thruster sound loop @@ -46,6 +92,8 @@ private: size_t state_engineeventbuffer; /// index of the audio source used to play engine sound events size_t state_engineeventsource; + + Sounds state_soundlist; }; /// render listener sound -- cgit v1.2.3