Sayonara Player
Crossfader.h
1 /* CrossFader.h */
2 
3 /* Copyright (C) 2011-2017 Lucio Carreras
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 /* CrossFader.h */
22 
23 #ifndef CROSSFADER_H
24 #define CROSSFADER_H
25 
26 #include "Utils/Pimpl.h"
27 
28 namespace Pipeline
29 {
34  class CrossFader
35  {
36  PIMPL(CrossFader)
37 
38  public:
39 
40  enum class FadeMode : unsigned char
41  {
42  NoFading=0,
43  FadeIn,
44  FadeOut
45  };
46 
47  CrossFader();
48  ~CrossFader();
49 
54  virtual double get_current_volume() const=0;
55 
60  virtual void set_current_volume(double vol)=0;
61 
66  MilliSeconds get_fading_time_ms() const;
67 
71  void fade_in();
72 
76  void fade_out();
77 
78  bool is_fading_out() const;
79  bool is_fading_int() const;
80 
85  void fader_timed_out();
86 
87 
88  private:
89  CrossFader(const CrossFader& other)=delete;
90 
91  void increase_volume();
92  void decrease_volume();
93  void init_fader();
94 
95  protected:
96  void abort_fader();
97 
98  virtual void stop()=0;
99  virtual void play()=0;
100  virtual void fade_out_handler()=0;
101  virtual void fade_in_handler()=0;
102  };
103 }
104 
105 #endif // CROSSFADER_H
void fade_in()
start to fade in
virtual void set_current_volume(double vol)=0
set current volume of pipeline
The CrossFader class.
Definition: Crossfader.h:34
virtual double get_current_volume() const =0
get current volume of pipeline
void fade_out()
start to fade out
void fader_timed_out()
function is called periodically. This function should not be used from outside TODO ...
MilliSeconds get_fading_time_ms() const
get fading time in ms
Definition: AbstractPipeline.h:37