sound_world_null.cpp 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /*
  2. * Copyright (c) 2012-2015 Daniele Bartolini and individual contributors.
  3. * License: https://github.com/taylor001/crown/blob/master/LICENSE
  4. */
  5. #include "config.h"
  6. #if CROWN_SOUND_NULL
  7. #include "sound_world.h"
  8. #include "audio.h"
  9. #include "memory.h"
  10. namespace crown
  11. {
  12. namespace audio_globals
  13. {
  14. void init()
  15. {
  16. }
  17. void shutdown()
  18. {
  19. }
  20. }
  21. class NullSoundWorld : public SoundWorld
  22. {
  23. public:
  24. NullSoundWorld()
  25. {
  26. }
  27. virtual ~NullSoundWorld()
  28. {
  29. }
  30. virtual SoundInstanceId play(SoundResource* /*sr*/, bool /*loop*/, float /*volume*/, const Vector3& /*pos*/)
  31. {
  32. Id id;
  33. id.id = INVALID_ID;
  34. id.index = 0;
  35. return id;
  36. }
  37. virtual void stop(SoundInstanceId /*id*/)
  38. {
  39. }
  40. virtual bool is_playing(SoundInstanceId /*id*/)
  41. {
  42. return false;
  43. }
  44. virtual void stop_all()
  45. {
  46. }
  47. virtual void pause_all()
  48. {
  49. }
  50. virtual void resume_all()
  51. {
  52. }
  53. virtual void set_sound_positions(uint32_t /*num*/, const SoundInstanceId* /*ids*/, const Vector3* /*positions*/)
  54. {
  55. }
  56. virtual void set_sound_ranges(uint32_t /*num*/, const SoundInstanceId* /*ids*/, const float* /*ranges*/)
  57. {
  58. }
  59. virtual void set_sound_volumes(uint32_t /*num*/, const SoundInstanceId* /*ids*/, const float* /*volumes*/)
  60. {
  61. }
  62. virtual void reload_sounds(SoundResource* /*old_sr*/, SoundResource* /*new_sr*/)
  63. {
  64. }
  65. virtual void set_listener_pose(const Matrix4x4& /*pose*/)
  66. {
  67. }
  68. virtual void update()
  69. {
  70. }
  71. };
  72. SoundWorld* SoundWorld::create(Allocator& a)
  73. {
  74. return CE_NEW(a, NullSoundWorld)();
  75. }
  76. void SoundWorld::destroy(Allocator& a, SoundWorld* sw)
  77. {
  78. CE_DELETE(a, sw);
  79. }
  80. } // namespace crown
  81. #endif // CROWN_SOUND_NULL