~ubuntu-branches/ubuntu/wily/muse/wily-proposed

« back to all changes in this revision

Viewing changes to muse/track.h

  • Committer: Package Import Robot
  • Author(s): Alessio Treglia
  • Date: 2011-12-03 17:12:54 UTC
  • mfrom: (1.1.8)
  • Revision ID: package-import@ubuntu.com-20111203171254-28b1j4lpb46r5jtl
Tags: 2.0~rc1-1
* New upstream RC release.
* Refresh patches, remove those patches not needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
//  $Id: track.h,v 1.39.2.17 2009/12/20 05:00:35 terminator356 Exp $
5
5
//
6
6
//  (C) Copyright 1999-2004 Werner Schweer (ws@seh.de)
 
7
//  (C) Copyright 2011 Tim E. Real (terminator356 on sourceforge)
 
8
//
 
9
//  This program is free software; you can redistribute it and/or
 
10
//  modify it under the terms of the GNU General Public License
 
11
//  as published by the Free Software Foundation; version 2 of
 
12
//  the License, or (at your option) any later version.
 
13
//
 
14
//  This program is distributed in the hope that it will be useful,
 
15
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
16
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
17
//  GNU General Public License for more details.
 
18
//
 
19
//  You should have received a copy of the GNU General Public License
 
20
//  along with this program; if not, write to the Free Software
 
21
//  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 
22
//
7
23
//=========================================================
8
24
 
9
25
#ifndef __TRACK_H__
20
36
#include "route.h"
21
37
#include "ctrl.h"
22
38
#include "globaldefs.h"
 
39
#include "cleftypes.h"
23
40
 
 
41
namespace MusECore {
 
42
class MPEventList;
24
43
class Pipeline;
25
 
class Xml;
 
44
class PluginI;
26
45
class SndFile;
27
 
class MPEventList;
28
46
class SynthI;
29
 
class PluginI;
 
47
class Xml;
 
48
 
30
49
 
31
50
//---------------------------------------------------------
32
51
//   Track
52
71
      static bool _tmpSoloChainDoIns;
53
72
      static bool _tmpSoloChainNoDec;
54
73
      
55
 
      // p3.3.38
56
74
      RouteList _inRoutes;
57
75
      RouteList _outRoutes;
 
76
      bool _nodeTraversed;   // Internal anti circular route traversal flag.
 
77
      int _auxRouteCount;    // Number of aux paths feeding this track.
58
78
      
59
79
      QString _name;
60
80
      bool _recordFlag;
71
91
      
72
92
      int _activity;
73
93
      int _lastActivity;
74
 
      //int _meter[MAX_CHANNELS];
75
 
      //int _peak[MAX_CHANNELS];
76
94
      double _meter[MAX_CHANNELS];
77
95
      double _peak[MAX_CHANNELS];
78
96
 
88
106
      Track(TrackType);
89
107
      //Track(const Track&);
90
108
      Track(const Track&, bool cloneParts);
91
 
      virtual ~Track() {};
 
109
      virtual ~Track();
92
110
      virtual Track& operator=(const Track& t);
93
111
      
94
112
      static const char* _cname[];
129
147
      bool noInRoute() const   { return _inRoutes.empty();  }
130
148
      bool noOutRoute() const  { return _outRoutes.empty(); }
131
149
      void writeRouting(int, Xml&) const;
132
 
 
 
150
      bool isCircularRoute(Track* dst);   
 
151
      int auxRefCount() const { return _auxRouteCount; }  // Number of Aux Tracks with routing paths to this track. 
 
152
      void updateAuxRoute(int refInc, Track* dst);  // Internal use. 
 
153
      
133
154
      PartList* parts()               { return &_parts; }
134
155
      const PartList* cparts() const  { return &_parts; }
135
156
      Part* findPart(unsigned tick);
150
171
 
151
172
      virtual void setMute(bool val);
152
173
      virtual void setOff(bool val);
153
 
      virtual void updateSoloStates(bool noDec) = 0;
154
 
      virtual void updateInternalSoloStates();
155
 
      void updateSoloState();
156
174
      void setInternalSolo(unsigned int val);
157
 
      static void clearSoloRefCounts();
158
175
      virtual void setSolo(bool val) = 0;
159
176
      virtual bool isMute() const = 0;
160
 
      
161
177
      unsigned int internalSolo() const  { return _internalSolo; }
162
178
      bool soloMode() const              { return _soloRefCnt; }
163
179
      bool solo() const                  { return _solo;         }
164
180
      bool mute() const                  { return _mute;         }
165
181
      bool off() const                   { return _off;          }
166
182
      bool recordFlag() const            { return _recordFlag;   }
 
183
      //
 
184
      // Internal use...
 
185
      static void clearSoloRefCounts();
 
186
      void updateSoloState();
 
187
      virtual void updateSoloStates(bool noDec) = 0;  
 
188
      virtual void updateInternalSoloStates();        
167
189
 
168
190
      int activity()                     { return _activity;     }
169
191
      void setActivity(int v)            { _activity = v;        }
172
194
      void addActivity(int v)            { _activity += v;       }
173
195
      void resetPeaks();
174
196
      static void resetAllMeter();
175
 
      //int meter(int ch) const  { return _meter[ch]; }
176
 
      //int peak(int ch) const   { return _peak[ch]; }
177
197
      double meter(int ch) const  { return _meter[ch]; }
178
198
      double peak(int ch) const   { return _peak[ch]; }
179
199
      void resetMeter();
187
207
      virtual AutomationType automationType() const    = 0;
188
208
      virtual void setAutomationType(AutomationType t) = 0;
189
209
      static void setVisible(bool ) { }
 
210
      bool isVisible();
190
211
 
191
212
      };
192
213
 
201
222
      int _outPort;
202
223
      int _outChannel;
203
224
      //int _inPortMask;        
204
 
      ///unsigned int _inPortMask; // bitmask of accepted record ports
205
 
      ///int _inChannelMask;     // bitmask of accepted record channels
206
 
      bool _recEcho;          // For midi (and audio). Whether to echo incoming record events to output device.
 
225
      //unsigned int _inPortMask; // bitmask of accepted record ports
 
226
      //int _inChannelMask;       // bitmask of accepted record channels
 
227
      bool _recEcho;              // For midi (and audio). Whether to echo incoming record events to output device.
207
228
 
208
229
      EventList* _events;     // tmp Events during midi import
209
230
      MPEventList* _mpevents; // tmp Events druring recording
210
231
      static bool _isVisible;
 
232
      clefTypes clefType;
211
233
 
212
234
   public:
213
235
      MidiTrack();
250
272
      void setOutPortAndChannelAndUpdate(int /*port*/, int /*chan*/);
251
273
      
252
274
      //void setInPortMask(int i)       { _inPortMask = i; }
253
 
      ///void setInPortMask(unsigned int i) { _inPortMask = i; }  // Obsolete
254
 
      ///void setInChannelMask(int i)    { _inChannelMask = i; }  //
 
275
      //void setInPortMask(unsigned int i) { _inPortMask = i; }  // Obsolete
 
276
      //void setInChannelMask(int i)    { _inChannelMask = i; }  //
255
277
      // Backward compatibility: For reading old songs.
256
278
      void setInPortAndChannelMask(unsigned int /*portmask*/, int /*chanmask*/); 
257
279
      
258
280
      void setRecEcho(bool b)         { _recEcho = b; }
259
281
      int outPort() const             { return _outPort;     }
260
282
      //int inPortMask() const          { return _inPortMask;  }
261
 
      ///unsigned int inPortMask() const { return _inPortMask;  }
 
283
      //unsigned int inPortMask() const { return _inPortMask;  }
262
284
      int outChannel() const          { return _outChannel;  }
263
 
      ///int inChannelMask() const       { return _inChannelMask; }
 
285
      //int inChannelMask() const       { return _inChannelMask; }
264
286
      bool recEcho() const            { return _recEcho; }
265
287
 
266
288
      virtual bool isMute() const;
273
295
      virtual bool canRecord() const  { return true; }
274
296
      static void setVisible(bool t) { _isVisible = t; }
275
297
      static bool visible() { return _isVisible; }
 
298
 
 
299
      void setClef(clefTypes i) { clefType = i; }
 
300
      clefTypes getClef() { return clefType; }
276
301
      };
277
302
 
278
303
//---------------------------------------------------------
279
304
//   AudioTrack
280
305
//    this track can hold audio automation data and can
281
 
//    hold tracktypes AUDIO, AUDIO_MASTER, AUDIO_GROUP,
 
306
//    hold tracktypes WAVE, AUDIO_GROUP, AUDIO_OUTPUT,
282
307
//    AUDIO_INPUT, AUDIO_SOFTSYNTH, AUDIO_AUX
283
308
//---------------------------------------------------------
284
309
 
286
311
      //friend class MidiTrack;
287
312
      //static unsigned int _soloRefCnt;
288
313
      
289
 
      bool _haveData;
 
314
      bool _haveData; // Whether we have data from a previous process call during current cycle.
290
315
      
291
316
      CtrlListList _controller;
292
317
      CtrlRecList _recEvents;     // recorded automation events
293
318
 
294
319
      bool _prefader;               // prefader metering
295
320
      std::vector<double> _auxSend;
296
 
      Pipeline* _efxPipe;
297
 
 
298
 
      AutomationType _automationType;
299
 
 
300
 
      //RouteList _inRoutes;
301
 
      //RouteList _outRoutes;
302
 
      
303
 
      bool _sendMetronome;
304
 
      
305
321
      //void readRecfile(Xml& xml);
306
322
      void readAuxSend(Xml& xml);
307
 
 
 
323
      
 
324
      bool _sendMetronome;
 
325
      AutomationType _automationType;
 
326
      Pipeline* _efxPipe;
308
327
 
309
328
   protected:
310
329
      float** outBuffers;
317
336
      SndFile* _recFile;
318
337
      Fifo fifo;                    // fifo -> _recFile
319
338
      bool _processed;
320
 
 
 
339
      
321
340
   public:
322
341
      AudioTrack(TrackType t);
323
342
      //AudioTrack(TrackType t, int num_out_bufs = MAX_CHANNELS); 
397
416
      void readVolume(Xml& xml);
398
417
      //void writeRouting(int, Xml&) const;
399
418
 
400
 
      // routing
401
 
      //RouteList* inRoutes()    { return &_inRoutes; }
402
 
      //RouteList* outRoutes()   { return &_outRoutes; }
403
 
      //bool noInRoute() const   { return _inRoutes.empty();  }
404
 
      //bool noOutRoute() const  { return _outRoutes.empty(); }
405
 
 
406
419
      virtual void preProcessAlways() { _processed = false; }
407
420
      virtual void  addData(unsigned /*samplePos*/, int /*channels*/, int /*srcStartChan*/, int /*srcChannels*/, unsigned /*frames*/, float** /*buffer*/);
408
421
      virtual void copyData(unsigned /*samplePos*/, int /*channels*/, int /*srcStartChan*/, int /*srcChannels*/, unsigned /*frames*/, float** /*buffer*/);
423
436
      void eraseACEvent(int, int);
424
437
      void eraseRangeACEvents(int, int, int);
425
438
      void addACEvent(int, int, double);
 
439
      void changeACEvent(int id, int frame, int newframe, double newval);
426
440
      };
427
441
 
428
442
//---------------------------------------------------------
536
550
      static bool visible() { return _isVisible; }
537
551
    };
538
552
 
 
553
 
539
554
//---------------------------------------------------------
540
555
//   WaveTrack
541
556
//---------------------------------------------------------
704
719
extern void addPortCtrlEvents(MidiTrack* t);
705
720
extern void removePortCtrlEvents(MidiTrack* t);
706
721
 
 
722
} // namespace MusECore
 
723
 
707
724
#endif
708
725