Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qqnxaudiosink_p.h
Go to the documentation of this file.
1// Copyright (C) 2016 Research In Motion
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QNXAUDIOOUTPUT_H
5#define QNXAUDIOOUTPUT_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include "private/qaudiosystem_p.h"
19
20#include "qqnxaudioutils_p.h"
21
22#include <QElapsedTimer>
23#include <QTimer>
24#include <QIODevice>
25#include <QSocketNotifier>
26
27#include <sys/asoundlib.h>
28#include <sys/neutrino.h>
29
31
32class QnxPushIODevice;
33
35{
37
38public:
39 explicit QQnxAudioSink(const QAudioDevice &deviceInfo, QObject *parent);
41
42 void start(QIODevice *source) override;
43 QIODevice *start() override;
44 void stop() override;
45 void reset() override;
46 void suspend() override;
47 void resume() override;
48 qsizetype bytesFree() const override;
49 void setBufferSize(qsizetype) override;
50 qsizetype bufferSize() const override;
51 qint64 processedUSecs() const override;
52 QAudio::Error error() const override;
53 QAudio::State state() const override;
54 void setFormat(const QAudioFormat &format) override;
55 QAudioFormat format() const override;
56 void setVolume(qreal volume) override;
57 qreal volume() const override;
58 qint64 pushData(const char *data, qint64 len);
59
60private slots:
61 void pullData();
62 void pcmNotifierActivated(int socket);
63
64private:
65 bool open();
66 void close();
67 void changeState(QAudio::State state, QAudio::Error error);
68
69 void addPcmEventFilter();
70 void createPcmNotifiers();
71 void destroyPcmNotifiers();
72
73 void suspendInternal(QAudio::State suspendState);
74 void resumeInternal();
75
76 void updateState();
77
78 qint64 write(const char *data, qint64 len);
79
80 QIODevice *m_source;
81 bool m_pushSource;
82 QTimer *m_timer;
83
84 QAudio::Error m_error;
85 QAudio::State m_state;
86 QAudio::State m_suspendedInState;
87 QAudioFormat m_format;
88 qreal m_volume;
89 int m_periodSize;
90
92 qint64 m_bytesWritten;
93
94 int m_requestedBufferSize;
95
96 QAudioDevice m_deviceInfo;
97
98 QSocketNotifier *m_pcmNotifier;
99};
100
102{
104public:
107
108 qint64 readData(char *data, qint64 len);
109 qint64 writeData(const char *data, qint64 len);
110
111 bool isSequential() const override;
112
113private:
114 QQnxAudioSink *m_output;
115};
116
118
119#endif
The QAudioDevice class provides an information about audio devices and their functionality.
The QAudioFormat class stores audio stream parameter information.
\inmodule QtCore \reentrant
Definition qiodevice.h:34
\inmodule QtCore
Definition qobject.h:103
QObject * parent() const
Returns a pointer to the parent object.
Definition qobject.h:346
QAudio::State state() const override
qint64 pushData(const char *data, qint64 len)
void setBufferSize(qsizetype) override
qreal volume() const override
void reset() override
void setFormat(const QAudioFormat &format) override
qsizetype bufferSize() const override
qsizetype bytesFree() const override
QIODevice * start() override
QQnxAudioSink(const QAudioDevice &deviceInfo, QObject *parent)
QAudioFormat format() const override
void resume() override
void stop() override
void setVolume(qreal volume) override
QAudio::Error error() const override
void suspend() override
qint64 processedUSecs() const override
\inmodule QtCore
\inmodule QtCore
Definition qtimer.h:20
QnxPushIODevice(QQnxAudioSink *output)
qint64 writeData(const char *data, qint64 len)
Writes up to maxSize bytes from data to the device.
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
State
Definition qaudio.h:29
Error
Definition qaudio.h:28
Combined button and popup list for selecting options.
std::unique_ptr< snd_pcm_t, HandleDeleter > HandleUniquePtr
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLsizei GLsizei GLchar * source
GLenum GLsizei len
QAudio::State suspendState(const snd_pcm_event_t &event)
#define Q_OBJECT
#define slots
ptrdiff_t qsizetype
Definition qtypes.h:165
long long qint64
Definition qtypes.h:60
double qreal
Definition qtypes.h:187
QT_BEGIN_NAMESPACE typedef uchar * output
QTcpSocket * socket
[1]
QByteArray readData()