Subversion Repositories DIN Is Noise

Rev

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

Rev Author Line No. Line
1528 jag 1
/*
2
* triggered_note.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 __TRIGGERED_NOTE
8
#define __TRIGGERED_NOTE
9
 
10
#include "note.h"
11
#include "solver.h"
12
#include "play.h"
13
#include "noiser.h"
14
 
15
struct multi_curve;
16
 
2308 jag 17
struct separation_t {
18
  float hz;
19
  float val;
20
  separation_t () { hz = val = 0;}
21
};
2286 jag 22
 
1528 jag 23
struct triggered_note {
24
 
25
  note tn; // note info
26
  float start_hz; // initial frequency of note
27
 
2286 jag 28
  //
1528 jag 29
  // play note (default) or noise?
2286 jag 30
  //
31
 
32
  enum {MIDI = -1, NOTE, NOISE};
33
 
34
  int what;
35
 
36
  // mono
37
  //
38
  solver sol;
39
  play player;
40
 
2308 jag 41
  // binaurality
42
  int binaural; // binaural?
2286 jag 43
  int just; // justification
2308 jag 44
  separation_t sep; // separation
45
 
2286 jag 46
  solver sol2;
47
  play player2;
48
 
1528 jag 49
  noiser nsr;
50
 
51
  // state
52
  enum {ATTACK, DECAY, FINISHED};
53
  int state;
54
 
55
  struct volume_t {
56
    float now;
57
    float max;
58
    float mult;
59
  } volume;
60
 
61
  //
62
  // attack
63
  float abs_attack, delta_attack;
64
  solver attack; // for attack curve
65
  float startt;
66
 
67
  //
68
  // decay
69
  float decay_time;
70
  float decay_start_volume;
71
  float abs_decay, delta_decay;
72
  float decay_lastx;
73
  solver decay; // for decay curve from instrument
74
 
75
  // visual
76
  int x, y; // position
77
  float r, g, b; // color
78
 
79
  // for bend
80
  int prev_mousex; // last mouse pos
81
  int bend_x;
82
  int bend;
83
 
84
  // input (used by keyboard-keyboard only)
85
  int key; // key on computer keyboard that triggers note
86
 
2308 jag 87
  triggered_note (const note& n, float vmax, float xx, float yy, int _what, int _bin, int _just, float _sep, int k = 0, int mox = 0);
1528 jag 88
  void setup (multi_curve* wav, multi_curve* atk, multi_curve* dk);
89
  void set_freq (float f);
90
  void eval (float* left, float* right, float* wav, float* vol, int n, float attack_time, float decay_time, gotog& g);
91
  void eval (float attack_time);
92
  void start_decay ();
1799 jag 93
  int update_solver (multi_curve& mix, const std::string& nam);
1528 jag 94
 
95
};
96
 
97
typedef std::list<triggered_note>::iterator note_iterator;
98
void update_triggered_notes (std::list<triggered_note>& tl);
99
void update_triggered_noises (std::list<triggered_note>& tl);
100
 
2308 jag 101
 
102
 
1528 jag 103
#endif