Simulant  21.09-46
A portable game engine for Windows, OSX, Linux, Dreamcast, and PSP
null_sound_driver.h
1 #pragma once
2 
3 #include <map>
4 
5 #include "../sound_driver.h"
6 
7 namespace smlt {
8 
9 class NullSoundDriver : public SoundDriver {
10 public:
11  NullSoundDriver(Window* window):
12  SoundDriver(window) {}
13 
14  virtual ~NullSoundDriver();
15 
16  bool startup() override;
17  void shutdown() override;
18 
19  std::vector<AudioSourceID> generate_sources(uint32_t count) override;
20  std::vector<AudioBufferID> generate_buffers(uint32_t count) override;
21 
22  void destroy_buffers(const std::vector<AudioBufferID>& buffers) override;
23  void destroy_sources(const std::vector<AudioSourceID>& sources) override;
24 
25  void play_source(AudioSourceID source_id) override;
26  void stop_source(AudioSourceID source_id) override;
27 
28  void queue_buffers_to_source(AudioSourceID source, uint32_t count, const std::vector<AudioBufferID>& buffers) override;
29  std::vector<AudioBufferID> unqueue_buffers_from_source(AudioSourceID source, uint32_t count) override;
30  void upload_buffer_data(AudioBufferID buffer, AudioDataFormat format, const uint8_t* data, std::size_t bytes, uint32_t frequency) override;
31 
32  AudioSourceState source_state(AudioSourceID source) override;
33  int32_t source_buffers_processed_count(AudioSourceID source) const override;
34 
35  void set_source_as_ambient(AudioSourceID) override {}
36  void set_listener_properties(const Vec3&, const Quaternion&, const Vec3&) override {}
37  void set_source_properties(AudioSourceID, const Vec3&, const Vec3&) override {}
38 
39  void set_source_reference_distance(AudioSourceID id, float dist) override;
40  void set_source_gain(AudioSourceID id, RangeValue<0, 1> value) override;
41  void set_source_pitch(AudioSourceID id, RangeValue<0, 1> value) override;
42 private:
43  AudioSourceID source_counter_ = 0;
44  AudioBufferID buffer_counter_ = 0;
45 
46  std::map<AudioSourceID, bool> source_playing_;
47 };
48 
49 }
smlt::Vec3
Definition: vec3.h:23
smlt::Quaternion
Definition: quaternion.h:24
smlt
Definition: animation.cpp:25
smlt::NullSoundDriver
Definition: null_sound_driver.h:9
smlt::Window
Definition: window.h:90
smlt::RangeValue
Definition: range_value.h:24
smlt::SoundDriver
Definition: sound_driver.h:70