// Copyright (C) 2016 The Qt Company Ltd. // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only #ifndef QOPENSLESENGINE_H #define QOPENSLESENGINE_H // // W A R N I N G // ------------- // // This file is not part of the Qt API. It exists purely as an // implementation detail. This header file may change from version to // version without notice, or even be removed. // // We mean it. // #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QOpenSLESEngine { public: enum OutputValue { FramesPerBuffer, SampleRate }; QOpenSLESEngine(); ~QOpenSLESEngine(); static QOpenSLESEngine *instance(); SLEngineItf slEngine() const { return m_engine; } static SLAndroidDataFormat_PCM_EX audioFormatToSLFormatPCM(const QAudioFormat &format); static QList availableDevices(QAudioDevice::Mode mode); static bool setAudioOutput(const QByteArray &deviceId); QList supportedChannelCounts(QAudioDevice::Mode mode) const; QList supportedSampleRates(QAudioDevice::Mode mode) const; static int getOutputValue(OutputValue type, int defaultValue = 0); static int getDefaultBufferSize(const QAudioFormat &format); static int getLowLatencyBufferSize(const QAudioFormat &format); static bool supportsLowLatency(); static bool printDebugInfo(); private: void checkSupportedInputFormats(); bool inputFormatIsSupported(SLAndroidDataFormat_PCM_EX format); SLObjectItf m_engineObject; SLEngineItf m_engine; QList m_supportedInputChannelCounts; QList m_supportedInputSampleRates; bool m_checkedInputFormats; }; QT_END_NAMESPACE #endif // QOPENSLESENGINE_H