Closed Soskar1 closed 2 months ago
Sound Engine
SoundEngine class is responsible for creating Sound objects. Sound engine has only two methods:
std::shared_ptr<Sound> load_sound(const std::string& path, const std::shared_ptr<SoundFactory>& sound_factory = std::make_shared<LightweightSoundFactory>()); void load_sound(const std::string& path, const std::shared_ptr<Sound>& sound, const std::shared_ptr<SoundFactory>& sound_factory = std::make_shared<LightweightSoundFactory>());
They are doing the same thing (creating Sound objects). In the first case you create new Sound object. In the second case, you can pass the old Sound object to overwrite the data with the new sound.
Sound Factory
For these two methods users can pass a SoundFactory pointer. SoundFactory is an abstract class which specifies how to create a ma_sound (miniaudio sound object). There are only 2 classes that inherits from SoundFactory:
LightweightSoundFactory
class — loads sound data to the memory. Preferable for not too lengthy sounds.StreamSoundFactory
class — stores only 2 seconds of the audio in the memory. Preferable for long sounds, like music.Sound
With this object you can play a sound, that stored in a memory. Also it is possible to configure it using set_volume, set_pan, set_pitch, set_looping methods. There are several bool methods to identify the state of the sound: is_playing, at_end, is_looping.
@Maksasj What do you think about it? Do you like the design? And do we need something more for our sound system?
For me, everything looks nice, good job 🩴
Sound Engine
SoundEngine class is responsible for creating Sound objects. Sound engine has only two methods:
They are doing the same thing (creating Sound objects). In the first case you create new Sound object. In the second case, you can pass the old Sound object to overwrite the data with the new sound.
Sound Factory
For these two methods users can pass a SoundFactory pointer. SoundFactory is an abstract class which specifies how to create a ma_sound (miniaudio sound object). There are only 2 classes that inherits from SoundFactory:
LightweightSoundFactory
class — loads sound data to the memory. Preferable for not too lengthy sounds.StreamSoundFactory
class — stores only 2 seconds of the audio in the memory. Preferable for long sounds, like music.Sound
With this object you can play a sound, that stored in a memory. Also it is possible to configure it using set_volume, set_pan, set_pitch, set_looping methods. There are several bool methods to identify the state of the sound: is_playing, at_end, is_looping.
@Maksasj What do you think about it? Do you like the design? And do we need something more for our sound system?