Subversion Repositories DIN Is Noise

Rev

Rev 2097 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1528 jag 1
/*
2
* fader.h
2302 jag 3
* DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath
1713 jag 4
* DIN Is Noise is released under GNU Public License 2.0
1528 jag 5
* For more information, please visit https://dinisnoise.org/
6
*/
7
 
8
 
9
#ifndef __FADER__
10
#define __FADER__
11
 
12
#include <string>
13
#include <fstream>
14
 
15
struct fader;
16
struct fade_listener {
17
  virtual void after_fade (fader& f) = 0;
18
};
19
 
20
struct fader {
21
 
22
  static double TIME; // default
23
 
24
  int on;
25
 
26
  float start;
27
  float end;
28
  float delta;
29
  int reached;
30
 
31
  float alpha;
32
 
33
  int flip; // end > start? 1:0
34
 
35
  float amount; // output
36
 
37
  double start_time, delta_time;
38
 
39
  fade_listener* afl;
40
 
41
  fader (double dt);
42
  fader (float vs = 0, float ve = 1);
43
  void set (float vs, float ve, int _on = 1, double dt = TIME);
44
  void copy (fader* src);
45
  int eval ();
46
  void restart ();
1667 jag 47
  void retime (double dt);
1528 jag 48
  void load (std::ifstream& f);
49
  void save (std::ofstream& f);
50
 
51
};
52
 
53
#endif