1 // padthv1_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 __padthv1_param_h
23 #define __padthv1_param_h
24 
25 #include "padthv1.h"
26 
27 #include <QString>
28 
29 // forward decl.
30 class QDomElement;
31 class QDomDocument;
32 
33 
34 //-------------------------------------------------------------------------
35 // padthv1_param - decl.
36 //
37 
38 namespace padthv1_param
39 {
40 	// Preset serialization methods.
41 	bool loadPreset(padthv1 *pSynth,
42 		const QString& sFilename);
43 	bool savePreset(padthv1 *pSynth,
44 		const QString& sFilename,
45 		bool bSymLink = false);
46 
47 	// Sample serialization methods.
48 	void loadSamples(padthv1 *pSynth,
49 		const QDomElement& eSamples);
50 	void saveSamples(padthv1 *pSynth,
51 		QDomDocument& doc, QDomElement& eSamples,
52 		bool bSymLink = false);
53 
54 	// Tuning serialization methods.
55 	void loadTuning(padthv1 *pSynth,
56 		const QDomElement& eTuning);
57 	void saveTuning(padthv1 *pSynth,
58 		QDomDocument& doc, QDomElement& eTuning,
59 		bool bSymLink = false);
60 
61 	// Default parameter name/value helpers.
62 	const char *paramName(padthv1::ParamIndex index);
63 	float paramDefaultValue(padthv1::ParamIndex index);
64 	float paramSafeValue(padthv1::ParamIndex index, float fValue);
65 	float paramValue(padthv1::ParamIndex index, float fScale);
66 	float paramScale(padthv1::ParamIndex index, float fValue);
67 	bool paramFloat(padthv1::ParamIndex index);
68 
69 	// Load/save and convert canonical/absolute filename helpers.
70 	QString loadFilename(const QString& sFilename);
71 	QString saveFilename(const QString& sFilename, bool bSymLink);
72 };
73 
74 
75 #endif	// __padthv1_param_h
76 
77 // end of padthv1_param.h
78