00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef AUDIOBUS_H
00025 #define AUDIOBUS_H
00026
00027 #include <QObject>
00028 #include <QList>
00029 #include <QString>
00030 #include "defines.h"
00031 #include "AudioChannel.h"
00032
00033 class AudioBus : public QObject
00034 {
00035 Q_OBJECT
00036
00037 public:
00038 AudioBus(const QString& name);
00039 AudioBus(const QString& name, int channelCount);
00040 ~AudioBus();
00041
00042 void add_channel(AudioChannel* chan);
00043 int get_channel_count()
00044 {
00045 return channelCount;
00046 }
00047
00048 QString get_name()
00049 {
00050 return m_name;
00051 }
00052
00053 AudioChannel* get_channel(int channelNumber);
00054
00061 audio_sample_t* get_buffer(int channel, nframes_t nframes)
00062 {
00063 return channels.at(channel)->get_buffer(nframes);
00064 }
00065
00066 void set_buffer_size(nframes_t size);
00067 void set_monitor_peaks(bool monitor);
00068 void reset_monitor_peaks();
00069 bool is_monitoring_peaks() const {return m_monitors;}
00070
00071 void monitor_peaks()
00072 {
00073 for (int i=0; i<channels.size(); ++i) {
00074 channels.at(i)->monitor_peaks();
00075 }
00076 }
00077
00082 void silence_buffers(nframes_t nframes)
00083 {
00084 for (int i=0; i<channels.size(); ++i) {
00085 channels.at(i)->silence_buffer(nframes);
00086 }
00087 }
00088
00089
00090 private:
00091 QList<AudioChannel* > channels;
00092 QString deviceName;
00093 QString m_name;
00094
00095 int channelCount;
00096 int m_monitors;
00097
00098 void init(const QString& name);
00099
00100 public slots:
00101 void resize_buffer();
00102
00103 signals:
00104 void monitoringPeaksStarted();
00105 void monitoringPeaksStopped();
00106
00107 };
00108
00109
00115 inline AudioChannel * AudioBus::get_channel( int channelNumber )
00116 {
00117 return channels.at(channelNumber);
00118 }
00119
00120
00121 #endif
00122
00123