SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
audiooutput.h
Go to the documentation of this file.
1 // Copyright (C) 2012 maintech GmbH, Otto-Hahn-Str. 15, 97204 Hoechberg, Germany //
3 // written by Christian Daniel //
4 // //
5 // This program is free software; you can redistribute it and/or modify //
6 // it under the terms of the GNU General Public License as published by //
7 // the Free Software Foundation as version 3 of the License, or //
8 // (at your option) any later version. //
9 // //
10 // This program is distributed in the hope that it will be useful, //
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
13 // GNU General Public License V3 for more details. //
14 // //
15 // You should have received a copy of the GNU General Public License //
16 // along with this program. If not, see <http://www.gnu.org/licenses/>. //
18 
19 #ifndef INCLUDE_AUDIOOUTPUT_H
20 #define INCLUDE_AUDIOOUTPUT_H
21 
22 #include <QMutex>
23 #include <QIODevice>
24 #include <QAudioFormat>
25 #include <list>
26 #include <vector>
27 #include <stdint.h>
28 #include "export.h"
29 
30 class QAudioOutput;
31 class AudioFifo;
32 class AudioOutputPipe;
33 class AudioNetSink;
34 
35 class SDRBASE_API AudioOutput : QIODevice {
36 public:
38  {
42  UDPChannelStereo
43  };
44 
46  {
52  UDPCodecOpus
53  };
54 
55  AudioOutput();
56  virtual ~AudioOutput();
57 
58  bool start(int device, int rate);
59  void stop();
60 
61  void addFifo(AudioFifo* audioFifo);
62  void removeFifo(AudioFifo* audioFifo);
63  int getNbFifos() const { return m_audioFifos.size(); }
64 
65  unsigned int getRate() const { return m_audioFormat.sampleRate(); }
66  void setOnExit(bool onExit) { m_onExit = onExit; }
67 
68  void setUdpDestination(const QString& address, uint16_t port);
69  void setUdpCopyToUDP(bool copyToUDP);
70  void setUdpUseRTP(bool useRTP);
71  void setUdpChannelMode(UDPChannelMode udpChannelMode);
72  void setUdpChannelFormat(UDPChannelCodec udpChannelCodec, bool stereo, int sampleRate);
73  void setUdpDecimation(uint32_t decimation);
74 
75 private:
76  QMutex m_mutex;
77  QAudioOutput* m_audioOutput;
83  bool m_onExit;
84 
85  std::list<AudioFifo*> m_audioFifos;
86  std::vector<qint32> m_mixBuffer;
87 
88  QAudioFormat m_audioFormat;
89 
90  //virtual bool open(OpenMode mode);
91  virtual qint64 readData(char* data, qint64 maxLen);
92  virtual qint64 writeData(const char* data, qint64 len);
93 
94  friend class AudioOutputPipe;
95 };
96 
97 #endif // INCLUDE_AUDIOOUTPUT_H
QAudioFormat m_audioFormat
Definition: audiooutput.h:88
bool m_copyAudioToUdp
Definition: audiooutput.h:79
int decimation(float Fin, float Fout)
Definition: datvdemod.h:66
unsigned int getRate() const
Definition: audiooutput.h:65
QAudioOutput * m_audioOutput
Definition: audiooutput.h:77
std::list< AudioFifo * > m_audioFifos
Definition: audiooutput.h:85
AudioNetSink * m_audioNetSink
Definition: audiooutput.h:78
std::vector< qint32 > m_mixBuffer
Definition: audiooutput.h:86
void setOnExit(bool onExit)
Definition: audiooutput.h:66
unsigned int uint32_t
Definition: rtptypes_win.h:46
QMutex m_mutex
Definition: audiooutput.h:76
unsigned short uint16_t
Definition: rtptypes_win.h:44
uint m_audioUsageCount
Definition: audiooutput.h:82
bool m_onExit
Definition: audiooutput.h:83
Linear 16 bit (no codec)
Definition: audiooutput.h:47
UDPChannelCodec m_udpChannelCodec
Definition: audiooutput.h:81
G722 compression.
Definition: audiooutput.h:51
Linear 8 bit.
Definition: audiooutput.h:48
PCM A-law 8 bit.
Definition: audiooutput.h:49
UDPChannelMode m_udpChannelMode
Definition: audiooutput.h:80
#define SDRBASE_API
Definition: export.h:40
PCM Mu-law 8 bit.
Definition: audiooutput.h:50
int getNbFifos() const
Definition: audiooutput.h:63