00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef TRACK_H
00024 #define TRACK_H
00025
00026 #include <QString>
00027 #include <QDomDocument>
00028 #include <QList>
00029 #include <QByteArray>
00030
00031 #include "ContextItem.h"
00032 #include "GainEnvelope.h"
00033 #include "AudioProcessingItem.h"
00034
00035 #include "defines.h"
00036
00037 class AudioClip;
00038 class Sheet;
00039 class PluginChain;
00040 class Plugin;
00041
00042 class Track : public ContextItem, public AudioProcessingItem
00043 {
00044 Q_OBJECT
00045 Q_CLASSINFO("mute", tr("Mute"))
00046 Q_CLASSINFO("toggle_arm", tr("Record: On/Off"))
00047 Q_CLASSINFO("solo", tr("Solo"))
00048 Q_CLASSINFO("silence_others", tr("Silence other tracks"))
00049
00050 public :
00051 Track(Sheet* sheet, const QString& name, int height);
00052 Track(Sheet* sheet, const QDomNode node);
00053 ~Track();
00054
00055 static const int INITIAL_HEIGHT = 100;
00056
00057 Command* add_clip(AudioClip* clip, bool historable=true, bool ismove=false);
00058 Command* add_plugin(Plugin* plugin);
00059
00060 Command* remove_clip(AudioClip* clip, bool historable=true, bool ismove=false);
00061 Command* remove_plugin(Plugin* plugin);
00062
00063 AudioClip* init_recording();
00064
00065 int arm();
00066 int disarm();
00067
00068
00069 AudioClip* get_clip_after(const TimeRef& pos);
00070 AudioClip* get_clip_before(const TimeRef& pos);
00071 void get_render_range(TimeRef& startlocation, TimeRef& endlocation);
00072 QString get_bus_in() const {return busIn;}
00073 QString get_bus_out() const{return busOut;}
00074 int get_height() const {return m_height;}
00075 float get_pan() const {return m_pan;}
00076 Sheet* get_sheet() const {return m_sheet;}
00077 QString get_name() const {return m_name;}
00078
00079 int get_total_clips();
00080 QDomNode get_state(QDomDocument doc, bool istemplate=false);
00081 PluginChain* get_plugin_chain() const {return m_pluginChain;}
00082 QList<AudioClip*> get_cliplist() const;
00083 int get_sort_index() const;
00084 bool is_smaller_then(APILinkedListNode* node) {return ((Track*)node)->get_sort_index() > get_sort_index();}
00085
00086
00087
00088
00089 void set_bus_out(QByteArray bus);
00090 void set_bus_in(QByteArray bus);
00091 void set_muted_by_solo(bool muted);
00092 void set_name(const QString& name);
00093 void set_solo(bool solo);
00094 void set_muted(bool muted);
00095 void set_pan(float pan);
00096 void set_sort_index(int index);
00097 void set_height(int h);
00098 void set_capture_left_channel(bool capture);
00099 void set_capture_right_channel(bool capture);
00100 int set_state( const QDomNode& node );
00101
00102
00103
00104 bool is_muted_by_solo();
00105 bool is_solo();
00106 bool armed();
00107 bool capture_left_channel()
00108 {
00109 return m_captureLeftChannel;
00110 }
00111 bool capture_right_channel()
00112 {
00113 return m_captureRightChannel;
00114 }
00115
00116
00117
00118 int process(nframes_t nframes);
00119
00120 private :
00121 Sheet* m_sheet;
00122 APILinkedList m_clips;
00123
00124 float m_pan;
00125 int numtakes;
00126 QByteArray busIn;
00127 QByteArray busOut;
00128
00129 QString m_name;
00130
00131 int m_sortIndex;
00132 int m_height;
00133
00134 bool isSolo;
00135 bool isArmed;
00136 bool mutedBySolo;
00137 bool m_captureLeftChannel;
00138 bool m_captureRightChannel;
00139
00140 void set_armed(bool armed);
00141 void init();
00142
00143 signals:
00144 void audioClipAdded(AudioClip* clip);
00145 void audioClipRemoved(AudioClip* clip);
00146 void heightChanged();
00147 void muteChanged(bool isMuted);
00148 void soloChanged(bool isSolo);
00149 void armedChanged(bool isArmed);
00150 void lockChanged(bool isLocked);
00151 void gainChanged();
00152 void panChanged();
00153 void stateChanged();
00154 void audibleStateChanged();
00155 void inBusChanged();
00156 void outBusChanged();
00157
00158 public slots:
00159 void set_gain(float gain);
00160 void clip_position_changed(AudioClip* clip);
00161
00162 float get_gain() const;
00163
00164 Command* mute();
00165 Command* toggle_arm();
00166 Command* solo();
00167 Command* silence_others();
00168
00169 private slots:
00170 void private_add_clip(AudioClip* clip);
00171 void private_remove_clip(AudioClip* clip);
00172
00173 };
00174
00175
00176 inline float Track::get_gain( ) const
00177 {
00178 return m_fader->get_gain();
00179 }
00180
00181 #endif
00182