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 <QtGlobal>
27 
28 class FaderThreadData;
29 class FaderThread;
30 
36 {
37 public:
38 
39  enum class FadeMode : quint8
40  {
41  NoFading=0,
42  FadeIn,
43  FadeOut
44  };
45 
46  CrossFader();
47  virtual ~CrossFader();
48 
53  virtual double get_current_volume() const=0;
54 
59  virtual void set_current_volume(double vol)=0;
60 
65  quint64 get_fading_time_ms() const;
66 
70  void fade_in();
71 
75  void fade_out();
76 
81  void fader_timed_out();
82 
83 
84 private:
85  FadeMode _fade_mode;
86  double _fade_step;
87 
88  FaderThread* _fader=nullptr;
89  FaderThreadData* _fader_data=nullptr;
90 
91 private:
92  CrossFader(const CrossFader& other);
93 
94  void increase_volume();
95  void decrease_volume();
96  void init_fader();
97 
98 protected:
99  void abort_fader();
100 };
101 
102 #endif // CROSSFADER_H
void fade_in()
start to fade in
void fade_out()
start to fade out
The CrossFader class.
Definition: CrossFader.h:35
void fader_timed_out()
function is called periodically. This function should not be used from outside TODO ...
quint64 get_fading_time_ms() const
get fading time in ms
virtual void set_current_volume(double vol)=0
set current volume of pipeline
virtual double get_current_volume() const =0
get current volume of pipeline