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 17 #pragma once 18 19 /** 20 * @file Fader.h 21 * @ingroup fx 22 * The Fader class. 23 */ 24 25 #include "fx/Effect.h" 26 #include "fx/FaderReader.h" 27 28 AUD_NAMESPACE_BEGIN 29 30 /** 31 * This sound fades another sound. 32 * If the fading type is FADE_IN, everything before the fading start will be 33 * silenced, for FADE_OUT that's true for everything after fading ends. 34 */ 35 class AUD_API Fader : public Effect 36 { 37 private: 38 /** 39 * The fading type. 40 */ 41 const FadeType m_type; 42 43 /** 44 * The fading start. 45 */ 46 const double m_start; 47 48 /** 49 * The fading length. 50 */ 51 const double m_length; 52 53 // delete copy constructor and operator= 54 Fader(const Fader&) = delete; 55 Fader& operator=(const Fader&) = delete; 56 57 public: 58 /** 59 * Creates a new fader sound. 60 * \param sound The input sound. 61 * \param type The fading type. 62 * \param start The time where fading should start in seconds. 63 * \param length How long fading should last in seconds. 64 */ 65 Fader(std::shared_ptr<ISound> sound, 66 FadeType type = FADE_IN, 67 double start = 0, double length = 1); 68 69 /** 70 * Returns the fading type. 71 */ 72 FadeType getType() const; 73 74 /** 75 * Returns the fading start. 76 */ 77 double getStart() const; 78 79 /** 80 * Returns the fading length. 81 */ 82 double getLength() const; 83 84 virtual std::shared_ptr<IReader> createReader(); 85 }; 86 87 AUD_NAMESPACE_END 88