Volume.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 Volume.h
  19. * @ingroup fx
  20. * The Volume class.
  21. */
  22. #include "fx/Effect.h"
  23. AUD_NAMESPACE_BEGIN
  24. /**
  25. * This sound changes the volume of another sound.
  26. * The set volume should be a value between 0.0 and 1.0, higher values at your
  27. * own risk!
  28. */
  29. class AUD_API Volume : public Effect
  30. {
  31. private:
  32. /**
  33. * The volume.
  34. */
  35. const float m_volume;
  36. // delete copy constructor and operator=
  37. Volume(const Volume&) = delete;
  38. Volume& operator=(const Volume&) = delete;
  39. public:
  40. /**
  41. * Creates a new volume sound.
  42. * \param sound The input sound.
  43. * \param volume The desired volume.
  44. */
  45. Volume(std::shared_ptr<ISound> sound, float volume);
  46. /**
  47. * Returns the volume.
  48. * \return The current volume.
  49. */
  50. float getVolume() const;
  51. virtual std::shared_ptr<IReader> createReader();
  52. };
  53. AUD_NAMESPACE_END