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 
29 namespace Pipeline
30 {
35  class CrossFader
36  {
37  PIMPL(CrossFader)
38 
39  public:
40 
41  enum class FadeMode : unsigned char
42  {
43  NoFading=0,
44  FadeIn,
45  FadeOut
46  };
47 
48  CrossFader();
49  ~CrossFader();
50 
55  virtual double get_current_volume() const=0;
56 
61  virtual void set_current_volume(double vol)=0;
62 
67  MilliSeconds get_fading_time_ms() const;
68 
72  void fade_in();
73 
77  void fade_out();
78 
79  bool is_fading_out() const;
80  bool is_fading_int() const;
81 
86  void fader_timed_out();
87 
88 
89  private:
90  CrossFader(const CrossFader& other)=delete;
91 
92  void increase_volume();
93  void decrease_volume();
94  void init_fader();
95 
96  protected:
97  void abort_fader();
98 
99  virtual void stop()=0;
100  virtual void play()=0;
101  virtual void fade_out_handler()=0;
102  virtual void fade_in_handler()=0;
103  };
104 }
105 
106 #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:35
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:39