Move win32 and Alsa audio backends into plugins.

Change-Id: I9835cf5ee97900569f26421a19543b485e933051
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Christian Strømme
2013-11-23 00:14:15 +01:00
committed by The Qt Project
parent 0ab81ef59f
commit 2d54da2d39
23 changed files with 589 additions and 332 deletions

View File

@@ -39,17 +39,8 @@ SOURCES += \
audio/qaudiodecoder.cpp \
audio/qaudiohelpers.cpp
win32 {
PRIVATE_HEADERS += audio/qaudioinput_win32_p.h audio/qaudiooutput_win32_p.h audio/qaudiodeviceinfo_win32_p.h
SOURCES += audio/qaudiodeviceinfo_win32_p.cpp \
audio/qaudiooutput_win32_p.cpp \
audio/qaudioinput_win32_p.cpp
LIBS_PRIVATE += -lwinmm -lstrmiids -lole32 -loleaut32
}
unix:!mac {
config_pulseaudio {
DEFINES += QT_NO_AUDIO_BACKEND
CONFIG += link_pkgconfig
PKGCONFIG_PRIVATE += libpulse
@@ -61,15 +52,6 @@ unix:!mac {
DEFINES += QT_MULTIMEDIA_QAUDIO
PRIVATE_HEADERS += audio/qsoundeffect_qaudio_p.h
SOURCES += audio/qsoundeffect_qaudio_p.cpp
config_alsa {
DEFINES += HAS_ALSA
PRIVATE_HEADERS += audio/qaudiooutput_alsa_p.h audio/qaudioinput_alsa_p.h audio/qaudiodeviceinfo_alsa_p.h
SOURCES += audio/qaudiodeviceinfo_alsa_p.cpp \
audio/qaudiooutput_alsa_p.cpp \
audio/qaudioinput_alsa_p.cpp
LIBS_PRIVATE += -lasound
}
}
} else {
DEFINES += QT_MULTIMEDIA_QAUDIO

View File

@@ -47,18 +47,6 @@
#include "qmediapluginloader_p.h"
#include "qaudiodevicefactory_p.h"
#ifndef QT_NO_AUDIO_BACKEND
#if defined(Q_OS_WIN)
#include "qaudiodeviceinfo_win32_p.h"
#include "qaudiooutput_win32_p.h"
#include "qaudioinput_win32_p.h"
#elif defined(HAS_ALSA)
#include "qaudiodeviceinfo_alsa_p.h"
#include "qaudiooutput_alsa_p.h"
#include "qaudioinput_alsa_p.h"
#endif
#endif
QT_BEGIN_NAMESPACE
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
@@ -132,13 +120,6 @@ public:
QList<QAudioDeviceInfo> QAudioDeviceFactory::availableDevices(QAudio::Mode mode)
{
QList<QAudioDeviceInfo> devices;
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
foreach (const QByteArray &handle, QAudioDeviceInfoInternal::availableDevices(mode))
devices << QAudioDeviceInfo(QLatin1String("builtin"), handle, mode);
#endif
#endif
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QMediaPluginLoader* l = audioLoader();
foreach (const QString& key, l->keys()) {
@@ -165,11 +146,6 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultInputDevice()
}
#endif
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultInputDevice(), QAudio::AudioInput);
#endif
#endif
return QAudioDeviceInfo();
}
@@ -185,11 +161,6 @@ QAudioDeviceInfo QAudioDeviceFactory::defaultOutputDevice()
}
#endif
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
return QAudioDeviceInfo(QLatin1String("builtin"), QAudioDeviceInfoInternal::defaultOutputDevice(), QAudio::AudioOutput);
#endif
#endif
return QAudioDeviceInfo();
}
@@ -197,13 +168,6 @@ QAbstractAudioDeviceInfo* QAudioDeviceFactory::audioDeviceInfo(const QString &re
{
QAbstractAudioDeviceInfo *rc = 0;
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
if (realm == QLatin1String("builtin"))
return new QAudioDeviceInfoInternal(handle, mode);
#endif
#endif
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QAudioSystemFactoryInterface* plugin =
qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(realm));
@@ -229,15 +193,7 @@ QAbstractAudioInput* QAudioDeviceFactory::createInputDevice(QAudioDeviceInfo con
{
if (deviceInfo.isNull())
return new QNullInputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioInput* p = new QAudioInputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);
return p;
}
#endif
#endif
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QAudioSystemFactoryInterface* plugin =
qobject_cast<QAudioSystemFactoryInterface*>(audioLoader()->instance(deviceInfo.realm()));
@@ -256,15 +212,6 @@ QAbstractAudioOutput* QAudioDeviceFactory::createOutputDevice(QAudioDeviceInfo c
{
if (deviceInfo.isNull())
return new QNullOutputDevice();
#ifndef QT_NO_AUDIO_BACKEND
#if (defined(Q_OS_WIN) || defined(HAS_ALSA))
if (deviceInfo.realm() == QLatin1String("builtin")) {
QAbstractAudioOutput* p = new QAudioOutputPrivate(deviceInfo.handle());
if (p) p->setFormat(format);
return p;
}
#endif
#endif
#if !defined (QT_NO_LIBRARY) && !defined(QT_NO_SETTINGS)
QAudioSystemFactoryInterface* plugin =

View File

@@ -0,0 +1,3 @@
{
"Keys": ["alsa"]
}

23
src/plugins/alsa/alsa.pro Normal file
View File

@@ -0,0 +1,23 @@
TARGET = qtaudio_alsa
QT += multimedia-private
PLUGIN_TYPE = audio
PLUGIN_CLASS_NAME = QAlsaPlugin
load(qt_plugin)
LIBS += -lasound
HEADERS += \
qalsaplugin.h \
qalsaaudiodeviceinfo.h \
qalsaaudioinput.h \
qalsaaudiooutput.h
SOURCES += \
qalsaplugin.cpp \
qalsaaudiodeviceinfo.cpp \
qalsaaudioinput.cpp \
qalsaaudiooutput.cpp
OTHER_FILES += \
alsa.json

View File

@@ -50,13 +50,13 @@
// INTERNAL USE ONLY: Do NOT use for any other purpose.
//
#include "qaudiodeviceinfo_alsa_p.h"
#include "qalsaaudiodeviceinfo.h"
#include <alsa/version.h>
QT_BEGIN_NAMESPACE
QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
QAlsaAudioDeviceInfo::QAlsaAudioDeviceInfo(QByteArray dev, QAudio::Mode mode)
{
handle = 0;
@@ -66,17 +66,17 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode
checkSurround();
}
QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal()
QAlsaAudioDeviceInfo::~QAlsaAudioDeviceInfo()
{
close();
}
bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const
bool QAlsaAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const
{
return testSettings(format);
}
QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
QAudioFormat QAlsaAudioDeviceInfo::preferredFormat() const
{
QAudioFormat nearest;
if(mode == QAudio::AudioOutput) {
@@ -101,48 +101,48 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
return nearest;
}
QString QAudioDeviceInfoInternal::deviceName() const
QString QAlsaAudioDeviceInfo::deviceName() const
{
return device;
}
QStringList QAudioDeviceInfoInternal::supportedCodecs()
QStringList QAlsaAudioDeviceInfo::supportedCodecs()
{
updateLists();
return codecz;
}
QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
QList<int> QAlsaAudioDeviceInfo::supportedSampleRates()
{
updateLists();
return sampleRatez;
}
QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
QList<int> QAlsaAudioDeviceInfo::supportedChannelCounts()
{
updateLists();
return channelz;
}
QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
QList<int> QAlsaAudioDeviceInfo::supportedSampleSizes()
{
updateLists();
return sizez;
}
QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
QList<QAudioFormat::Endian> QAlsaAudioDeviceInfo::supportedByteOrders()
{
updateLists();
return byteOrderz;
}
QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
QList<QAudioFormat::SampleType> QAlsaAudioDeviceInfo::supportedSampleTypes()
{
updateLists();
return typez;
}
bool QAudioDeviceInfoInternal::open()
bool QAlsaAudioDeviceInfo::open()
{
int err = 0;
QString dev = device;
@@ -186,14 +186,14 @@ bool QAudioDeviceInfoInternal::open()
return true;
}
void QAudioDeviceInfoInternal::close()
void QAlsaAudioDeviceInfo::close()
{
if(handle)
snd_pcm_close(handle);
handle = 0;
}
bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
bool QAlsaAudioDeviceInfo::testSettings(const QAudioFormat& format) const
{
// Set nearest to closest settings that do work.
// See if what is in settings will work (return value).
@@ -301,7 +301,7 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
return (err == 0);
}
void QAudioDeviceInfoInternal::updateLists()
void QAlsaAudioDeviceInfo::updateLists()
{
// redo all lists based on current settings
sampleRatez.clear();
@@ -338,7 +338,7 @@ void QAudioDeviceInfoInternal::updateLists()
close();
}
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
QList<QByteArray> QAlsaAudioDeviceInfo::availableDevices(QAudio::Mode mode)
{
QList<QByteArray> devices;
QByteArray filter;
@@ -400,7 +400,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
return devices;
}
QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
QByteArray QAlsaAudioDeviceInfo::defaultInputDevice()
{
QList<QByteArray> devices = availableDevices(QAudio::AudioInput);
if(devices.size() == 0)
@@ -409,7 +409,7 @@ QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
return devices.first();
}
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
QByteArray QAlsaAudioDeviceInfo::defaultOutputDevice()
{
QList<QByteArray> devices = availableDevices(QAudio::AudioOutput);
if(devices.size() == 0)
@@ -418,7 +418,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
return devices.first();
}
void QAudioDeviceInfoInternal::checkSurround()
void QAlsaAudioDeviceInfo::checkSurround()
{
surround40 = false;
surround51 = false;

View File

@@ -51,8 +51,8 @@
//
#ifndef QAUDIODEVICEINFOALSA_H
#define QAUDIODEVICEINFOALSA_H
#ifndef QALSAAUDIODEVICEINFO_H
#define QALSAAUDIODEVICEINFO_H
#include <alsa/asoundlib.h>
@@ -61,9 +61,9 @@
#include <QtCore/qlist.h>
#include <QtCore/qdebug.h>
#include "qaudio.h"
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
QT_BEGIN_NAMESPACE
@@ -72,12 +72,12 @@ const unsigned int MAX_SAMPLE_RATES = 5;
const unsigned int SAMPLE_RATES[] =
{ 8000, 11025, 22050, 44100, 48000 };
class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
class QAlsaAudioDeviceInfo : public QAbstractAudioDeviceInfo
{
Q_OBJECT
public:
QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode);
~QAudioDeviceInfoInternal();
QAlsaAudioDeviceInfo(QByteArray dev,QAudio::Mode mode);
~QAlsaAudioDeviceInfo();
bool testSettings(const QAudioFormat& format) const;
void updateLists();
@@ -119,5 +119,4 @@ private:
QT_END_NAMESPACE
#endif
#endif // QALSAAUDIODEVICEINFO_H

View File

@@ -51,15 +51,15 @@
//
#include <QtCore/qcoreapplication.h>
#include "qaudioinput_alsa_p.h"
#include "qaudiodeviceinfo_alsa_p.h"
#include "qaudiohelpers_p.h"
#include <QtMultimedia/private/qaudiohelpers_p.h>
#include "qalsaaudioinput.h"
#include "qalsaaudiodeviceinfo.h"
QT_BEGIN_NAMESPACE
//#define DEBUG_AUDIO 1
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
QAlsaAudioInput::QAlsaAudioInput(const QByteArray &device)
{
bytesAvailable = 0;
handle = 0;
@@ -86,7 +86,7 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
}
QAudioInputPrivate::~QAudioInputPrivate()
QAlsaAudioInput::~QAlsaAudioInput()
{
close();
disconnect(timer, SIGNAL(timeout()));
@@ -94,38 +94,38 @@ QAudioInputPrivate::~QAudioInputPrivate()
delete timer;
}
void QAudioInputPrivate::setVolume(qreal vol)
void QAlsaAudioInput::setVolume(qreal vol)
{
m_volume = vol;
}
qreal QAudioInputPrivate::volume() const
qreal QAlsaAudioInput::volume() const
{
return m_volume;
}
QAudio::Error QAudioInputPrivate::error() const
QAudio::Error QAlsaAudioInput::error() const
{
return errorState;
}
QAudio::State QAudioInputPrivate::state() const
QAudio::State QAlsaAudioInput::state() const
{
return deviceState;
}
void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
void QAlsaAudioInput::setFormat(const QAudioFormat& fmt)
{
if (deviceState == QAudio::StoppedState)
settings = fmt;
}
QAudioFormat QAudioInputPrivate::format() const
QAudioFormat QAlsaAudioInput::format() const
{
return settings;
}
int QAudioInputPrivate::xrun_recovery(int err)
int QAlsaAudioInput::xrun_recovery(int err)
{
int count = 0;
bool reset = false;
@@ -166,7 +166,7 @@ int QAudioInputPrivate::xrun_recovery(int err)
return err;
}
int QAudioInputPrivate::setFormat()
int QAlsaAudioInput::setFormat()
{
snd_pcm_format_t format = SND_PCM_FORMAT_UNKNOWN;
@@ -225,7 +225,7 @@ int QAudioInputPrivate::setFormat()
: -1;
}
void QAudioInputPrivate::start(QIODevice* device)
void QAlsaAudioInput::start(QIODevice* device)
{
if(deviceState != QAudio::StoppedState)
close();
@@ -244,7 +244,7 @@ void QAudioInputPrivate::start(QIODevice* device)
emit stateChanged(deviceState);
}
QIODevice* QAudioInputPrivate::start()
QIODevice* QAlsaAudioInput::start()
{
if(deviceState != QAudio::StoppedState)
close();
@@ -266,7 +266,7 @@ QIODevice* QAudioInputPrivate::start()
return audioSource;
}
void QAudioInputPrivate::stop()
void QAlsaAudioInput::stop()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -277,7 +277,7 @@ void QAudioInputPrivate::stop()
emit stateChanged(deviceState);
}
bool QAudioInputPrivate::open()
bool QAlsaAudioInput::open()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -310,7 +310,7 @@ bool QAudioInputPrivate::open()
QString dev = QString(QLatin1String(m_device.constData()));
QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioInput);
QList<QByteArray> devices = QAlsaAudioDeviceInfo::availableDevices(QAudio::AudioInput);
if(dev.compare(QLatin1String("default")) == 0) {
#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
if (devices.size() > 0)
@@ -472,7 +472,7 @@ bool QAudioInputPrivate::open()
return true;
}
void QAudioInputPrivate::close()
void QAlsaAudioInput::close()
{
timer->stop();
@@ -483,7 +483,7 @@ void QAudioInputPrivate::close()
}
}
int QAudioInputPrivate::checkBytesReady()
int QAlsaAudioInput::checkBytesReady()
{
if(resuming)
bytesAvailable = period_size;
@@ -503,12 +503,12 @@ int QAudioInputPrivate::checkBytesReady()
return bytesAvailable;
}
int QAudioInputPrivate::bytesReady() const
int QAlsaAudioInput::bytesReady() const
{
return qMax(bytesAvailable, 0);
}
qint64 QAudioInputPrivate::read(char* data, qint64 len)
qint64 QAlsaAudioInput::read(char* data, qint64 len)
{
// Read in some audio data and write it to QIODevice, pull mode
if ( !handle )
@@ -649,7 +649,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
return 0;
}
void QAudioInputPrivate::resume()
void QAlsaAudioInput::resume()
{
if(deviceState == QAudio::SuspendedState) {
int err = 0;
@@ -673,32 +673,32 @@ void QAudioInputPrivate::resume()
}
}
void QAudioInputPrivate::setBufferSize(int value)
void QAlsaAudioInput::setBufferSize(int value)
{
buffer_size = value;
}
int QAudioInputPrivate::bufferSize() const
int QAlsaAudioInput::bufferSize() const
{
return buffer_size;
}
int QAudioInputPrivate::periodSize() const
int QAlsaAudioInput::periodSize() const
{
return period_size;
}
void QAudioInputPrivate::setNotifyInterval(int ms)
void QAlsaAudioInput::setNotifyInterval(int ms)
{
intervalTime = qMax(0, ms);
}
int QAudioInputPrivate::notifyInterval() const
int QAlsaAudioInput::notifyInterval() const
{
return intervalTime;
}
qint64 QAudioInputPrivate::processedUSecs() const
qint64 QAlsaAudioInput::processedUSecs() const
{
qint64 result = qint64(1000000) * totalTimeValue /
(settings.channelCount()*(settings.sampleSize()/8)) /
@@ -707,7 +707,7 @@ qint64 QAudioInputPrivate::processedUSecs() const
return result;
}
void QAudioInputPrivate::suspend()
void QAlsaAudioInput::suspend()
{
if(deviceState == QAudio::ActiveState||resuming) {
timer->stop();
@@ -716,7 +716,7 @@ void QAudioInputPrivate::suspend()
}
}
void QAudioInputPrivate::userFeed()
void QAlsaAudioInput::userFeed()
{
if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
return;
@@ -727,7 +727,7 @@ void QAudioInputPrivate::userFeed()
deviceReady();
}
bool QAudioInputPrivate::deviceReady()
bool QAlsaAudioInput::deviceReady()
{
if(pullMode) {
// reads some audio data and writes it to QIODevice
@@ -764,7 +764,7 @@ bool QAudioInputPrivate::deviceReady()
return true;
}
qint64 QAudioInputPrivate::elapsedUSecs() const
qint64 QAlsaAudioInput::elapsedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -772,7 +772,7 @@ qint64 QAudioInputPrivate::elapsedUSecs() const
return clockStamp.elapsed()*1000;
}
void QAudioInputPrivate::reset()
void QAlsaAudioInput::reset()
{
if(handle)
snd_pcm_reset(handle);
@@ -780,15 +780,15 @@ void QAudioInputPrivate::reset()
bytesAvailable = 0;
}
void QAudioInputPrivate::drain()
void QAlsaAudioInput::drain()
{
if(handle)
snd_pcm_drain(handle);
}
InputPrivate::InputPrivate(QAudioInputPrivate* audio)
InputPrivate::InputPrivate(QAlsaAudioInput* audio)
{
audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
audioDevice = qobject_cast<QAlsaAudioInput*>(audio);
}
InputPrivate::~InputPrivate()
@@ -879,4 +879,4 @@ void RingBuffer::write(char *data, int len)
QT_END_NAMESPACE
#include "moc_qaudioinput_alsa_p.cpp"
#include "moc_qalsaaudioinput.cpp"

View File

@@ -63,9 +63,9 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdatetime.h>
#include "qaudio.h"
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
QT_BEGIN_NAMESPACE
@@ -95,12 +95,12 @@ private:
QByteArray m_data;
};
class QAudioInputPrivate : public QAbstractAudioInput
class QAlsaAudioInput : public QAbstractAudioInput
{
Q_OBJECT
public:
QAudioInputPrivate(const QByteArray &device);
~QAudioInputPrivate();
QAlsaAudioInput(const QByteArray &device);
~QAlsaAudioInput();
qint64 read(char* data, qint64 len);
@@ -171,7 +171,7 @@ class InputPrivate : public QIODevice
{
Q_OBJECT
public:
InputPrivate(QAudioInputPrivate* audio);
InputPrivate(QAlsaAudioInput* audio);
~InputPrivate();
qint64 readData( char* data, qint64 len);
@@ -179,7 +179,7 @@ public:
void trigger();
private:
QAudioInputPrivate *audioDevice;
QAlsaAudioInput *audioDevice;
};
QT_END_NAMESPACE

View File

@@ -51,15 +51,15 @@
//
#include <QtCore/qcoreapplication.h>
#include "qaudiooutput_alsa_p.h"
#include "qaudiodeviceinfo_alsa_p.h"
#include "qaudiohelpers_p.h"
#include <QtMultimedia/private/qaudiohelpers_p.h>
#include "qalsaaudiooutput.h"
#include "qalsaaudiodeviceinfo.h"
QT_BEGIN_NAMESPACE
//#define DEBUG_AUDIO 1
QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
QAlsaAudioOutput::QAlsaAudioOutput(const QByteArray &device)
{
bytesAvailable = 0;
handle = 0;
@@ -90,7 +90,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
connect(timer,SIGNAL(timeout()),SLOT(userFeed()));
}
QAudioOutputPrivate::~QAudioOutputPrivate()
QAlsaAudioOutput::~QAlsaAudioOutput()
{
close();
disconnect(timer, SIGNAL(timeout()));
@@ -98,38 +98,38 @@ QAudioOutputPrivate::~QAudioOutputPrivate()
delete timer;
}
void QAudioOutputPrivate::setVolume(qreal vol)
void QAlsaAudioOutput::setVolume(qreal vol)
{
m_volume = vol;
}
qreal QAudioOutputPrivate::volume() const
qreal QAlsaAudioOutput::volume() const
{
return m_volume;
}
QAudio::Error QAudioOutputPrivate::error() const
QAudio::Error QAlsaAudioOutput::error() const
{
return errorState;
}
QAudio::State QAudioOutputPrivate::state() const
QAudio::State QAlsaAudioOutput::state() const
{
return deviceState;
}
void QAudioOutputPrivate::async_callback(snd_async_handler_t *ahandler)
void QAlsaAudioOutput::async_callback(snd_async_handler_t *ahandler)
{
QAudioOutputPrivate* audioOut;
QAlsaAudioOutput* audioOut;
audioOut = static_cast<QAudioOutputPrivate*>
audioOut = static_cast<QAlsaAudioOutput*>
(snd_async_handler_get_callback_private(ahandler));
if (audioOut && (audioOut->deviceState == QAudio::ActiveState || audioOut->resuming))
audioOut->feedback();
}
int QAudioOutputPrivate::xrun_recovery(int err)
int QAlsaAudioOutput::xrun_recovery(int err)
{
int count = 0;
bool reset = false;
@@ -167,7 +167,7 @@ int QAudioOutputPrivate::xrun_recovery(int err)
return err;
}
int QAudioOutputPrivate::setFormat()
int QAlsaAudioOutput::setFormat()
{
snd_pcm_format_t pcmformat = SND_PCM_FORMAT_UNKNOWN;
@@ -227,7 +227,7 @@ int QAudioOutputPrivate::setFormat()
: -1;
}
void QAudioOutputPrivate::start(QIODevice* device)
void QAlsaAudioOutput::start(QIODevice* device)
{
if(deviceState != QAudio::StoppedState)
deviceState = QAudio::StoppedState;
@@ -252,7 +252,7 @@ void QAudioOutputPrivate::start(QIODevice* device)
emit stateChanged(deviceState);
}
QIODevice* QAudioOutputPrivate::start()
QIODevice* QAlsaAudioOutput::start()
{
if(deviceState != QAudio::StoppedState)
deviceState = QAudio::StoppedState;
@@ -280,7 +280,7 @@ QIODevice* QAudioOutputPrivate::start()
return audioSource;
}
void QAudioOutputPrivate::stop()
void QAlsaAudioOutput::stop()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -290,7 +290,7 @@ void QAudioOutputPrivate::stop()
emit stateChanged(deviceState);
}
bool QAudioOutputPrivate::open()
bool QAlsaAudioOutput::open()
{
if(opened)
return true;
@@ -324,7 +324,7 @@ bool QAudioOutputPrivate::open()
}
QString dev = QString(QLatin1String(m_device.constData()));
QList<QByteArray> devices = QAudioDeviceInfoInternal::availableDevices(QAudio::AudioOutput);
QList<QByteArray> devices = QAlsaAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
if(dev.compare(QLatin1String("default")) == 0) {
#if(SND_LIB_MAJOR == 1 && SND_LIB_MINOR == 0 && SND_LIB_SUBMINOR >= 14)
if (devices.size() > 0)
@@ -529,7 +529,7 @@ bool QAudioOutputPrivate::open()
return true;
}
void QAudioOutputPrivate::close()
void QAlsaAudioOutput::close()
{
timer->stop();
@@ -547,7 +547,7 @@ void QAudioOutputPrivate::close()
opened = false;
}
int QAudioOutputPrivate::bytesFree() const
int QAlsaAudioOutput::bytesFree() const
{
if(resuming)
return period_size;
@@ -573,7 +573,7 @@ int QAudioOutputPrivate::bytesFree() const
return snd_pcm_frames_to_bytes(handle, frames);
}
qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
qint64 QAlsaAudioOutput::write( const char *data, qint64 len )
{
// Write out some audio data
if ( !handle )
@@ -623,38 +623,38 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
return 0;
}
int QAudioOutputPrivate::periodSize() const
int QAlsaAudioOutput::periodSize() const
{
return period_size;
}
void QAudioOutputPrivate::setBufferSize(int value)
void QAlsaAudioOutput::setBufferSize(int value)
{
if(deviceState == QAudio::StoppedState)
buffer_size = value;
}
int QAudioOutputPrivate::bufferSize() const
int QAlsaAudioOutput::bufferSize() const
{
return buffer_size;
}
void QAudioOutputPrivate::setNotifyInterval(int ms)
void QAlsaAudioOutput::setNotifyInterval(int ms)
{
intervalTime = qMax(0, ms);
}
int QAudioOutputPrivate::notifyInterval() const
int QAlsaAudioOutput::notifyInterval() const
{
return intervalTime;
}
qint64 QAudioOutputPrivate::processedUSecs() const
qint64 QAlsaAudioOutput::processedUSecs() const
{
return qint64(1000000) * totalTimeValue / settings.sampleRate();
}
void QAudioOutputPrivate::resume()
void QAlsaAudioOutput::resume()
{
if(deviceState == QAudio::SuspendedState) {
int err = 0;
@@ -680,18 +680,18 @@ void QAudioOutputPrivate::resume()
}
}
void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
void QAlsaAudioOutput::setFormat(const QAudioFormat& fmt)
{
if (deviceState == QAudio::StoppedState)
settings = fmt;
}
QAudioFormat QAudioOutputPrivate::format() const
QAudioFormat QAlsaAudioOutput::format() const
{
return settings;
}
void QAudioOutputPrivate::suspend()
void QAlsaAudioOutput::suspend()
{
if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState || resuming) {
timer->stop();
@@ -701,7 +701,7 @@ void QAudioOutputPrivate::suspend()
}
}
void QAudioOutputPrivate::userFeed()
void QAlsaAudioOutput::userFeed()
{
if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
return;
@@ -715,13 +715,13 @@ void QAudioOutputPrivate::userFeed()
deviceReady();
}
void QAudioOutputPrivate::feedback()
void QAlsaAudioOutput::feedback()
{
updateAvailable();
}
void QAudioOutputPrivate::updateAvailable()
void QAlsaAudioOutput::updateAvailable()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -730,7 +730,7 @@ void QAudioOutputPrivate::updateAvailable()
bytesAvailable = bytesFree();
}
bool QAudioOutputPrivate::deviceReady()
bool QAlsaAudioOutput::deviceReady()
{
if(pullMode) {
int l = 0;
@@ -805,7 +805,7 @@ bool QAudioOutputPrivate::deviceReady()
return true;
}
qint64 QAudioOutputPrivate::elapsedUSecs() const
qint64 QAlsaAudioOutput::elapsedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -813,7 +813,7 @@ qint64 QAudioOutputPrivate::elapsedUSecs() const
return clockStamp.elapsed()*1000;
}
void QAudioOutputPrivate::reset()
void QAlsaAudioOutput::reset()
{
if(handle)
snd_pcm_reset(handle);
@@ -821,9 +821,9 @@ void QAudioOutputPrivate::reset()
stop();
}
OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
OutputPrivate::OutputPrivate(QAlsaAudioOutput* audio)
{
audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
audioDevice = qobject_cast<QAlsaAudioOutput*>(audio);
}
OutputPrivate::~OutputPrivate() {}
@@ -857,4 +857,4 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len)
QT_END_NAMESPACE
#include "moc_qaudiooutput_alsa_p.cpp"
#include "moc_qalsaaudiooutput.cpp"

View File

@@ -62,22 +62,19 @@
#include <QtCore/qstringlist.h>
#include <QtCore/qdatetime.h>
#include "qaudio.h"
#include "qaudiodeviceinfo.h"
#include "qaudiosystem.h"
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
QT_BEGIN_NAMESPACE
class OutputPrivate;
class QAudioOutputPrivate : public QAbstractAudioOutput
class QAlsaAudioOutput : public QAbstractAudioOutput
{
friend class OutputPrivate;
Q_OBJECT
public:
QAudioOutputPrivate(const QByteArray &device);
~QAudioOutputPrivate();
QAlsaAudioOutput(const QByteArray &device);
~QAlsaAudioOutput();
qint64 write( const char *data, qint64 len );
@@ -154,17 +151,17 @@ private:
class OutputPrivate : public QIODevice
{
friend class QAudioOutputPrivate;
friend class QAlsaAudioOutput;
Q_OBJECT
public:
OutputPrivate(QAudioOutputPrivate* audio);
OutputPrivate(QAlsaAudioOutput* audio);
~OutputPrivate();
qint64 readData( char* data, qint64 len);
qint64 writeData(const char* data, qint64 len);
private:
QAudioOutputPrivate *audioDevice;
QAlsaAudioOutput *audioDevice;
};
QT_END_NAMESPACE

View File

@@ -0,0 +1,74 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qalsaplugin.h"
#include "qalsaaudiodeviceinfo.h"
#include "qalsaaudioinput.h"
#include "qalsaaudiooutput.h"
QT_BEGIN_NAMESPACE
QAlsaPlugin::QAlsaPlugin(QObject *parent)
: QAudioSystemPlugin(parent)
{
}
QList<QByteArray> QAlsaPlugin::availableDevices(QAudio::Mode mode) const
{
return QAlsaAudioDeviceInfo::availableDevices(mode);
}
QAbstractAudioInput *QAlsaPlugin::createInput(const QByteArray &device)
{
return new QAlsaAudioInput(device);
}
QAbstractAudioOutput *QAlsaPlugin::createOutput(const QByteArray &device)
{
return new QAlsaAudioOutput(device);
}
QAbstractAudioDeviceInfo *QAlsaPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode)
{
return new QAlsaAudioDeviceInfo(device, mode);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QALSAPLUGIN_H
#define QALSAPLUGIN_H
#include <QtMultimedia/qaudiosystemplugin.h>
QT_BEGIN_NAMESPACE
class QAlsaPlugin : public QAudioSystemPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "alsa.json")
public:
QAlsaPlugin(QObject *parent = 0);
~QAlsaPlugin() {}
QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE;
QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE;
QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE;
QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
#endif // QALSAPLUGIN_H

View File

@@ -22,10 +22,9 @@ qnx:!blackberry {
}
win32 {
SUBDIRS += audiocapture
}
SUBDIRS += audiocapture \
windowsaudio
win32 {
config_directshow: SUBDIRS += directshow
config_wmf: SUBDIRS += wmf
}
@@ -37,12 +36,14 @@ unix:!mac:!android {
SUBDIRS += audiocapture
}
# v4l is turned off because it is not supported in Qt 5
# !maemo*:SUBDIRS += v4l
config_pulseaudio {
SUBDIRS += pulseaudio
} else:config_alsa {
SUBDIRS += alsa
}
# v4l is turned off because it is not supported in Qt 5
# !maemo*:SUBDIRS += v4l
}
mac:!simulator {

View File

@@ -53,7 +53,7 @@
#include <QtCore/qt_windows.h>
#include <mmsystem.h>
#include "qaudiodeviceinfo_win32_p.h"
#include "qwindowsaudiodeviceinfo.h"
#if defined(Q_CC_MINGW) && !defined(__MINGW64_VERSION_MAJOR)
struct IBaseFilter; // Needed for strmif.h from stock MinGW.
@@ -127,7 +127,7 @@ QT_BEGIN_NAMESPACE
#endif
QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode mode)
QWindowsAudioDeviceInfo::QWindowsAudioDeviceInfo(QByteArray dev, QAudio::Mode mode)
{
QDataStream ds(&dev, QIODevice::ReadOnly);
ds >> devId >> device;
@@ -136,17 +136,17 @@ QAudioDeviceInfoInternal::QAudioDeviceInfoInternal(QByteArray dev, QAudio::Mode
updateLists();
}
QAudioDeviceInfoInternal::~QAudioDeviceInfoInternal()
QWindowsAudioDeviceInfo::~QWindowsAudioDeviceInfo()
{
close();
}
bool QAudioDeviceInfoInternal::isFormatSupported(const QAudioFormat& format) const
bool QWindowsAudioDeviceInfo::isFormatSupported(const QAudioFormat& format) const
{
return testSettings(format);
}
QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
QAudioFormat QWindowsAudioDeviceInfo::preferredFormat() const
{
QAudioFormat nearest;
if (mode == QAudio::AudioOutput) {
@@ -167,58 +167,58 @@ QAudioFormat QAudioDeviceInfoInternal::preferredFormat() const
return nearest;
}
QString QAudioDeviceInfoInternal::deviceName() const
QString QWindowsAudioDeviceInfo::deviceName() const
{
return device;
}
QStringList QAudioDeviceInfoInternal::supportedCodecs()
QStringList QWindowsAudioDeviceInfo::supportedCodecs()
{
updateLists();
return codecz;
}
QList<int> QAudioDeviceInfoInternal::supportedSampleRates()
QList<int> QWindowsAudioDeviceInfo::supportedSampleRates()
{
updateLists();
return sampleRatez;
}
QList<int> QAudioDeviceInfoInternal::supportedChannelCounts()
QList<int> QWindowsAudioDeviceInfo::supportedChannelCounts()
{
updateLists();
return channelz;
}
QList<int> QAudioDeviceInfoInternal::supportedSampleSizes()
QList<int> QWindowsAudioDeviceInfo::supportedSampleSizes()
{
updateLists();
return sizez;
}
QList<QAudioFormat::Endian> QAudioDeviceInfoInternal::supportedByteOrders()
QList<QAudioFormat::Endian> QWindowsAudioDeviceInfo::supportedByteOrders()
{
updateLists();
return byteOrderz;
}
QList<QAudioFormat::SampleType> QAudioDeviceInfoInternal::supportedSampleTypes()
QList<QAudioFormat::SampleType> QWindowsAudioDeviceInfo::supportedSampleTypes()
{
updateLists();
return typez;
}
bool QAudioDeviceInfoInternal::open()
bool QWindowsAudioDeviceInfo::open()
{
return true;
}
void QAudioDeviceInfoInternal::close()
void QWindowsAudioDeviceInfo::close()
{
}
bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
bool QWindowsAudioDeviceInfo::testSettings(const QAudioFormat& format) const
{
// Set nearest to closest settings that do work.
// See if what is in settings will work (return value).
@@ -305,7 +305,7 @@ bool QAudioDeviceInfoInternal::testSettings(const QAudioFormat& format) const
return false;
}
void QAudioDeviceInfoInternal::updateLists()
void QWindowsAudioDeviceInfo::updateLists()
{
// redo all lists based on current settings
bool match = false;
@@ -407,7 +407,7 @@ void QAudioDeviceInfoInternal::updateLists()
sampleRatez.prepend(8000);
}
QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
QList<QByteArray> QWindowsAudioDeviceInfo::availableDevices(QAudio::Mode mode)
{
Q_UNUSED(mode)
@@ -467,7 +467,7 @@ QList<QByteArray> QAudioDeviceInfoInternal::availableDevices(QAudio::Mode mode)
return devices;
}
QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
QByteArray QWindowsAudioDeviceInfo::defaultOutputDevice()
{
QByteArray defaultDevice;
QDataStream ds(&defaultDevice, QIODevice::WriteOnly);
@@ -477,7 +477,7 @@ QByteArray QAudioDeviceInfoInternal::defaultOutputDevice()
return defaultDevice;
}
QByteArray QAudioDeviceInfoInternal::defaultInputDevice()
QByteArray QWindowsAudioDeviceInfo::defaultInputDevice()
{
QByteArray defaultDevice;
QDataStream ds(&defaultDevice, QIODevice::WriteOnly);

View File

@@ -51,16 +51,16 @@
//
#ifndef QAUDIODEVICEINFOWIN_H
#define QAUDIODEVICEINFOWIN_H
#ifndef QWINDOWSAUDIODEVICEINFO_H
#define QWINDOWSAUDIODEVICEINFO_H
#include <QtCore/qbytearray.h>
#include <QtCore/qstringlist.h>
#include <QtCore/qlist.h>
#include <QtCore/qdebug.h>
#include <qaudiodeviceinfo.h>
#include <qaudiosystem.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
QT_BEGIN_NAMESPACE
@@ -69,13 +69,13 @@ QT_BEGIN_NAMESPACE
const unsigned int MAX_SAMPLE_RATES = 5;
const unsigned int SAMPLE_RATES[] = { 8000, 11025, 22050, 44100, 48000 };
class QAudioDeviceInfoInternal : public QAbstractAudioDeviceInfo
class QWindowsAudioDeviceInfo : public QAbstractAudioDeviceInfo
{
Q_OBJECT
public:
QAudioDeviceInfoInternal(QByteArray dev,QAudio::Mode mode);
~QAudioDeviceInfoInternal();
QWindowsAudioDeviceInfo(QByteArray dev,QAudio::Mode mode);
~QWindowsAudioDeviceInfo();
bool open();
void close();
@@ -111,4 +111,4 @@ private:
QT_END_NAMESPACE
#endif
#endif // QWINDOWSAUDIODEVICEINFO_H

View File

@@ -51,13 +51,13 @@
//
#include "qaudioinput_win32_p.h"
#include "qwindowsaudioinput.h"
QT_BEGIN_NAMESPACE
//#define DEBUG_AUDIO 1
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
QWindowsAudioInput::QWindowsAudioInput(const QByteArray &device)
{
bytesAvailable = 0;
buffer_size = 0;
@@ -78,21 +78,21 @@ QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device)
initMixer();
}
QAudioInputPrivate::~QAudioInputPrivate()
QWindowsAudioInput::~QWindowsAudioInput()
{
stop();
closeMixer();
}
void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
void QT_WIN_CALLBACK QWindowsAudioInput::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 )
{
Q_UNUSED(dwParam1)
Q_UNUSED(dwParam2)
Q_UNUSED(hWaveIn)
QAudioInputPrivate* qAudio;
qAudio = (QAudioInputPrivate*)(dwInstance);
QWindowsAudioInput* qAudio;
qAudio = (QWindowsAudioInput*)(dwInstance);
if(!qAudio)
return;
@@ -114,7 +114,7 @@ void QT_WIN_CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg,
}
}
WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count)
WAVEHDR* QWindowsAudioInput::allocateBlocks(int size, int count)
{
int i;
unsigned char* buffer;
@@ -145,7 +145,7 @@ WAVEHDR* QAudioInputPrivate::allocateBlocks(int size, int count)
return blocks;
}
void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray)
void QWindowsAudioInput::freeBlocks(WAVEHDR* blockArray)
{
WAVEHDR* blocks = blockArray;
@@ -158,12 +158,12 @@ void QAudioInputPrivate::freeBlocks(WAVEHDR* blockArray)
HeapFree(GetProcessHeap(), 0, blockArray);
}
QAudio::Error QAudioInputPrivate::error() const
QAudio::Error QWindowsAudioInput::error() const
{
return errorState;
}
QAudio::State QAudioInputPrivate::state() const
QAudio::State QWindowsAudioInput::state() const
{
return deviceState;
}
@@ -181,7 +181,7 @@ QAudio::State QAudioInputPrivate::state() const
#define DRVM_MAPPER_CONSOLEVOICECOM_GET (DRVM_MAPPER+23)
#endif
void QAudioInputPrivate::setVolume(qreal volume)
void QWindowsAudioInput::setVolume(qreal volume)
{
for (DWORD i = 0; i < mixerLineControls.cControls; i++) {
@@ -202,7 +202,7 @@ void QAudioInputPrivate::setVolume(qreal volume)
}
}
qreal QAudioInputPrivate::volume() const
qreal QWindowsAudioInput::volume() const
{
DWORD volume = 0;
for (DWORD i = 0; i < mixerLineControls.cControls; i++) {
@@ -233,18 +233,18 @@ qreal QAudioInputPrivate::volume() const
return volume / 65535.0;
}
void QAudioInputPrivate::setFormat(const QAudioFormat& fmt)
void QWindowsAudioInput::setFormat(const QAudioFormat& fmt)
{
if (deviceState == QAudio::StoppedState)
settings = fmt;
}
QAudioFormat QAudioInputPrivate::format() const
QAudioFormat QWindowsAudioInput::format() const
{
return settings;
}
void QAudioInputPrivate::start(QIODevice* device)
void QWindowsAudioInput::start(QIODevice* device)
{
if(deviceState != QAudio::StoppedState)
close();
@@ -263,7 +263,7 @@ void QAudioInputPrivate::start(QIODevice* device)
emit stateChanged(deviceState);
}
QIODevice* QAudioInputPrivate::start()
QIODevice* QWindowsAudioInput::start()
{
if(deviceState != QAudio::StoppedState)
close();
@@ -285,7 +285,7 @@ QIODevice* QAudioInputPrivate::start()
return audioSource;
}
void QAudioInputPrivate::stop()
void QWindowsAudioInput::stop()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -294,7 +294,7 @@ void QAudioInputPrivate::stop()
emit stateChanged(deviceState);
}
bool QAudioInputPrivate::open()
bool QWindowsAudioInput::open()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -398,7 +398,7 @@ bool QAudioInputPrivate::open()
return true;
}
void QAudioInputPrivate::close()
void QWindowsAudioInput::close()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -421,7 +421,7 @@ void QAudioInputPrivate::close()
}
}
void QAudioInputPrivate::initMixer()
void QWindowsAudioInput::initMixer()
{
QDataStream ds(&m_device, QIODevice::ReadOnly);
quint32 inputDevice;
@@ -455,13 +455,13 @@ void QAudioInputPrivate::initMixer()
}
}
void QAudioInputPrivate::closeMixer()
void QWindowsAudioInput::closeMixer()
{
delete[] mixerLineControls.pamxctrl;
memset(&mixerLineControls, 0, sizeof(mixerLineControls));
}
int QAudioInputPrivate::bytesReady() const
int QWindowsAudioInput::bytesReady() const
{
if(period_size == 0 || buffer_size == 0)
return 0;
@@ -472,7 +472,7 @@ int QAudioInputPrivate::bytesReady() const
return buf;
}
qint64 QAudioInputPrivate::read(char* data, qint64 len)
qint64 QWindowsAudioInput::read(char* data, qint64 len)
{
bool done = false;
@@ -591,7 +591,7 @@ qint64 QAudioInputPrivate::read(char* data, qint64 len)
return written;
}
void QAudioInputPrivate::resume()
void QWindowsAudioInput::resume()
{
if(deviceState == QAudio::SuspendedState) {
deviceState = QAudio::ActiveState;
@@ -619,32 +619,32 @@ void QAudioInputPrivate::resume()
}
}
void QAudioInputPrivate::setBufferSize(int value)
void QWindowsAudioInput::setBufferSize(int value)
{
buffer_size = value;
}
int QAudioInputPrivate::bufferSize() const
int QWindowsAudioInput::bufferSize() const
{
return buffer_size;
}
int QAudioInputPrivate::periodSize() const
int QWindowsAudioInput::periodSize() const
{
return period_size;
}
void QAudioInputPrivate::setNotifyInterval(int ms)
void QWindowsAudioInput::setNotifyInterval(int ms)
{
intervalTime = qMax(0, ms);
}
int QAudioInputPrivate::notifyInterval() const
int QWindowsAudioInput::notifyInterval() const
{
return intervalTime;
}
qint64 QAudioInputPrivate::processedUSecs() const
qint64 QWindowsAudioInput::processedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -655,7 +655,7 @@ qint64 QAudioInputPrivate::processedUSecs() const
return result;
}
void QAudioInputPrivate::suspend()
void QWindowsAudioInput::suspend()
{
if(deviceState == QAudio::ActiveState) {
waveInReset(hWaveIn);
@@ -664,7 +664,7 @@ void QAudioInputPrivate::suspend()
}
}
void QAudioInputPrivate::feedback()
void QWindowsAudioInput::feedback()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -674,7 +674,7 @@ void QAudioInputPrivate::feedback()
QMetaObject::invokeMethod(this, "deviceReady", Qt::QueuedConnection);
}
bool QAudioInputPrivate::deviceReady()
bool QWindowsAudioInput::deviceReady()
{
bytesAvailable = bytesReady();
#ifdef DEBUG_AUDIO
@@ -701,7 +701,7 @@ bool QAudioInputPrivate::deviceReady()
return true;
}
qint64 QAudioInputPrivate::elapsedUSecs() const
qint64 QWindowsAudioInput::elapsedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -709,16 +709,16 @@ qint64 QAudioInputPrivate::elapsedUSecs() const
return timeStampOpened.elapsed()*1000;
}
void QAudioInputPrivate::reset()
void QWindowsAudioInput::reset()
{
stop();
if (period_size > 0)
waveFreeBlockCount = buffer_size / period_size;
}
InputPrivate::InputPrivate(QAudioInputPrivate* audio)
InputPrivate::InputPrivate(QWindowsAudioInput* audio)
{
audioDevice = qobject_cast<QAudioInputPrivate*>(audio);
audioDevice = qobject_cast<QWindowsAudioInput*>(audio);
}
InputPrivate::~InputPrivate() {}
@@ -749,5 +749,4 @@ void InputPrivate::trigger()
QT_END_NAMESPACE
#include "moc_qaudioinput_win32_p.cpp"
#include "moc_qwindowsaudioinput.cpp"

View File

@@ -50,8 +50,8 @@
// We mean it.
//
#ifndef QAUDIOINPUTWIN_H
#define QAUDIOINPUTWIN_H
#ifndef QWINDOWSAUDIOINPUT_H
#define QWINDOWSAUDIOINPUT_H
#include <QtCore/qt_windows.h>
#include <mmsystem.h>
@@ -64,9 +64,9 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qmutex.h>
#include <qaudio.h>
#include <qaudiodeviceinfo.h>
#include <qaudiosystem.h>
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
QT_BEGIN_NAMESPACE
@@ -81,12 +81,12 @@ QT_BEGIN_NAMESPACE
# endif
#endif
class QAudioInputPrivate : public QAbstractAudioInput
class QWindowsAudioInput : public QAbstractAudioInput
{
Q_OBJECT
public:
QAudioInputPrivate(const QByteArray &device);
~QAudioInputPrivate();
QWindowsAudioInput(const QByteArray &device);
~QWindowsAudioInput();
qint64 read(char* data, qint64 len);
@@ -163,7 +163,7 @@ class InputPrivate : public QIODevice
{
Q_OBJECT
public:
InputPrivate(QAudioInputPrivate* audio);
InputPrivate(QWindowsAudioInput* audio);
~InputPrivate();
qint64 readData( char* data, qint64 len);
@@ -171,10 +171,9 @@ public:
void trigger();
private:
QAudioInputPrivate *audioDevice;
QWindowsAudioInput *audioDevice;
};
QT_END_NAMESPACE
#endif

View File

@@ -50,7 +50,7 @@
// INTERNAL USE ONLY: Do NOT use for any other purpose.
//
#include "qaudiooutput_win32_p.h"
#include "qwindowsaudiooutput.h"
#include <QtEndian>
#ifndef SPEAKER_FRONT_LEFT
@@ -104,7 +104,7 @@
QT_BEGIN_NAMESPACE
QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
QWindowsAudioOutput::QWindowsAudioOutput(const QByteArray &device)
{
bytesAvailable = 0;
buffer_size = 0;
@@ -121,7 +121,7 @@ QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device)
volumeCache = (qreal)1.;
}
QAudioOutputPrivate::~QAudioOutputPrivate()
QWindowsAudioOutput::~QWindowsAudioOutput()
{
mutex.lock();
finished = true;
@@ -130,15 +130,15 @@ QAudioOutputPrivate::~QAudioOutputPrivate()
close();
}
void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
void CALLBACK QWindowsAudioOutput::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
DWORD_PTR dwInstance, DWORD_PTR dwParam1, DWORD_PTR dwParam2 )
{
Q_UNUSED(dwParam1)
Q_UNUSED(dwParam2)
Q_UNUSED(hWaveOut)
QAudioOutputPrivate* qAudio;
qAudio = (QAudioOutputPrivate*)(dwInstance);
QWindowsAudioOutput* qAudio;
qAudio = (QWindowsAudioOutput*)(dwInstance);
if(!qAudio)
return;
@@ -164,7 +164,7 @@ void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg,
}
}
WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count)
WAVEHDR* QWindowsAudioOutput::allocateBlocks(int size, int count)
{
int i;
unsigned char* buffer;
@@ -186,7 +186,7 @@ WAVEHDR* QAudioOutputPrivate::allocateBlocks(int size, int count)
return blocks;
}
void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
void QWindowsAudioOutput::freeBlocks(WAVEHDR* blockArray)
{
WAVEHDR* blocks = blockArray;
@@ -199,18 +199,18 @@ void QAudioOutputPrivate::freeBlocks(WAVEHDR* blockArray)
HeapFree(GetProcessHeap(), 0, blockArray);
}
QAudioFormat QAudioOutputPrivate::format() const
QAudioFormat QWindowsAudioOutput::format() const
{
return settings;
}
void QAudioOutputPrivate::setFormat(const QAudioFormat& fmt)
void QWindowsAudioOutput::setFormat(const QAudioFormat& fmt)
{
if (deviceState == QAudio::StoppedState)
settings = fmt;
}
void QAudioOutputPrivate::start(QIODevice* device)
void QWindowsAudioOutput::start(QIODevice* device)
{
if(deviceState != QAudio::StoppedState)
close();
@@ -229,7 +229,7 @@ void QAudioOutputPrivate::start(QIODevice* device)
emit stateChanged(deviceState);
}
QIODevice* QAudioOutputPrivate::start()
QIODevice* QWindowsAudioOutput::start()
{
if(deviceState != QAudio::StoppedState)
close();
@@ -251,7 +251,7 @@ QIODevice* QAudioOutputPrivate::start()
return audioSource;
}
void QAudioOutputPrivate::stop()
void QWindowsAudioOutput::stop()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -263,7 +263,7 @@ void QAudioOutputPrivate::stop()
emit stateChanged(deviceState);
}
bool QAudioOutputPrivate::open()
bool QWindowsAudioOutput::open()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -394,7 +394,7 @@ bool QAudioOutputPrivate::open()
return true;
}
void QAudioOutputPrivate::close()
void QWindowsAudioOutput::close()
{
if(deviceState == QAudio::StoppedState)
return;
@@ -413,7 +413,7 @@ void QAudioOutputPrivate::close()
buffer_size = 0;
}
int QAudioOutputPrivate::bytesFree() const
int QWindowsAudioOutput::bytesFree() const
{
int buf;
buf = waveFreeBlockCount*period_size;
@@ -421,33 +421,33 @@ int QAudioOutputPrivate::bytesFree() const
return buf;
}
int QAudioOutputPrivate::periodSize() const
int QWindowsAudioOutput::periodSize() const
{
return period_size;
}
void QAudioOutputPrivate::setBufferSize(int value)
void QWindowsAudioOutput::setBufferSize(int value)
{
if(deviceState == QAudio::StoppedState)
buffer_size = value;
}
int QAudioOutputPrivate::bufferSize() const
int QWindowsAudioOutput::bufferSize() const
{
return buffer_size;
}
void QAudioOutputPrivate::setNotifyInterval(int ms)
void QWindowsAudioOutput::setNotifyInterval(int ms)
{
intervalTime = qMax(0, ms);
}
int QAudioOutputPrivate::notifyInterval() const
int QWindowsAudioOutput::notifyInterval() const
{
return intervalTime;
}
qint64 QAudioOutputPrivate::processedUSecs() const
qint64 QWindowsAudioOutput::processedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -458,7 +458,7 @@ qint64 QAudioOutputPrivate::processedUSecs() const
return result;
}
qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
qint64 QWindowsAudioOutput::write( const char *data, qint64 len )
{
// Write out some audio data
if (deviceState != QAudio::ActiveState && deviceState != QAudio::IdleState)
@@ -539,7 +539,7 @@ qint64 QAudioOutputPrivate::write( const char *data, qint64 len )
return (len-l);
}
void QAudioOutputPrivate::resume()
void QWindowsAudioOutput::resume()
{
if(deviceState == QAudio::SuspendedState) {
deviceState = QAudio::ActiveState;
@@ -550,7 +550,7 @@ void QAudioOutputPrivate::resume()
}
}
void QAudioOutputPrivate::suspend()
void QWindowsAudioOutput::suspend()
{
if(deviceState == QAudio::ActiveState || deviceState == QAudio::IdleState) {
int delay = (buffer_size-bytesFree())*1000/(settings.sampleRate()
@@ -563,7 +563,7 @@ void QAudioOutputPrivate::suspend()
}
}
void QAudioOutputPrivate::feedback()
void QWindowsAudioOutput::feedback()
{
#ifdef DEBUG_AUDIO
QTime now(QTime::currentTime());
@@ -577,7 +577,7 @@ void QAudioOutputPrivate::feedback()
}
}
bool QAudioOutputPrivate::deviceReady()
bool QWindowsAudioOutput::deviceReady()
{
if(deviceState == QAudio::StoppedState || deviceState == QAudio::SuspendedState)
return false;
@@ -677,7 +677,7 @@ bool QAudioOutputPrivate::deviceReady()
return true;
}
qint64 QAudioOutputPrivate::elapsedUSecs() const
qint64 QWindowsAudioOutput::elapsedUSecs() const
{
if (deviceState == QAudio::StoppedState)
return 0;
@@ -685,17 +685,17 @@ qint64 QAudioOutputPrivate::elapsedUSecs() const
return timeStampOpened.elapsed()*1000;
}
QAudio::Error QAudioOutputPrivate::error() const
QAudio::Error QWindowsAudioOutput::error() const
{
return errorState;
}
QAudio::State QAudioOutputPrivate::state() const
QAudio::State QWindowsAudioOutput::state() const
{
return deviceState;
}
void QAudioOutputPrivate::setVolume(qreal v)
void QWindowsAudioOutput::setVolume(qreal v)
{
const qreal normalizedVolume = qBound(qreal(0.0), v, qreal(1.0));
if (deviceState != QAudio::ActiveState) {
@@ -709,19 +709,19 @@ void QAudioOutputPrivate::setVolume(qreal v)
volumeCache = normalizedVolume;
}
qreal QAudioOutputPrivate::volume() const
qreal QWindowsAudioOutput::volume() const
{
return volumeCache;
}
void QAudioOutputPrivate::reset()
void QWindowsAudioOutput::reset()
{
close();
}
OutputPrivate::OutputPrivate(QAudioOutputPrivate* audio)
OutputPrivate::OutputPrivate(QWindowsAudioOutput* audio)
{
audioDevice = qobject_cast<QAudioOutputPrivate*>(audio);
audioDevice = qobject_cast<QWindowsAudioOutput*>(audio);
}
OutputPrivate::~OutputPrivate() {}
@@ -759,4 +759,4 @@ qint64 OutputPrivate::writeData(const char* data, qint64 len)
QT_END_NAMESPACE
#include "moc_qaudiooutput_win32_p.cpp"
#include "moc_qwindowsaudiooutput.cpp"

View File

@@ -50,8 +50,8 @@
// We mean it.
//
#ifndef QAUDIOOUTPUTWIN_H
#define QAUDIOOUTPUTWIN_H
#ifndef QWINDOWSAUDIOOUTPUT_H
#define QWINDOWSAUDIOOUTPUT_H
#include <QtCore/qt_windows.h>
#include <mmsystem.h>
@@ -63,9 +63,9 @@
#include <QtCore/qdatetime.h>
#include <QtCore/qmutex.h>
#include <qaudio.h>
#include <qaudiodeviceinfo.h>
#include <qaudiosystem.h>
#include <QtMultimedia/qaudio.h>
#include <QtMultimedia/qaudiodeviceinfo.h>
#include <QtMultimedia/qaudiosystem.h>
// For compat with 4.6
#if !defined(QT_WIN_CALLBACK)
@@ -78,13 +78,12 @@
QT_BEGIN_NAMESPACE
class QAudioOutputPrivate : public QAbstractAudioOutput
class QWindowsAudioOutput : public QAbstractAudioOutput
{
Q_OBJECT
public:
QAudioOutputPrivate(const QByteArray &device);
~QAudioOutputPrivate();
QWindowsAudioOutput(const QByteArray &device);
~QWindowsAudioOutput();
qint64 write( const char *data, qint64 len );
@@ -156,17 +155,17 @@ class OutputPrivate : public QIODevice
{
Q_OBJECT
public:
OutputPrivate(QAudioOutputPrivate* audio);
OutputPrivate(QWindowsAudioOutput* audio);
~OutputPrivate();
qint64 readData( char* data, qint64 len);
qint64 writeData(const char* data, qint64 len);
private:
QAudioOutputPrivate *audioDevice;
QWindowsAudioOutput *audioDevice;
};
QT_END_NAMESPACE
#endif
#endif // QWINDOWSAUDIOOUTPUT_H

View File

@@ -0,0 +1,74 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#include "qwindowsaudioplugin.h"
#include "qwindowsaudiodeviceinfo.h"
#include "qwindowsaudioinput.h"
#include "qwindowsaudiooutput.h"
QT_BEGIN_NAMESPACE
QWindowsAudioPlugin::QWindowsAudioPlugin(QObject *parent)
: QAudioSystemPlugin(parent)
{
}
QList<QByteArray> QWindowsAudioPlugin::availableDevices(QAudio::Mode mode) const
{
return QWindowsAudioDeviceInfo::availableDevices(mode);
}
QAbstractAudioInput *QWindowsAudioPlugin::createInput(const QByteArray &device)
{
return new QWindowsAudioInput(device);
}
QAbstractAudioOutput *QWindowsAudioPlugin::createOutput(const QByteArray &device)
{
return new QWindowsAudioOutput(device);
}
QAbstractAudioDeviceInfo *QWindowsAudioPlugin::createDeviceInfo(const QByteArray &device, QAudio::Mode mode)
{
return new QWindowsAudioDeviceInfo(device, mode);
}
QT_END_NAMESPACE

View File

@@ -0,0 +1,67 @@
/****************************************************************************
**
** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** This file is part of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU General Public License version 3.0 requirements will be
** met: http://www.gnu.org/copyleft/gpl.html.
**
**
** $QT_END_LICENSE$
**
****************************************************************************/
#ifndef QWINDOWSAUDIOPLUGIN_H
#define QWINDOWSAUDIOPLUGIN_H
#include <QtMultimedia/qaudiosystemplugin.h>
QT_BEGIN_NAMESPACE
class QWindowsAudioPlugin : public QAudioSystemPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.qt.audiosystemfactory/5.0" FILE "windowsaudio.json")
public:
QWindowsAudioPlugin(QObject *parent = 0);
~QWindowsAudioPlugin() {}
QList<QByteArray> availableDevices(QAudio::Mode mode) const Q_DECL_OVERRIDE;
QAbstractAudioInput *createInput(const QByteArray &device) Q_DECL_OVERRIDE;
QAbstractAudioOutput *createOutput(const QByteArray &device) Q_DECL_OVERRIDE;
QAbstractAudioDeviceInfo *createDeviceInfo(const QByteArray &device, QAudio::Mode mode) Q_DECL_OVERRIDE;
};
QT_END_NAMESPACE
#endif // QWINDOWSAUDIOPLUGIN_H

View File

@@ -0,0 +1,3 @@
{
"Keys": ["default"]
}

View File

@@ -0,0 +1,23 @@
TARGET = qtaudio_windows
QT += multimedia-private
PLUGIN_TYPE = audio
PLUGIN_CLASS_NAME = QWindowsAudioPlugin
load(qt_plugin)
LIBS += -lwinmm -lstrmiids -lole32 -loleaut32
HEADERS += \
qwindowsaudioplugin.h \
qwindowsaudiodeviceinfo.h \
qwindowsaudioinput.h \
qwindowsaudiooutput.h
SOURCES += \
qwindowsaudioplugin.cpp \
qwindowsaudiodeviceinfo.cpp \
qwindowsaudioinput.cpp \
qwindowsaudiooutput.cpp
OTHER_FILES += \
windowsaudio.json