kwave  18.07.70
ChannelMixer.h
Go to the documentation of this file.
1 /*************************************************************************
2  ChannelMixer.h - matrix based mixer for multiple channels
3  -------------------
4  begin : Sun Oct 10 2010
5  copyright : (C) 2010 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 
18 #ifndef CHANNEL_MIXER_H
19 #define CHANNEL_MIXER_H
20 
21 #include "config.h"
22 
23 #include <QObject>
24 #include <QPointer>
25 #include <QQueue>
26 #include <QString>
27 #include <QVector>
28 
29 #include "libkwave/Connect.h"
30 #include "libkwave/SampleSink.h"
31 #include "libkwave/SampleSource.h"
34 
35 //***************************************************************************
36 namespace Kwave
37 {
38 
39  class MixerMatrix;
40 
41  class Q_DECL_EXPORT ChannelMixer: public Kwave::SampleSource
42  {
43  Q_OBJECT
44  public:
50  ChannelMixer(unsigned int inputs, unsigned int outputs);
51 
53  virtual ~ChannelMixer() Q_DECL_OVERRIDE;
54 
61  virtual bool init();
62 
71  virtual unsigned int tracksOfPort(const char *port) const
72  Q_DECL_OVERRIDE;
73 
79  virtual Kwave::StreamObject *port(
80  const char *port, unsigned int track) Q_DECL_OVERRIDE;
81 
83  virtual void goOn() Q_DECL_OVERRIDE
84  {
85  }
86 
87  signals:
88 
90  void output(Kwave::SampleArray data);
91 
92  public slots:
93 
98  void input(Kwave::SampleArray data) { Q_UNUSED(data); }
99 
100  private slots:
101 
103  void idxInput(unsigned int index, Kwave::SampleArray data);
104 
105  private:
106 
108  virtual void mix();
109 
110  private:
111 
114 
116  unsigned int m_inputs;
117 
119  unsigned int m_outputs;
120 
121  QVector< QPointer<Kwave::StreamObject> > m_indexer;
122 
124  QVector< QQueue<Kwave::SampleArray> > m_input_queue;
125 
127  QVector< QPointer<Kwave::SampleBuffer> > m_output_buffer;
128 
130  QMutex m_lock;
131  };
132 
133 
134 }
135 
136 #endif /* CHANNEL_MIXER_H */
137 
138 //***************************************************************************
139 //***************************************************************************
Definition: App.h:33
Kwave::MixerMatrix * m_matrix
Definition: ChannelMixer.h:113
unsigned int m_inputs
Definition: ChannelMixer.h:116
QVector< QPointer< Kwave::StreamObject > > m_indexer
Definition: ChannelMixer.h:121
unsigned int m_outputs
Definition: ChannelMixer.h:119
void input(Kwave::SampleArray data)
Definition: ChannelMixer.h:98
virtual void goOn() Q_DECL_OVERRIDE
Definition: ChannelMixer.h:83
QVector< QPointer< Kwave::SampleBuffer > > m_output_buffer
Definition: ChannelMixer.h:127
QVector< QQueue< Kwave::SampleArray > > m_input_queue
Definition: ChannelMixer.h:124