1 /*
2 	Copyright (C) 2008, 2009 Andres Cabrera
3 			  (C) 2003 by John D. Ramsdell.
4 	mantaraya36@gmail.com
5 
6 	This file is part of CsoundQt.
7 
8 	CsoundQt is free software; you can redistribute it
9 	and/or modify it under the terms of the GNU Lesser General Public
10 	License as published by the Free Software Foundation; either
11 	version 2.1 of the License, or (at your option) any later version.
12 
13 	CsoundQt is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 	GNU Lesser General Public License for more details.
17 
18 	You should have received a copy of the GNU Lesser General Public
19 	License along with Csound; if not, write to the Free Software
20 	Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
21 	02111-1307 USA
22 */
23 
24 #ifndef CURVE_H
25 #define CURVE_H
26 
27 //#include <QString>
28 #include <QMutex>
29 #include "types.h"
30 
31 enum Polarity {
32 	POLARITY_NOPOL,
33 	POLARITY_NEGPOL,
34 	POLARITY_POSPOL,
35 	POLARITY_BIPOL
36 };
37 
38 enum CurveType {
39     CURVE_FTABLE=1,
40     CURVE_AUDIOSIGNAL=2,
41     CURVE_SPECTRUM=3
42 };
43 
44 
45 class Curve
46 {
47 public:
48 	Curve(MYFLT *, size_t, const QString&, Polarity,
49 		  MYFLT, MYFLT, MYFLT, MYFLT, bool, WINDAT *original);
50 	Curve(const Curve&);
51 	Curve &operator=(const Curve&);
52 	~Curve();
53 	//    uintptr_t get_id() const;
54 	//     MYFLT *get_data() const;
55 	MYFLT get_data(int index);
56 	size_t get_size() const;      // number of points
57     QString get_caption() const; // original caption of curve
58     Polarity get_polarity() const; // polarity
59 	MYFLT get_max() const;        // curve max
60 	MYFLT get_min() const;        // curve min
61 	MYFLT get_absmax() const;     // abs max of above
62 	MYFLT get_y_scale() const;    // Y axis scaling factor
63     CurveType get_type() const;
64 	WINDAT * getOriginal();
65 
66 	//    void set_id(uintptr_t id);
67 	void set_data(MYFLT * data);
68 	void set_size(size_t size);      // number of points
69 	void set_caption(QString caption); // title of curve
70     void set_polarity(Polarity polarity); // polarity
71 	void set_max(MYFLT max);        // curve max
72 	void set_min(MYFLT min);        // curve min
73 	void set_absmax(MYFLT absmax);     // abs max of above
74 	void set_y_scale(MYFLT y_scale);    // Y axis scaling factor
75 	void setOriginal(WINDAT *windat);
76 
77 	bool is_divider_dotted() const; // Add dotted divider when true
78 	bool has_same_caption(Curve *) const;
79 private:
80 	//    uintptr_t m_id;
81 	MYFLT *m_data;
82 	WINDAT *m_original;
83 	size_t m_size;
84 	QString m_caption;
85     QString m_title;
86     Polarity m_polarity;
87 	MYFLT m_max, m_min, m_absmax, m_y_scale;
88 	bool m_dotted_divider;
89 	void copy(size_t, MYFLT *);
90 	void destroy();
91     CurveType m_curveType;
92 
93 	QMutex mutex;
94 };
95 
96 #endif
97