1 // synthv1_param.h
2 //
3 /****************************************************************************
4    Copyright (C) 2012-2021, rncbc aka Rui Nuno Capela. All rights reserved.
5 
6    This program is free software; you can redistribute it and/or
7    modify it under the terms of the GNU General Public License
8    as published by the Free Software Foundation; either version 2
9    of the License, or (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 along
17    with this program; if not, write to the Free Software Foundation, Inc.,
18    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 
20 *****************************************************************************/
21 
22 #ifndef __synthv1_param_h
23 #define __synthv1_param_h
24 
25 #include "synthv1.h"
26 
27 #include <QString>
28 
29 // forward decl.
30 class QDomElement;
31 class QDomDocument;
32 
33 
34 //-------------------------------------------------------------------------
35 // synthv1_param - decl.
36 //
37 
38 namespace synthv1_param
39 {
40 	// Preset serialization methods.
41 	bool loadPreset(synthv1 *pSynth,
42 		const QString& sFilename);
43 	bool savePreset(synthv1 *pSynth,
44 		const QString& sFilename,
45 		bool bSymLink = false);
46 
47 	// Tuning serialization methods.
48 	void loadTuning(synthv1 *pSynth,
49 		const QDomElement& eTuning);
50 	void saveTuning(synthv1 *pSynth,
51 		QDomDocument& doc, QDomElement& eTuning,
52 		bool bSymLink = false);
53 
54 	// Default parameter name/value helpers.
55 	const char *paramName(synthv1::ParamIndex index);
56 	float paramDefaultValue(synthv1::ParamIndex index);
57 	float paramSafeValue(synthv1::ParamIndex index, float fValue);
58 	float paramValue(synthv1::ParamIndex index, float fScale);
59 	float paramScale(synthv1::ParamIndex index, float fValue);
60 	bool paramFloat(synthv1::ParamIndex index);
61 
62 	// Load/save and convert canonical/absolute filename helpers.
63 	QString loadFilename(const QString& sFilename);
64 	QString saveFilename(const QString& sFilename, bool bSymLink);
65 };
66 
67 
68 #endif	// __synthv1_param_h
69 
70 // end of synthv1_param.h
71