1 /***************************************************************************
2 **                                                                        **
3 **  Polyphone, a soundfont editor                                         **
4 **  Copyright (C) 2013-2019 Davy Triponney                                **
5 **                                                                        **
6 **  This program is free software: you can redistribute it and/or modify  **
7 **  it under the terms of the GNU General Public License as published by  **
8 **  the Free Software Foundation, either version 3 of the License, or     **
9 **  (at your option) any later version.                                   **
10 **                                                                        **
11 **  This program is distributed in the hope that it will be useful,       **
12 **  but WITHOUT ANY WARRANTY; without even the implied warranty of        **
13 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the          **
14 **  GNU General Public License for more details.                          **
15 **                                                                        **
16 **  You should have received a copy of the GNU General Public License     **
17 **  along with this program. If not, see http://www.gnu.org/licenses/.    **
18 **                                                                        **
19 ****************************************************************************
20 **           Author: Davy Triponney                                       **
21 **  Website/Contact: https://www.polyphone-soundfonts.com                 **
22 **             Date: 01.01.2013                                           **
23 ***************************************************************************/
24 
25 #ifndef SFZPARAMLIST_H
26 #define SFZPARAMLIST_H
27 
28 #include "basetypes.h"
29 class SoundfontManager;
30 
31 class SfzParamList
32 {
33 public:
34     SfzParamList(SoundfontManager * sf2, EltID id);
35     SfzParamList(SoundfontManager * sf2, SfzParamList * paramPrst, EltID idInst);
getChamp(int num)36     AttributeType getChamp(int num)     { return _listeChamps.at(num); }
getValeur(int num)37     double getValeur(int num)   { return _listeValeurs.at(num); }
size()38     int size()                  { return _listeChamps.size(); }
findChamp(AttributeType champ)39     int findChamp(AttributeType champ)  { return _listeChamps.indexOf(champ); }
40 
41 private:
42     QList<AttributeType> _listeChamps;
43     QList<double> _listeValeurs;
44     static int _boucleGlobale;
45 
46     double limit(double val, AttributeType champ);
47     void load(SoundfontManager *sf2, EltID id);
48     void getGlobalValue(SoundfontManager * sf2, EltID id, AttributeType champ);
49     void mix(AttributeType champCoarse, AttributeType champFine, int addValue = 0);
50     void fusion(AttributeType champ, double value);
51     void prepend(AttributeType champ);
52     void adaptKeynum2();
53     void adaptKeynum2(int minKey, int maxKey, AttributeType champBase, AttributeType champKeynum);
54     void adaptLfo(SoundfontManager *sf2, EltID idInstSmpl);
55     double getValKeynum(double valBase, int key, double keynum);
56 };
57 
58 #endif // SFZPARAMLIST_H
59