Improve audiorecorder example.
- Possibility to select channel count - Show audio level for unsigned integer samples - Show audio level for each channel - Correctly set output file location - Update controls depending on the recorder status (rather than the state) Change-Id: Ieb08c379bb01a11ce1aa52a9d92ea1f320c87d49 Reviewed-by: Christian Stromme <christian.stromme@digia.com>
This commit is contained in:
committed by
The Qt Project
parent
7c9ff56f2f
commit
a1cd3c9274
@@ -45,6 +45,7 @@
|
|||||||
#include <QMediaRecorder>
|
#include <QMediaRecorder>
|
||||||
|
|
||||||
#include "audiorecorder.h"
|
#include "audiorecorder.h"
|
||||||
|
#include "qaudiolevel.h"
|
||||||
|
|
||||||
#if defined(Q_WS_MAEMO_6)
|
#if defined(Q_WS_MAEMO_6)
|
||||||
#include "ui_audiorecorder_small.h"
|
#include "ui_audiorecorder_small.h"
|
||||||
@@ -53,10 +54,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
static qreal getPeakValue(const QAudioFormat &format);
|
static qreal getPeakValue(const QAudioFormat &format);
|
||||||
static qreal getBufferLevel(const QAudioBuffer &buffer);
|
static QVector<qreal> getBufferLevels(const QAudioBuffer &buffer);
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
static qreal getBufferLevel(const T *buffer, int samples);
|
static QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels);
|
||||||
|
|
||||||
AudioRecorder::AudioRecorder(QWidget *parent) :
|
AudioRecorder::AudioRecorder(QWidget *parent) :
|
||||||
QMainWindow(parent),
|
QMainWindow(parent),
|
||||||
@@ -67,7 +68,8 @@ AudioRecorder::AudioRecorder(QWidget *parent) :
|
|||||||
|
|
||||||
audioRecorder = new QAudioRecorder(this);
|
audioRecorder = new QAudioRecorder(this);
|
||||||
probe = new QAudioProbe;
|
probe = new QAudioProbe;
|
||||||
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)), this, SLOT(processBuffer(QAudioBuffer)));
|
connect(probe, SIGNAL(audioBufferProbed(QAudioBuffer)),
|
||||||
|
this, SLOT(processBuffer(QAudioBuffer)));
|
||||||
probe->setSource(audioRecorder);
|
probe->setSource(audioRecorder);
|
||||||
|
|
||||||
//audio devices
|
//audio devices
|
||||||
@@ -88,27 +90,34 @@ AudioRecorder::AudioRecorder(QWidget *parent) :
|
|||||||
ui->containerBox->addItem(containerName, QVariant(containerName));
|
ui->containerBox->addItem(containerName, QVariant(containerName));
|
||||||
}
|
}
|
||||||
|
|
||||||
//sample rate:
|
//sample rate
|
||||||
ui->sampleRateBox->addItem(tr("Default"), QVariant(0));
|
ui->sampleRateBox->addItem(tr("Default"), QVariant(0));
|
||||||
foreach (int sampleRate, audioRecorder->supportedAudioSampleRates()) {
|
foreach (int sampleRate, audioRecorder->supportedAudioSampleRates()) {
|
||||||
ui->sampleRateBox->addItem(QString::number(sampleRate), QVariant(
|
ui->sampleRateBox->addItem(QString::number(sampleRate), QVariant(
|
||||||
sampleRate));
|
sampleRate));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//channels
|
||||||
|
ui->channelsBox->addItem(tr("Default"), QVariant(-1));
|
||||||
|
ui->channelsBox->addItem(QStringLiteral("1"), QVariant(1));
|
||||||
|
ui->channelsBox->addItem(QStringLiteral("2"), QVariant(2));
|
||||||
|
ui->channelsBox->addItem(QStringLiteral("4"), QVariant(4));
|
||||||
|
|
||||||
|
//quality
|
||||||
ui->qualitySlider->setRange(0, int(QMultimedia::VeryHighQuality));
|
ui->qualitySlider->setRange(0, int(QMultimedia::VeryHighQuality));
|
||||||
ui->qualitySlider->setValue(int(QMultimedia::NormalQuality));
|
ui->qualitySlider->setValue(int(QMultimedia::NormalQuality));
|
||||||
|
|
||||||
//bitrates:
|
//bitrates:
|
||||||
ui->bitrateBox->addItem(QString("Default"), QVariant(0));
|
ui->bitrateBox->addItem(tr("Default"), QVariant(0));
|
||||||
ui->bitrateBox->addItem(QString("32000"), QVariant(32000));
|
ui->bitrateBox->addItem(QStringLiteral("32000"), QVariant(32000));
|
||||||
ui->bitrateBox->addItem(QString("64000"), QVariant(64000));
|
ui->bitrateBox->addItem(QStringLiteral("64000"), QVariant(64000));
|
||||||
ui->bitrateBox->addItem(QString("96000"), QVariant(96000));
|
ui->bitrateBox->addItem(QStringLiteral("96000"), QVariant(96000));
|
||||||
ui->bitrateBox->addItem(QString("128000"), QVariant(128000));
|
ui->bitrateBox->addItem(QStringLiteral("128000"), QVariant(128000));
|
||||||
|
|
||||||
connect(audioRecorder, SIGNAL(durationChanged(qint64)), this,
|
connect(audioRecorder, SIGNAL(durationChanged(qint64)), this,
|
||||||
SLOT(updateProgress(qint64)));
|
SLOT(updateProgress(qint64)));
|
||||||
connect(audioRecorder, SIGNAL(stateChanged(QMediaRecorder::State)), this,
|
connect(audioRecorder, SIGNAL(statusChanged(QMediaRecorder::Status)), this,
|
||||||
SLOT(updateState(QMediaRecorder::State)));
|
SLOT(updateStatus(QMediaRecorder::Status)));
|
||||||
connect(audioRecorder, SIGNAL(error(QMediaRecorder::Error)), this,
|
connect(audioRecorder, SIGNAL(error(QMediaRecorder::Error)), this,
|
||||||
SLOT(displayErrorMessage()));
|
SLOT(displayErrorMessage()));
|
||||||
}
|
}
|
||||||
@@ -127,32 +136,47 @@ void AudioRecorder::updateProgress(qint64 duration)
|
|||||||
ui->statusbar->showMessage(tr("Recorded %1 sec").arg(duration / 1000));
|
ui->statusbar->showMessage(tr("Recorded %1 sec").arg(duration / 1000));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioRecorder::updateState(QMediaRecorder::State state)
|
void AudioRecorder::updateStatus(QMediaRecorder::Status status)
|
||||||
{
|
{
|
||||||
QString statusMessage;
|
QString statusMessage;
|
||||||
|
|
||||||
switch (state) {
|
switch (status) {
|
||||||
case QMediaRecorder::RecordingState:
|
case QMediaRecorder::RecordingStatus:
|
||||||
ui->recordButton->setText(tr("Stop"));
|
if (audioLevels.count() != audioRecorder->audioSettings().channelCount()) {
|
||||||
ui->pauseButton->setText(tr("Pause"));
|
qDeleteAll(audioLevels);
|
||||||
if (audioRecorder->outputLocation().isEmpty())
|
audioLevels.clear();
|
||||||
statusMessage = tr("Recording");
|
for (int i = 0; i < audioRecorder->audioSettings().channelCount(); ++i) {
|
||||||
else
|
QAudioLevel *level = new QAudioLevel(ui->centralwidget);
|
||||||
statusMessage = tr("Recording to %1").arg(
|
audioLevels.append(level);
|
||||||
|
ui->levelsLayout->addWidget(level);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ui->recordButton->setText(tr("Stop"));
|
||||||
|
ui->pauseButton->setText(tr("Pause"));
|
||||||
|
if (audioRecorder->outputLocation().isEmpty())
|
||||||
|
statusMessage = tr("Recording");
|
||||||
|
else
|
||||||
|
statusMessage = tr("Recording to %1").arg(
|
||||||
audioRecorder->outputLocation().toString());
|
audioRecorder->outputLocation().toString());
|
||||||
break;
|
break;
|
||||||
case QMediaRecorder::PausedState:
|
case QMediaRecorder::PausedStatus:
|
||||||
ui->recordButton->setText(tr("Stop"));
|
clearAudioLevels();
|
||||||
ui->pauseButton->setText(tr("Resume"));
|
ui->recordButton->setText(tr("Stop"));
|
||||||
statusMessage = tr("Paused");
|
ui->pauseButton->setText(tr("Resume"));
|
||||||
break;
|
statusMessage = tr("Paused");
|
||||||
case QMediaRecorder::StoppedState:
|
break;
|
||||||
ui->recordButton->setText(tr("Record"));
|
case QMediaRecorder::UnloadedStatus:
|
||||||
ui->pauseButton->setText(tr("Pause"));
|
clearAudioLevels();
|
||||||
statusMessage = tr("Stopped");
|
ui->recordButton->setText(tr("Record"));
|
||||||
|
ui->pauseButton->setText(tr("Pause"));
|
||||||
|
statusMessage = tr("Stopped");
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
ui->pauseButton->setEnabled(state != QMediaRecorder::StoppedState);
|
ui->pauseButton->setEnabled(audioRecorder->state()
|
||||||
|
!= QMediaRecorder::StoppedState);
|
||||||
|
|
||||||
if (audioRecorder->error() == QMediaRecorder::NoError)
|
if (audioRecorder->error() == QMediaRecorder::NoError)
|
||||||
ui->statusbar->showMessage(statusMessage);
|
ui->statusbar->showMessage(statusMessage);
|
||||||
@@ -176,6 +200,7 @@ void AudioRecorder::toggleRecord()
|
|||||||
settings.setCodec(boxValue(ui->audioCodecBox).toString());
|
settings.setCodec(boxValue(ui->audioCodecBox).toString());
|
||||||
settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
|
settings.setSampleRate(boxValue(ui->sampleRateBox).toInt());
|
||||||
settings.setBitRate(boxValue(ui->bitrateBox).toInt());
|
settings.setBitRate(boxValue(ui->bitrateBox).toInt());
|
||||||
|
settings.setChannelCount(boxValue(ui->channelsBox).toInt());
|
||||||
settings.setQuality(QMultimedia::EncodingQuality(ui->qualitySlider->value()));
|
settings.setQuality(QMultimedia::EncodingQuality(ui->qualitySlider->value()));
|
||||||
settings.setEncodingMode(ui->constantQualityRadioButton->isChecked() ?
|
settings.setEncodingMode(ui->constantQualityRadioButton->isChecked() ?
|
||||||
QMultimedia::ConstantQualityEncoding :
|
QMultimedia::ConstantQualityEncoding :
|
||||||
@@ -202,7 +227,7 @@ void AudioRecorder::togglePause()
|
|||||||
void AudioRecorder::setOutputLocation()
|
void AudioRecorder::setOutputLocation()
|
||||||
{
|
{
|
||||||
QString fileName = QFileDialog::getSaveFileName();
|
QString fileName = QFileDialog::getSaveFileName();
|
||||||
audioRecorder->setOutputLocation(QUrl(fileName));
|
audioRecorder->setOutputLocation(QUrl::fromLocalFile(fileName));
|
||||||
outputLocationSet = true;
|
outputLocationSet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -211,88 +236,121 @@ void AudioRecorder::displayErrorMessage()
|
|||||||
ui->statusbar->showMessage(audioRecorder->errorString());
|
ui->statusbar->showMessage(audioRecorder->errorString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AudioRecorder::clearAudioLevels()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < audioLevels.size(); ++i)
|
||||||
|
audioLevels.at(i)->setLevel(0);
|
||||||
|
}
|
||||||
|
|
||||||
// This function returns the maximum possible sample value for a given audio format
|
// This function returns the maximum possible sample value for a given audio format
|
||||||
qreal getPeakValue(const QAudioFormat& format)
|
qreal getPeakValue(const QAudioFormat& format)
|
||||||
{
|
{
|
||||||
// Note: Only the most common sample formats are supported
|
// Note: Only the most common sample formats are supported
|
||||||
if (!format.isValid())
|
if (!format.isValid())
|
||||||
return 0.0;
|
return qreal(0);
|
||||||
|
|
||||||
if (format.codec() != "audio/pcm")
|
if (format.codec() != "audio/pcm")
|
||||||
return 0.0;
|
return qreal(0);
|
||||||
|
|
||||||
switch (format.sampleType()) {
|
switch (format.sampleType()) {
|
||||||
case QAudioFormat::Unknown:
|
case QAudioFormat::Unknown:
|
||||||
break;
|
break;
|
||||||
case QAudioFormat::Float:
|
case QAudioFormat::Float:
|
||||||
if (format.sampleSize() != 32) // other sample formats are not supported
|
if (format.sampleSize() != 32) // other sample formats are not supported
|
||||||
return 0.0;
|
return qreal(0);
|
||||||
return 1.00003;
|
return qreal(1.00003);
|
||||||
case QAudioFormat::SignedInt:
|
case QAudioFormat::SignedInt:
|
||||||
if (format.sampleSize() == 32)
|
if (format.sampleSize() == 32)
|
||||||
return 2147483648.0;
|
return qreal(INT_MAX);
|
||||||
if (format.sampleSize() == 16)
|
if (format.sampleSize() == 16)
|
||||||
return 32768.0;
|
return qreal(SHRT_MAX);
|
||||||
if (format.sampleSize() == 8)
|
if (format.sampleSize() == 8)
|
||||||
return 128.0;
|
return qreal(CHAR_MAX);
|
||||||
break;
|
break;
|
||||||
case QAudioFormat::UnSignedInt:
|
case QAudioFormat::UnSignedInt:
|
||||||
// Unsigned formats are not supported in this example
|
if (format.sampleSize() == 32)
|
||||||
|
return qreal(UINT_MAX);
|
||||||
|
if (format.sampleSize() == 16)
|
||||||
|
return qreal(USHRT_MAX);
|
||||||
|
if (format.sampleSize() == 8)
|
||||||
|
return qreal(UCHAR_MAX);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return qreal(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
qreal getBufferLevel(const QAudioBuffer& buffer)
|
// returns the audio level for each channel
|
||||||
|
QVector<qreal> getBufferLevels(const QAudioBuffer& buffer)
|
||||||
{
|
{
|
||||||
|
QVector<qreal> values;
|
||||||
|
|
||||||
if (!buffer.format().isValid() || buffer.format().byteOrder() != QAudioFormat::LittleEndian)
|
if (!buffer.format().isValid() || buffer.format().byteOrder() != QAudioFormat::LittleEndian)
|
||||||
return 0.0;
|
return values;
|
||||||
|
|
||||||
if (buffer.format().codec() != "audio/pcm")
|
if (buffer.format().codec() != "audio/pcm")
|
||||||
return 0.0;
|
return values;
|
||||||
|
|
||||||
|
int channelCount = buffer.format().channelCount();
|
||||||
|
values.fill(0, channelCount);
|
||||||
qreal peak_value = getPeakValue(buffer.format());
|
qreal peak_value = getPeakValue(buffer.format());
|
||||||
if (qFuzzyCompare(peak_value, 0.0))
|
if (qFuzzyCompare(peak_value, qreal(0)))
|
||||||
return 0.0;
|
return values;
|
||||||
|
|
||||||
switch (buffer.format().sampleType()) {
|
switch (buffer.format().sampleType()) {
|
||||||
case QAudioFormat::Unknown:
|
case QAudioFormat::Unknown:
|
||||||
case QAudioFormat::UnSignedInt:
|
case QAudioFormat::UnSignedInt:
|
||||||
|
if (buffer.format().sampleSize() == 32)
|
||||||
|
values = getBufferLevels(buffer.constData<quint32>(), buffer.frameCount(), channelCount);
|
||||||
|
if (buffer.format().sampleSize() == 16)
|
||||||
|
values = getBufferLevels(buffer.constData<quint16>(), buffer.frameCount(), channelCount);
|
||||||
|
if (buffer.format().sampleSize() == 8)
|
||||||
|
values = getBufferLevels(buffer.constData<quint8>(), buffer.frameCount(), channelCount);
|
||||||
|
for (int i = 0; i < values.size(); ++i)
|
||||||
|
values[i] = qAbs(values.at(i) - peak_value / 2) / (peak_value / 2);
|
||||||
break;
|
break;
|
||||||
case QAudioFormat::Float:
|
case QAudioFormat::Float:
|
||||||
if (buffer.format().sampleSize() == 32)
|
if (buffer.format().sampleSize() == 32) {
|
||||||
return getBufferLevel(buffer.constData<float>(), buffer.sampleCount()) / peak_value;
|
values = getBufferLevels(buffer.constData<float>(), buffer.frameCount(), channelCount);
|
||||||
|
for (int i = 0; i < values.size(); ++i)
|
||||||
|
values[i] /= peak_value;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case QAudioFormat::SignedInt:
|
case QAudioFormat::SignedInt:
|
||||||
if (buffer.format().sampleSize() == 32)
|
if (buffer.format().sampleSize() == 32)
|
||||||
return getBufferLevel(buffer.constData<long int>(), buffer.sampleCount()) / peak_value;
|
values = getBufferLevels(buffer.constData<qint32>(), buffer.frameCount(), channelCount);
|
||||||
if (buffer.format().sampleSize() == 16)
|
if (buffer.format().sampleSize() == 16)
|
||||||
return getBufferLevel(buffer.constData<short int>(), buffer.sampleCount()) / peak_value;
|
values = getBufferLevels(buffer.constData<qint16>(), buffer.frameCount(), channelCount);
|
||||||
if (buffer.format().sampleSize() == 8)
|
if (buffer.format().sampleSize() == 8)
|
||||||
return getBufferLevel(buffer.constData<signed char>(), buffer.sampleCount()) / peak_value;
|
values = getBufferLevels(buffer.constData<qint8>(), buffer.frameCount(), channelCount);
|
||||||
|
for (int i = 0; i < values.size(); ++i)
|
||||||
|
values[i] /= peak_value;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0.0;
|
return values;
|
||||||
}
|
}
|
||||||
|
|
||||||
template <class T>
|
template <class T>
|
||||||
qreal getBufferLevel(const T *buffer, int samples)
|
QVector<qreal> getBufferLevels(const T *buffer, int frames, int channels)
|
||||||
{
|
{
|
||||||
qreal max_value = 0.0;
|
QVector<qreal> max_values;
|
||||||
|
max_values.fill(0, channels);
|
||||||
|
|
||||||
for (int i = 0; i < samples; ++i) {
|
for (int i = 0; i < frames; ++i) {
|
||||||
qreal value = qAbs(qreal(buffer[i]));
|
for (int j = 0; j < channels; ++j) {
|
||||||
if (value > max_value)
|
qreal value = qAbs(qreal(buffer[i * channels + j]));
|
||||||
max_value = value;
|
if (value > max_values.at(j))
|
||||||
|
max_values.replace(j, value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return max_value;
|
return max_values;
|
||||||
}
|
}
|
||||||
|
|
||||||
void AudioRecorder::processBuffer(const QAudioBuffer& buffer)
|
void AudioRecorder::processBuffer(const QAudioBuffer& buffer)
|
||||||
{
|
{
|
||||||
qreal level = getBufferLevel(buffer);
|
QVector<qreal> levels = getBufferLevels(buffer);
|
||||||
ui->audioLevel->setLevel(level);
|
for (int i = 0; i < levels.count(); ++i)
|
||||||
|
audioLevels.at(i)->setLevel(levels.at(i));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -52,6 +52,8 @@ class QAudioProbe;
|
|||||||
class QAudioBuffer;
|
class QAudioBuffer;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
class QAudioLevel;
|
||||||
|
|
||||||
class AudioRecorder : public QMainWindow
|
class AudioRecorder : public QMainWindow
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
@@ -68,15 +70,18 @@ private slots:
|
|||||||
void togglePause();
|
void togglePause();
|
||||||
void toggleRecord();
|
void toggleRecord();
|
||||||
|
|
||||||
void updateState(QMediaRecorder::State);
|
void updateStatus(QMediaRecorder::Status);
|
||||||
void updateProgress(qint64 pos);
|
void updateProgress(qint64 pos);
|
||||||
void displayErrorMessage();
|
void displayErrorMessage();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void clearAudioLevels();
|
||||||
|
|
||||||
Ui::AudioRecorder *ui;
|
Ui::AudioRecorder *ui;
|
||||||
|
|
||||||
QAudioRecorder *audioRecorder;
|
QAudioRecorder *audioRecorder;
|
||||||
QAudioProbe *probe;
|
QAudioProbe *probe;
|
||||||
|
QList<QAudioLevel*> audioLevels;
|
||||||
bool outputLocationSet;
|
bool outputLocationSet;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -17,10 +17,10 @@
|
|||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0" colspan="3">
|
<item row="0" column="0" colspan="3">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<item row="0" column="0">
|
<item row="3" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Input Device:</string>
|
<string>Sample rate:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -34,8 +34,12 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="1">
|
<item row="0" column="0">
|
||||||
<widget class="QComboBox" name="audioCodecBox"/>
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Input Device:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="2" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
@@ -47,15 +51,21 @@
|
|||||||
<item row="2" column="1">
|
<item row="2" column="1">
|
||||||
<widget class="QComboBox" name="containerBox"/>
|
<widget class="QComboBox" name="containerBox"/>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="0">
|
<item row="3" column="1">
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QComboBox" name="sampleRateBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="audioCodecBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Sample rate:</string>
|
<string>Channels:</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1">
|
<item row="4" column="1">
|
||||||
<widget class="QComboBox" name="sampleRateBox"/>
|
<widget class="QComboBox" name="channelsBox"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -162,9 +172,8 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item row="3" column="1" colspan="-1">
|
<item row="3" column="1" colspan="2">
|
||||||
<widget class="QAudioLevel" name="audioLevel">
|
<layout class="QVBoxLayout" name="levelsLayout"/>
|
||||||
</widget>
|
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -28,57 +28,33 @@
|
|||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
<y>0</y>
|
<y>0</y>
|
||||||
<width>398</width>
|
<width>400</width>
|
||||||
<height>275</height>
|
<height>277</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QGridLayout" name="gridLayout_4">
|
<layout class="QGridLayout" name="gridLayout_4">
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QWidget" name="widget" native="true">
|
<widget class="QWidget" name="widget" native="true">
|
||||||
<layout class="QGridLayout" name="gridLayout_3">
|
<layout class="QGridLayout" name="gridLayout_3">
|
||||||
<item row="0" column="0">
|
<item row="3" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout_2">
|
<widget class="QLabel" name="label_6">
|
||||||
<item row="0" column="0">
|
<property name="text">
|
||||||
<widget class="QLabel" name="label">
|
<string>Audio Level:</string>
|
||||||
<property name="text">
|
</property>
|
||||||
<string>Input Device:</string>
|
</widget>
|
||||||
</property>
|
</item>
|
||||||
</widget>
|
<item row="2" column="0">
|
||||||
</item>
|
<spacer name="verticalSpacer">
|
||||||
<item row="0" column="1">
|
<property name="orientation">
|
||||||
<widget class="QComboBox" name="audioDeviceBox"/>
|
<enum>Qt::Vertical</enum>
|
||||||
</item>
|
</property>
|
||||||
<item row="1" column="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<size>
|
||||||
<property name="text">
|
<width>20</width>
|
||||||
<string>Audio Codec:</string>
|
<height>29</height>
|
||||||
</property>
|
</size>
|
||||||
</widget>
|
</property>
|
||||||
</item>
|
</spacer>
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QComboBox" name="audioCodecBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>File Container:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QComboBox" name="containerBox"/>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Sample rate:</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="3" column="1">
|
|
||||||
<widget class="QComboBox" name="sampleRateBox"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</item>
|
</item>
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
@@ -127,18 +103,62 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item row="2" column="0">
|
<item row="0" column="0">
|
||||||
<spacer name="verticalSpacer">
|
<layout class="QGridLayout" name="gridLayout_2">
|
||||||
<property name="orientation">
|
<item row="3" column="0">
|
||||||
<enum>Qt::Vertical</enum>
|
<widget class="QLabel" name="label_4">
|
||||||
</property>
|
<property name="text">
|
||||||
<property name="sizeHint" stdset="0">
|
<string>Sample rate:</string>
|
||||||
<size>
|
</property>
|
||||||
<width>20</width>
|
</widget>
|
||||||
<height>29</height>
|
</item>
|
||||||
</size>
|
<item row="1" column="0">
|
||||||
</property>
|
<widget class="QLabel" name="label_2">
|
||||||
</spacer>
|
<property name="text">
|
||||||
|
<string>Audio Codec:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="1">
|
||||||
|
<widget class="QComboBox" name="containerBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="QComboBox" name="audioDeviceBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="3" column="1">
|
||||||
|
<widget class="QComboBox" name="sampleRateBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="1">
|
||||||
|
<widget class="QComboBox" name="audioCodecBox"/>
|
||||||
|
</item>
|
||||||
|
<item row="2" column="0">
|
||||||
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="text">
|
||||||
|
<string>File Container:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="text">
|
||||||
|
<string>Input Device:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<widget class="QLabel" name="label_5">
|
||||||
|
<property name="text">
|
||||||
|
<string>Channels:</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="1">
|
||||||
|
<widget class="QComboBox" name="channelsBox"/>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item row="4" column="0">
|
||||||
|
<layout class="QVBoxLayout" name="levelsLayout"/>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
|
|||||||
@@ -45,6 +45,8 @@ QAudioLevel::QAudioLevel(QWidget *parent)
|
|||||||
: QWidget(parent)
|
: QWidget(parent)
|
||||||
, m_level(0.0)
|
, m_level(0.0)
|
||||||
{
|
{
|
||||||
|
setMinimumHeight(15);
|
||||||
|
setMaximumHeight(50);
|
||||||
}
|
}
|
||||||
|
|
||||||
void QAudioLevel::setLevel(qreal level)
|
void QAudioLevel::setLevel(qreal level)
|
||||||
|
|||||||
Reference in New Issue
Block a user