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
qqnxaudiosource_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 QNXAUDIOINPUT_H
5#define QNXAUDIOINPUT_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 <QSocketNotifier>
23#include <QIODevice>
24#include <QElapsedTimer>
25#include <QTimer>
26
27#include <sys/asoundlib.h>
28
30
32{
34
35public:
36 explicit QQnxAudioSource(const QAudioDevice &deviceInfo, QObject *parent);
38
39 void start(QIODevice*) override;
40 QIODevice* start() override;
41 void stop() override;
42 void reset() override;
43 void suspend() override;
44 void resume() override;
45 qsizetype bytesReady() const override;
46 void setBufferSize(qsizetype ) override;
47 qsizetype bufferSize() const override;
48 qint64 processedUSecs() const override;
49 QAudio::Error error() const override;
50 QAudio::State state() const override;
51 void setFormat(const QAudioFormat&) override;
52 QAudioFormat format() const override;
53 void setVolume(qreal) override;
54 qreal volume() const override;
55
56private slots:
57 void userFeed();
58 bool deviceReady();
59
60private:
61 friend class InputPrivate;
62
63 bool open();
64 void close();
65 qint64 read(char *data, qint64 len);
66 void changeState(QAudio::State state, QAudio::Error error);
67
68 QAudioFormat m_format;
69
70 QIODevice *m_audioSource;
72 QSocketNotifier *m_pcmNotifier;
73
74 QAudio::Error m_error;
75 QAudio::State m_state;
76
77 qint64 m_bytesRead;
78 qint64 m_elapsedTimeOffset;
79 qint64 m_totalTimeValue;
80
81 qreal m_volume;
82
83 int m_bytesAvailable;
84 int m_bufferSize;
85 int m_periodSize;
86
87 QAudioDevice m_deviceInfo;
88
89 bool m_pullMode;
90};
91
92class InputPrivate : public QIODevice
93{
95public:
97
98 qint64 readData(char *data, qint64 len) override;
99 qint64 writeData(const char *data, qint64 len) override;
100
101 qint64 bytesAvailable() const override;
102
103 bool isSequential() const override;
104
105 void trigger();
106
107private:
108 QQnxAudioSource *m_audioDevice;
109};
110
112
113#endif
bool isSequential() const override
Returns true if this device is sequential; otherwise returns false.
qint64 writeData(const char *data, qint64 len) override
Writes up to maxSize bytes from data to the device.
InputPrivate(QQnxAudioSource *audio)
qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
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
void suspend() override
qsizetype bytesReady() const override
QAudio::State state() const override
void setFormat(const QAudioFormat &) override
QAudio::Error error() const override
void setVolume(qreal) override
QIODevice * start() override
QQnxAudioSource(const QAudioDevice &deviceInfo, QObject *parent)
void resume() override
void setBufferSize(qsizetype) override
QAudioFormat format() const override
void stop() override
qsizetype bufferSize() const override
qreal volume() const override
void reset() override
qint64 processedUSecs() const override
\inmodule QtCore
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
GLenum GLsizei len
#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
ReturnedValue read(const char *data)
file open(QIODevice::ReadOnly)
QByteArray readData()