1 //=============================================================================
2 //  MusE Score
3 //  Linux Music Score Editor
4 //
5 //  Copyright (C) 2002-2010 Werner Schweer and others
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 version 2.
9 //
10 //  This program is distributed in the hope that it will be useful,
11 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 //  GNU General Public License for more details.
14 //
15 //  You should have received a copy of the GNU General Public License
16 //  along with this program; if not, write to the Free Software
17 //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18 //=============================================================================
19 
20 #ifndef __AEOLUS_H__
21 #define __AEOLUS_H__
22 
23 #include "stdint.h"
24 #include "synthesizer/synthesizer.h"
25 #include "synthesizer/midipatch.h"
26 
27 #include "asection.h"
28 #include "division.h"
29 #include "global.h"
30 
31 
32 namespace Ms {
33       struct MidiPatch;
34       class Event;
35       struct ParDescr;
36       }
37 
38 using namespace Ms;
39 
40 class Model;
41 // class M_audio_info;
42 class M_new_divis;
43 class M_ifc_init;
44 
45 //---------------------------------------------------------
46 //   Synth
47 //---------------------------------------------------------
48 
49 class Aeolus : public Synthesizer {
50       static const std::vector<ParDescr> pd;
51 
52       Model* model;
53       QList<MidiPatch*> patchList;
54       uint16_t _midimap [16];
55       int _sc_cmode;          // stop control command mode
56       int _sc_group;          // stop control group number
57 
58       enum { VOLUME, REVSIZE, REVTIME, STPOSIT };
59 
60       volatile bool   _running;
61       int             _hold;
62       int             _nplay;
63       int             _nasect;
64       int             _ndivis;
65       Asection*       _asectp [NASECT];
66 
67       Division*       _divisp [NDIVIS];
68       unsigned char   _keymap [NNOTES];
69       float           _audiopar[4];
70       float           _revsize;
71       float           _revtime;
72 
73       int nout;
74       float routb[PERIOD];
75       float loutb[PERIOD];
76 
77       float           _fsamp;
78       int             _fsize;
79       SyntiParameter  *_asectpar [NASECT];
80 
81       M_ifc_init*   _ifc_init;
82       uint32_t      _ifelms [NGROUP];
83       char          _tempstr[64];
84 
85       void proc_synth(int);
86       void cond_key_off (int m, int b);
87       void cond_key_on (int m, int b);
88 
89       void  audio_init(int sampleRate);
90       void  audio_start();
91 
92       void key_off (int n, int b);
93       void key_on (int n, int b);
94       void newDivis(M_new_divis* X);
95       void proc_queue(uint32_t);
96 
97       virtual void setValue(int idx, double value);
98       virtual double value(int idx) const;
99       const ParDescr* parameter(int idx) const;
100 
101    public:
102       Aeolus();
103       virtual ~Aeolus();
104       virtual void init(float sampleRate);
105 
name()106       virtual const char* name() const { return "Aeolus"; }
107 
108       virtual void setMasterTuning(double);
109       virtual double masterTuning() const;
110 
loadSoundFonts(const QStringList &)111       virtual bool loadSoundFonts(const QStringList&) { return true; }
soundFontsInfo()112       virtual std::vector<Ms::SoundFontInfo> soundFontsInfo() const { std::vector<Ms::SoundFontInfo> sl; return sl; }
113 
114       virtual void process(unsigned, float*, float*, float*);
115       virtual void play(const PlayEvent&);
116 
117       virtual const QList<MidiPatch*>& getPatchInfo() const;
118 
119       // get/set synthesizer state
120       virtual SynthesizerGroup state() const;
121       virtual bool setState(const SynthesizerGroup&);
122 
allSoundsOff(int channel)123       virtual void allSoundsOff(int channel) { allNotesOff(channel); }
124       virtual void allNotesOff(int /*channel*/);
125 
126       virtual SynthesizerGui* gui();
127 
128       friend class Model;
129       };
130 
131 enum {
132       A_VOLUME, A_REVSIZE, A_REVTIME, A_STPOSIT
133       };
134 
135 #endif
136 
137 
138