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
* sine_mixer.h
2302 jag 3
* DIN Is Noise is copyright (c) 2006-2025 Jagannathan Sampath
1528 jag 4
* For more information, please visit http://dinisnoise.org/
5
*/
6
 
7
#ifndef __sine_mixer
8
#define __sine_mixer
9
 
10
#include "box.h"
11
#include "multi_curve.h"
12
#include "spinner.h"
13
#include "checkbutton.h"
14
#include "state_button.h"
15
#include "levels.h"
16
#include "plugin.h"
17
#include "point.h"
18
#include "custom_periodic.h"
19
#include "sine.h"
20
#include "curve_editor.h"
21
#include "listeners.h"
22
#include "filled_button.h"
23
#include "mouse_slider.h"
24
#include "plus_button.h"
25
#include "minus_button.h"
26
#include "cross_button.h"
27
 
28
#include <vector>
29
 
30
struct harmonics_list_button : state_button {
31
  std::vector<int> harmonics;
32
};
33
 
1586 jag 34
struct sine_mixer : plugin, change_listener<levels>, shift_listener, paint_listener, curve_listener, option_listener {
1528 jag 35
 
36
  static int NUM_SINE_SAMPLES;
37
  static const int MIN_SINE_SAMPLES;
38
 
39
  int num_points;
40
  int make_shapeform;
41
 
42
  funktion* pf_sin;
43
  custom_periodic cp_sin;
44
  sine st_sin;
45
  int type;
46
  curve_editor sin_ed;
47
 
48
  int nharmonics;
49
  std::vector< std::vector< point<float> > > harmonics;
50
 
51
  // output
52
  std::vector< point<float> > norm;
53
  void normalise ();
54
 
55
  // ui
56
  //
57
 
58
  spinner<int> sp_points;
1588 jag 59
  checkbutton cb_make_shapeform;
1528 jag 60
 
1588 jag 61
  // standard/custom sin
62
  options_list ol_sin;
1528 jag 63
 
64
  button b_edit;
65
 
1588 jag 66
  levels harms; // harmonics
67
  levels phase; // phase
68
  levels* levs [2]; // harmonics, phase
69
  checkbutton cbpaint;
70
  options_list olpaint;
71
  MAKE_OPTION_LISTENER(paintlis, pail)
72
  void toggpaint (label& l);
1528 jag 73
 
74
  sine_mixer ();
75
  ~sine_mixer ();
76
  void load_params ();
77
  void save_params ();
78
 
79
  void setup ();
80
 
81
  void set_type ();
82
  void set_samples (int s);
83
 
84
  void prep_harmonics ();
85
  void num_harmonics (int n);
86
  void mix ();
87
  void render ();
88
 
89
  int auto_apply;
90
  void apply_not_auto_apply ();
91
  void shift_apply ();
92
 
93
  void changed (field& f);
94
  void changed (checkbutton& cb);
1585 jag 95
 
96
  void changed (levels& l);
1562 jag 97
  void paint (levels& l);
1585 jag 98
  void shifted (levels& l);
1528 jag 99
 
100
  void picked (label& lbl, int dir);
101
  void edited (curve_editor* e, int i);
102
  void clicked (button& b);
1566 jag 103
  void moused (int dir, double scl);
1592 jag 104
  int handle_input ();
1528 jag 105
 
1588 jag 106
  int paintphase;
1967 jag 107
 
108
  int titlemoving;
1626 jag 109
  MAKE_MOVE_LISTENER (szrmov, szm)
1583 jag 110
 
1528 jag 111
};
112
 
113
extern sine_mixer sinemixer;
114
#endif