Effect.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*******************************************************************************
  2. * Copyright 2009-2016 Jörg Müller
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. ******************************************************************************/
  16. #pragma once
  17. /**
  18. * @file Effect.h
  19. * @ingroup fx
  20. * The Effect class.
  21. */
  22. #include "ISound.h"
  23. AUD_NAMESPACE_BEGIN
  24. /**
  25. * This sound is a base class for all effect factories that take one other
  26. * sound as input.
  27. */
  28. class AUD_API Effect : public ISound
  29. {
  30. private:
  31. // delete copy constructor and operator=
  32. Effect(const Effect&) = delete;
  33. Effect& operator=(const Effect&) = delete;
  34. protected:
  35. /**
  36. * If there is no reader it is created out of this sound.
  37. */
  38. std::shared_ptr<ISound> m_sound;
  39. /**
  40. * Returns the reader created out of the sound.
  41. * This method can be used for the createReader function of the implementing
  42. * classes.
  43. * \return The reader created out of the sound.
  44. */
  45. inline std::shared_ptr<IReader> getReader() const
  46. {
  47. return m_sound->createReader();
  48. }
  49. public:
  50. /**
  51. * Creates a new sound.
  52. * \param sound The input sound.
  53. */
  54. Effect(std::shared_ptr<ISound> sound);
  55. /**
  56. * Destroys the sound.
  57. */
  58. virtual ~Effect();
  59. /**
  60. * Returns the saved sound.
  61. * \return The sound or nullptr if there has no sound been saved.
  62. */
  63. std::shared_ptr<ISound> getSound() const;
  64. };
  65. AUD_NAMESPACE_END