~ubuntu-branches/ubuntu/vivid/aeolus/vivid

« back to all changes in this revision

Viewing changes to source/addsynth.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-04-19 19:12:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20100419191251-hgarjfcdfl7c0ryl
Tags: 0.8.4-3
debian/patches/01-makefile.patch: Drop -march=native flag, it isn't valid
for Debian packages as the results are unpredictable, thanks to
Bastian Blank for reporting this (Closes: #578278).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
    Copyright (C) 2003-2008 Fons Adriaensen <fons@kokkinizita.net>
 
3
    
 
4
    This program is free software; you can redistribute it and/or modify
 
5
    it under the terms of the GNU General Public License as published by
 
6
    the Free Software Foundation; either version 2 of the License, or
 
7
    (at your option) any later version.
 
8
 
 
9
    This program is distributed in the hope that it will be useful,
 
10
    but WITHOUT ANY WARRANTY; without even the implied warranty of
 
11
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
12
    GNU General Public License for more details.
 
13
 
 
14
    You should have received a copy of the GNU General Public License
 
15
    along with this program; if not, write to the Free Software
 
16
    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
17
*/
 
18
 
 
19
 
 
20
#ifndef __ADDSYNTH_H
 
21
#define __ADDSYNTH_H
 
22
 
 
23
 
 
24
#include <stdio.h>
 
25
#include <stdint.h>
 
26
 
 
27
 
 
28
#define N_NOTE 11
 
29
#define N_HARM 64
 
30
#define NOTE_MIN 36
 
31
#define NOTE_MAX 96
 
32
 
 
33
 
 
34
 
 
35
class N_func
 
36
{
 
37
public:
 
38
 
 
39
    N_func (void);
 
40
    void reset (float v);
 
41
    void setv (int i, float v);
 
42
    void clrv (int i);
 
43
    float vs (int i) const { return _v [i]; }
 
44
    int   st (int i) const { return (_b & (1 << i)) ? 1 : 0; }
 
45
    float vi (int n) const
 
46
    {
 
47
        int   i = n / 6;
 
48
        int   k = n - 6 * i;
 
49
        float v = _v [i];
 
50
        if (k) v += k * (_v [i + 1] - v) / 6; 
 
51
        return v;
 
52
    }   
 
53
 
 
54
    void write (FILE *F);
 
55
    void read (FILE *F);
 
56
                
 
57
private:
 
58
 
 
59
    int   _b;
 
60
    float _v [N_NOTE];
 
61
};
 
62
 
 
63
 
 
64
 
 
65
class HN_func
 
66
{
 
67
public:
 
68
 
 
69
    HN_func (void);
 
70
    void reset (float v);
 
71
    void setv (int i, float v);
 
72
    void clrv (int i);
 
73
    void setv (int h, int i, float v) { _h [h].setv (i, v); }
 
74
    void clrv (int h, int i) { _h [h].clrv (i); }     
 
75
    float vs (int h, int i) const { return _h [h].vs (i); }
 
76
    int   st (int h, int i) const { return _h [h].st (i); }
 
77
    float vi (int h, int n) const { return _h [h].vi (n); }
 
78
    void write (FILE *F, int k);
 
79
    void read (FILE *F, int k);
 
80
                
 
81
private:
 
82
 
 
83
    N_func _h [N_HARM];
 
84
};
 
85
 
 
86
 
 
87
 
 
88
class Addsynth
 
89
{
 
90
public:
 
91
 
 
92
    Addsynth (void);
 
93
 
 
94
    void reset (void);
 
95
    int save (const char *sdir); 
 
96
    int load (const char *sdir);
 
97
    
 
98
    char       _filename [64]; 
 
99
    char       _stopname [32];
 
100
    char       _copyrite [56];
 
101
    char       _mnemonic [8];
 
102
    char       _comments [56];
 
103
    char       _reserved [8];
 
104
    int32_t    _n0;
 
105
    int32_t    _n1;
 
106
    int32_t    _fn;
 
107
    int32_t    _fd;
 
108
    N_func     _n_vol;
 
109
    N_func     _n_off;
 
110
    N_func     _n_ran;         
 
111
    N_func     _n_ins;
 
112
    N_func     _n_att;
 
113
    N_func     _n_atd;         
 
114
    N_func     _n_dct;
 
115
    N_func     _n_dcd;         
 
116
    HN_func    _h_lev;
 
117
    HN_func    _h_ran;
 
118
    HN_func    _h_att;
 
119
    HN_func    _h_atp;
 
120
 
 
121
    char       _pan;
 
122
    int32_t    _del;
 
123
};
 
124
 
 
125
 
 
126
#endif
 
127