Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
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
21
22#include <QSocketNotifier>
23#include <QIODevice>
24#include <QElapsedTimer>
25#include <QTimer>
26
27#include <sys/asoundlib.h>
28
30
32{
34
35public:
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::State state() const override;
50
51private slots:
52 void userFeed();
53 bool deviceReady();
54
55private:
56 friend class InputPrivate;
57
58 bool open();
59 void close();
60 qint64 read(char *data, qint64 len);
61 void changeState(QAudio::State state, QAudio::Error error);
62
63 QIODevice *m_audioSource;
64 QnxAudioUtils::HandleUniquePtr m_pcmHandle;
65 QSocketNotifier *m_pcmNotifier;
66
67 QAudio::State m_state;
68
69 qint64 m_bytesRead;
70 qint64 m_elapsedTimeOffset;
71 qint64 m_totalTimeValue;
72
73 int m_bytesAvailable;
74 int m_bufferSize;
75 int m_periodSize;
76
77 bool m_pullMode;
78};
79
80class InputPrivate : public QIODevice
81{
83public:
85
86 qint64 readData(char *data, qint64 len) override;
87 qint64 writeData(const char *data, qint64 len) override;
88
89 qint64 bytesAvailable() const override;
90
91 bool isSequential() const override;
92
93 void trigger();
94
95private:
96 QQnxAudioSource *m_audioDevice;
97};
98
99QT_END_NAMESPACE
100
101#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.
qint64 readData(char *data, qint64 len) override
Reads up to maxSize bytes from the device into data, and returns the number of bytes read or -1 if an...
qint64 bytesAvailable() const override
Returns the number of bytes that are available for reading.
\inmodule QtCore
Definition qdir.h:22
QPlatformAudioSink * createAudioSink(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
QList< QAudioDevice > findAudioInputs() const override
QList< QAudioDevice > findAudioOutputs() const override
QPlatformAudioSource * createAudioSource(const QAudioDevice &, const QAudioFormat &, QObject *parent) override
QLatin1String backendName() const override
void suspend() override
qsizetype bytesReady() const override
QAudio::State state() const override
QIODevice * start() override
void resume() override
void setBufferSize(qsizetype) override
void stop() override
qsizetype bufferSize() const override
void reset() override
qint64 processedUSecs() const override
void start(QIODevice *) override
State
Definition qaudio.h:31
Error
Definition qaudio.h:23
std::unique_ptr< snd_pcm_t, HandleDeleter > HandleUniquePtr
static QT_BEGIN_NAMESPACE QList< QAudioDevice > enumeratePcmDevices(QAudioDevice::Mode mode)