pan, pitch, loop
This commit is contained in:
parent
5d57eb705a
commit
ba9fcfadeb
12 changed files with 196 additions and 51 deletions
|
|
@ -28,13 +28,19 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
// status->addWidget(m_receiveDMX);
|
||||
status->addWidget(m_statusLabel);
|
||||
status->addWidget(m_statusValue);
|
||||
m_loopCheckLabel = new QLabel;
|
||||
m_loopCheckLabel->setText("Loop");
|
||||
m_loopCheck = new QCheckBox();
|
||||
connect(m_loopCheck, SIGNAL(stateChanged(int)), this, SLOT(loopChanged(int)));
|
||||
status->addWidget(m_loopCheckLabel);
|
||||
status->addWidget(m_loopCheck);
|
||||
layout->addLayout(status);
|
||||
|
||||
QHBoxLayout *folderLoaded = new QHBoxLayout;
|
||||
m_folderLabel = new QLabel;
|
||||
m_folderLabel->setText(FOLDER_LABEL);
|
||||
m_folderValue = new QLabel;
|
||||
m_folderValue->setMaximumWidth(150);
|
||||
m_folderValue->setMaximumWidth(200);
|
||||
folderLoaded->addWidget(m_folderLabel);
|
||||
folderLoaded->addWidget(m_folderValue);
|
||||
layout->addLayout(folderLoaded);
|
||||
|
|
@ -43,24 +49,42 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
m_fileLabel = new QLabel;
|
||||
m_fileLabel->setText(FILE_LABEL);
|
||||
m_fileValue = new QLabel;
|
||||
m_fileValue->setMaximumWidth(150);
|
||||
m_fileValue->setMaximumWidth(200);
|
||||
fileLoaded->addWidget(m_fileLabel);
|
||||
fileLoaded->addWidget(m_fileValue);
|
||||
layout->addLayout(fileLoaded);
|
||||
|
||||
QHBoxLayout *volumeBox = new QHBoxLayout;
|
||||
QGridLayout *volumeBox = new QGridLayout;
|
||||
m_volumeLabel = new QLabel;
|
||||
m_volumeLabel->setText(tr(VOLUME_LABEL));
|
||||
m_volumeSlider = new QSlider(Qt::Horizontal);
|
||||
m_volumeSlider->setMinimum(0);
|
||||
m_volumeSlider->setMaximum(80);
|
||||
m_volumeSlider->setMaximum(90);
|
||||
m_volumeSlider->setSingleStep(1);
|
||||
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
volumeBox->addWidget(m_volumeLabel);
|
||||
volumeBox->addWidget(m_volumeSlider);
|
||||
volumeBox->addWidget(m_volumeLabel, 0, 0);
|
||||
volumeBox->addWidget(m_volumeSlider, 0, 1);
|
||||
m_panLabel = new QLabel;
|
||||
m_panLabel->setText("Pan");
|
||||
m_panSlider = new QSlider(Qt::Horizontal);
|
||||
m_panSlider->setMinimum(0);
|
||||
m_panSlider->setMaximum(255);
|
||||
m_panSlider->setSingleStep(1);
|
||||
connect(m_panSlider, SIGNAL(valueChanged(int)), this, SLOT(panChanged(int)));
|
||||
volumeBox->addWidget(m_panLabel, 1, 0);
|
||||
volumeBox->addWidget(m_panSlider, 1, 1);
|
||||
m_pitchLabel = new QLabel;
|
||||
m_pitchLabel->setText("Pitch");
|
||||
m_pitchSlider = new QSlider(Qt::Horizontal);
|
||||
m_pitchSlider->setMinimum(0);
|
||||
m_pitchSlider->setMaximum(255);
|
||||
m_pitchSlider->setSingleStep(1);
|
||||
connect(m_pitchSlider, SIGNAL(valueChanged(int)), this, SLOT(pitchChanged(int)));
|
||||
volumeBox->addWidget(m_pitchLabel, 2, 0);
|
||||
volumeBox->addWidget(m_pitchSlider, 2, 1);
|
||||
layout->addLayout(volumeBox);
|
||||
|
||||
QGridLayout *progressTime = new QGridLayout;
|
||||
QHBoxLayout *progressTime = new QHBoxLayout;
|
||||
m_progressTimeLabel = new QLabel;
|
||||
m_progressTimeLabel->setText(PROGRESS_TIME_LABEL);
|
||||
m_progressTime = new QTimeEdit;
|
||||
|
|
@ -68,19 +92,18 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
m_progressTime->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_progressTime->setReadOnly(true);
|
||||
m_progressTime->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_progressTime->setMaximumWidth(80);
|
||||
progressTime->addWidget(m_progressTimeLabel, 0 ,0);
|
||||
progressTime->addWidget(m_progressTime,0 ,1);
|
||||
|
||||
m_progressTime->setMaximumWidth(120);
|
||||
progressTime->addWidget(m_progressTimeLabel);
|
||||
progressTime->addWidget(m_progressTime);
|
||||
m_totalTimeLabel = new QLabel;
|
||||
m_totalTimeLabel->setText(TOTAL_TIME_LABEL);
|
||||
m_totalTimeValue = new QTimeEdit;
|
||||
m_totalTimeValue->setDisplayFormat("h:mm:ss:zzz");
|
||||
m_totalTimeValue->setReadOnly(true);
|
||||
m_totalTimeValue->setButtonSymbols(QAbstractSpinBox::NoButtons);
|
||||
m_totalTimeValue->setMaximumWidth(80);
|
||||
progressTime->addWidget(m_totalTimeLabel,1 , 0);
|
||||
progressTime->addWidget(m_totalTimeValue, 1 ,1);
|
||||
m_totalTimeValue->setMaximumWidth(120);
|
||||
progressTime->addWidget(m_totalTimeLabel);
|
||||
progressTime->addWidget(m_totalTimeValue);
|
||||
layout->addLayout(progressTime);
|
||||
|
||||
QHBoxLayout *progressSlider = new QHBoxLayout;
|
||||
|
|
@ -100,7 +123,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
|
||||
connect(m_watchDMX, SIGNAL(timeout()),
|
||||
this, SLOT(watchDMXExpired()));
|
||||
m_watchDMX->start(243);
|
||||
m_watchDMX->start(100);
|
||||
|
||||
m_music.setAttenuation(0);
|
||||
}
|
||||
|
|
@ -115,6 +138,21 @@ void AudioLayerWidget::volumeChanged(int value)
|
|||
m_music.setVolume(value);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::panChanged(int value)
|
||||
{
|
||||
m_music.setPosition((value - 128) / 32.0, 0, 0);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::pitchChanged(int value)
|
||||
{
|
||||
m_music.setPitch(qreal(value / 128.0 ));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::loopChanged(int value)
|
||||
{
|
||||
m_music.setLoop(value);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setVol(qreal vol)
|
||||
{
|
||||
m_music.setVolume(vol);
|
||||
|
|
@ -123,6 +161,22 @@ void AudioLayerWidget::setVol(qreal vol)
|
|||
m_volumeSlider->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPan(qreal pan)
|
||||
{
|
||||
m_music.setPosition(float((pan - 128) / 32.0), 0, 0);
|
||||
m_panSlider->blockSignals(true);
|
||||
m_panSlider->setValue(pan);
|
||||
m_panSlider->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPitch(qreal pitch)
|
||||
{
|
||||
m_music.setPitch(float(pitch / 128 ));
|
||||
m_pitchSlider->blockSignals(true);
|
||||
m_pitchSlider->setValue(pitch);
|
||||
m_pitchSlider->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::loadMedia(QString file)
|
||||
{
|
||||
if (m_currentMedia.compare(file) == 0 ) {
|
||||
|
|
@ -165,9 +219,13 @@ void AudioLayerWidget::durationChanged(qint64 dur)
|
|||
m_totalTimeValue->setTime(QTime::fromMSecsSinceStartOfDay(dur));
|
||||
}
|
||||
|
||||
void AudioLayerWidget::play()
|
||||
void AudioLayerWidget::play(bool loop)
|
||||
{
|
||||
m_music.play();
|
||||
m_music.setLoop(loop);
|
||||
m_loopCheck->blockSignals(true);
|
||||
m_loopCheck->setChecked(m_music.getLoop());
|
||||
m_loopCheck->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::pause()
|
||||
|
|
@ -202,6 +260,9 @@ void AudioLayerWidget::watchDMXExpired() {
|
|||
m_progressSlider->setValue(0);
|
||||
break;
|
||||
}
|
||||
//m_loopCheck->blockSignals(true);
|
||||
//m_loopCheck->setChecked(m_music.getLoop());
|
||||
//m_loopCheck->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::toggleSuspendResume()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue