Defining sound properties
Sound, much like any other medium, has a few different properties of interest that are up for tweaking. The effects we're going to be playing in our game don't just have varying sources, but also different volumes, pitch values, the distance a sound can cover, and a factor that represents how fast that sound fades. How we're going to store this information is defined in SoundProps.h
:
struct SoundProps{ SoundProps(const std::string& l_name): m_audioName(l_name), m_volume(100), m_pitch(1.f), m_minDistance(10.f), m_attenuation(10.f){} std::string m_audioName; float m_volume; float m_pitch; float m_minDistance; float m_attenuation; };
In addition to the qualities described earlier, it is also necessary to store the identifier of the audio file that a sound is going to be using. A typical sound file for our application would look something like footstep.sound
:
Audio Footstep Volume 25 Pitch 1.0 Distance 150 Attenuation 2
With this...