kwave  18.07.70
Signal.h
Go to the documentation of this file.
1 /***************************************************************************
2  Signal.h - representation of a Kwave signal with multiple tracks
3  -------------------
4  begin : Sat Feb 03 2001
5  copyright : (C) 2001 by Thomas Eschenbacher
6  email : Thomas.Eschenbacher@gmx.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 #ifndef SIGNAL_H
18 #define SIGNAL_H
19 
20 #define PROGRESS_SIZE (512 * 3 * 5)
21 
22 #include "config.h"
23 #include <limits.h>
24 #include <pthread.h>
25 
26 #include <QtGlobal>
27 #include <QList>
28 #include <QReadWriteLock>
29 #include <QUuid>
30 
31 #include "libkwave/InsertMode.h"
32 #include "libkwave/ReaderMode.h"
33 #include "libkwave/Sample.h"
34 #include "libkwave/Stripe.h"
36 
37 //**********************************************************************
38 namespace Kwave
39 {
40 
41  class MultiTrackReader;
42  class SampleReader;
43  class Track;
44  class Writer;
45 
46  class Q_DECL_EXPORT Signal: public QObject
47  {
48  Q_OBJECT
49 
50  public:
51 
56  Signal();
57 
63  Signal(unsigned int tracks, sample_index_t length);
64 
68  virtual ~Signal();
69 
73  void close();
74 
85  Kwave::Track *insertTrack(unsigned int index,
86  sample_index_t length,
87  QUuid *uuid);
88 
96  Kwave::Track *appendTrack(sample_index_t length,
97  QUuid *uuid);
98 
103  void deleteTrack(unsigned int index);
104 
108  QList<unsigned int> allTracks();
109 
121  Kwave::Writer *openWriter(Kwave::InsertMode mode,
122  unsigned int track,
123  sample_index_t left = 0,
124  sample_index_t right = 0);
125 
135  Kwave::SampleReader *openReader(Kwave::ReaderMode mode,
136  unsigned int track,
137  sample_index_t left = 0,
139 
148  Kwave::Stripe::List stripes(unsigned int track,
149  sample_index_t left = 0,
151 
158  bool mergeStripes(const Kwave::Stripe::List &stripes,
159  unsigned int track);
160 
164  unsigned int tracks();
165 
172  void deleteRange(unsigned int track,
173  sample_index_t offset,
174  sample_index_t length);
175 
182  void insertSpace(unsigned int track,
183  sample_index_t offset,
184  sample_index_t length);
185 
190  sample_index_t length();
191 
196  bool trackSelected(unsigned int track);
197 
204  void selectTrack(unsigned int track, bool select);
205 
212  QUuid uuidOfTrack(unsigned int track);
213 
214  signals:
215 
221  void sigTrackInserted(unsigned int index, Kwave::Track *track);
222 
228  void sigTrackDeleted(unsigned int index, Kwave::Track *track);
229 
234  void sigTrackSelectionChanged(bool enabled);
235 
245  void sigSamplesInserted(unsigned int track, sample_index_t offset,
246  sample_index_t length);
247 
254  void sigSamplesDeleted(unsigned int track, sample_index_t offset,
255  sample_index_t length);
256 
263  void sigSamplesModified(unsigned int track, sample_index_t offset,
264  sample_index_t length);
265 
266  private slots:
267 
276  void slotSamplesInserted(Kwave::Track *src, sample_index_t offset,
277  sample_index_t length);
278 
287  void slotSamplesDeleted(Kwave::Track *src, sample_index_t offset,
288  sample_index_t length);
289 
298  void slotSamplesModified(Kwave::Track *src, sample_index_t offset,
299  sample_index_t length);
300 
301  private:
302 
308  unsigned int trackIndex(const Kwave::Track *track);
309 
310  private:
311 
313  QList<Kwave::Track *> m_tracks;
314 
316  QReadWriteLock m_lock_tracks;
317 
318  };
319 }
320 
321 #endif /* SIGNAL_H */
322 
323 //***************************************************************************
324 //***************************************************************************
Definition: App.h:33
ReaderMode
Definition: ReaderMode.h:27
quint64 sample_index_t
Definition: Sample.h:28
QList< Kwave::Track * > m_tracks
Definition: Signal.h:313
QReadWriteLock m_lock_tracks
Definition: Signal.h:316
InsertMode
Definition: InsertMode.h:26
#define SAMPLE_INDEX_MAX
Definition: Sample.h:31