1 /* 2 Copyright (C) 2006 Remon Sijrier 3 4 This file is part of Traverso 5 6 Traverso 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 2 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, write to the Free Software 18 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19 20 $Id: FadeCurve.h,v 1.19 2008/01/21 16:22:14 r_sijrier Exp $ 21 */ 22 23 #ifndef FADE_CURVE_H 24 #define FADE_CURVE_H 25 26 #include "Curve.h" 27 28 #include <QString> 29 #include <QStringList> 30 #include <QList> 31 #include <QPointF> 32 33 class Sheet; 34 class AudioClip; 35 class AudioBus; 36 37 class FadeCurve : public Curve, public APILinkedListNode 38 { 39 Q_OBJECT 40 41 Q_CLASSINFO("toggle_bypass", tr("Toggle Bypass")) 42 Q_CLASSINFO("set_mode", tr("Cycle Shape")) 43 Q_CLASSINFO("reset", tr("Remove Fade")) 44 Q_CLASSINFO("toggle_raster", tr("Toggle Raster")) 45 46 public: 47 static QStringList defaultShapes; 48 49 FadeCurve(AudioClip* clip, Sheet* sheet, QString type); 50 ~FadeCurve(); 51 52 enum FadeType { 53 FadeIn, 54 FadeOut 55 }; 56 57 QDomNode get_state(QDomDocument doc); 58 int set_state( const QDomNode & node ); 59 60 void process(AudioBus* bus, nframes_t nframes); 61 get_bend_factor()62 float get_bend_factor() {return m_bendFactor;} get_strength_factor()63 float get_strength_factor() {return m_strenghtFactor;} get_mode()64 int get_mode() const {return m_mode;} get_raster()65 int get_raster() const {return m_raster;} 66 67 void set_shape(QString shapeName); 68 void set_bend_factor(float factor); 69 void set_strength_factor(float factor); 70 get_fade_type()71 FadeType get_fade_type() const {return m_type;} 72 QList<QPointF> get_control_points(); 73 is_bypassed()74 bool is_bypassed() const {return m_bypass;} is_smaller_then(APILinkedListNode * node)75 bool is_smaller_then(APILinkedListNode* node) {Q_UNUSED(node); return false;} 76 77 void set_range(double pos); 78 void set_mode(int m); 79 80 private: 81 AudioClip* m_clip; 82 float m_bendFactor; 83 float m_strenghtFactor; 84 bool m_bypass; 85 int m_mode; 86 int m_raster; 87 FadeType m_type; 88 QString m_sType; 89 QList<QPointF> m_controlPoints; 90 91 QPointF get_curve_point(float f); 92 void init(); 93 94 public slots: 95 void solve_node_positions(); 96 97 Command* toggle_bypass(); 98 Command* set_mode(); 99 Command* reset(); 100 Command* toggle_raster(); 101 102 signals: 103 void modeChanged(); 104 void bendValueChanged(); 105 void strengthValueChanged(); 106 void rasterChanged(); 107 void rangeChanged(); 108 }; 109 110 #endif 111 112 //eof 113 114