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.
sdrbase
audio
audiofifo.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_AUDIOFIFO_H
20
#define INCLUDE_AUDIOFIFO_H
21
22
#include <QObject>
23
#include <QMutex>
24
#include <QWaitCondition>
25
26
#include "
dsp/dsptypes.h
"
27
#include "
export.h
"
28
29
class
SDRBASE_API
AudioFifo
:
public
QObject {
30
Q_OBJECT
31
public
:
32
AudioFifo
();
33
AudioFifo
(
uint32_t
numSamples);
34
~
AudioFifo
();
35
36
bool
setSize(
uint32_t
numSamples);
37
38
uint32_t
write(
const
quint8* data,
uint32_t
numSamples);
39
uint32_t
read(quint8* data,
uint32_t
numSamples);
40
41
uint32_t
drain(
uint32_t
numSamples);
42
void
clear();
43
44
inline
uint32_t
flush
() {
return
drain(m_fill); }
45
inline
uint32_t
fill
()
const
{
return
m_fill; }
46
inline
bool
isEmpty
()
const
{
return
m_fill == 0; }
47
inline
bool
isFull
()
const
{
return
m_fill == m_size; }
48
inline
uint32_t
size
()
const
{
return
m_size; }
49
50
private
:
51
QMutex
m_mutex
;
52
53
qint8*
m_fifo
;
54
55
const
uint32_t
m_sampleSize
;
56
57
uint32_t
m_size
;
58
uint32_t
m_fill
;
59
uint32_t
m_head
;
60
uint32_t
m_tail
;
61
62
bool
create
(
uint32_t
numSamples);
63
};
64
65
#endif // INCLUDE_AUDIOFIFO_H
AudioFifo::m_mutex
QMutex m_mutex
Definition:
audiofifo.h:51
AudioFifo::m_tail
uint32_t m_tail
Definition:
audiofifo.h:60
AudioFifo::size
uint32_t size() const
Definition:
audiofifo.h:48
export.h
AudioFifo::flush
uint32_t flush()
Definition:
audiofifo.h:44
AudioFifo::m_fill
uint32_t m_fill
Definition:
audiofifo.h:58
AudioFifo::m_size
uint32_t m_size
Definition:
audiofifo.h:57
uint32_t
unsigned int uint32_t
Definition:
rtptypes_win.h:46
dsptypes.h
AudioFifo::m_fifo
qint8 * m_fifo
Definition:
audiofifo.h:53
SWGSDRangel::create
void * create(QString type)
Definition:
SWGModelFactory.h:166
AudioFifo
Definition:
audiofifo.h:29
AudioFifo::m_head
uint32_t m_head
Definition:
audiofifo.h:59
AudioFifo::m_sampleSize
const uint32_t m_sampleSize
Definition:
audiofifo.h:55
AudioFifo::isEmpty
bool isEmpty() const
Definition:
audiofifo.h:46
AudioFifo::isFull
bool isFull() const
Definition:
audiofifo.h:47
SDRBASE_API
#define SDRBASE_API
Definition:
export.h:40
AudioFifo::fill
uint32_t fill() const
Definition:
audiofifo.h:45
Generated on Fri Aug 2 2019 17:56:33 for SDRAngel by
1.8.13