pan not working, can not pan an stereo track with openAl.
I will change to miniaudio, tag this before changes.
This commit is contained in:
parent
ba9fcfadeb
commit
78695b7976
11 changed files with 108 additions and 59 deletions
|
|
@ -28,12 +28,12 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
// status->addWidget(m_receiveDMX);
|
||||
status->addWidget(m_statusLabel);
|
||||
status->addWidget(m_statusValue);
|
||||
m_loopCheck = new QCheckBox();
|
||||
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);
|
||||
status->addWidget(m_loopCheckLabel);
|
||||
layout->addLayout(status);
|
||||
|
||||
QHBoxLayout *folderLoaded = new QHBoxLayout;
|
||||
|
|
@ -61,9 +61,14 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
m_volumeSlider->setMinimum(0);
|
||||
m_volumeSlider->setMaximum(90);
|
||||
m_volumeSlider->setSingleStep(1);
|
||||
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
m_volumeIndicator = new QLabel;
|
||||
volumeBox->addWidget(m_volumeLabel, 0, 0);
|
||||
volumeBox->addWidget(m_volumeSlider, 0, 1);
|
||||
volumeBox->addWidget(m_volumeIndicator, 0, 2);
|
||||
connect(m_volumeSlider, SIGNAL(valueChanged(int)), this, SLOT(volumeChanged(int)));
|
||||
connect(m_volumeSlider, &QSlider::valueChanged, this, [=] () {
|
||||
m_volumeIndicator->setText(QString::number(m_volumeSlider->value()));
|
||||
});
|
||||
m_panLabel = new QLabel;
|
||||
m_panLabel->setText("Pan");
|
||||
m_panSlider = new QSlider(Qt::Horizontal);
|
||||
|
|
@ -122,7 +127,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
this->setLayout(layout);
|
||||
|
||||
connect(m_watchDMX, SIGNAL(timeout()),
|
||||
this, SLOT(watchDMXExpired()));
|
||||
this, SLOT(refreshGUI()));
|
||||
m_watchDMX->start(100);
|
||||
|
||||
m_music.setAttenuation(0);
|
||||
|
|
@ -140,7 +145,16 @@ void AudioLayerWidget::volumeChanged(int value)
|
|||
|
||||
void AudioLayerWidget::panChanged(int value)
|
||||
{
|
||||
m_music.setPosition((value - 128) / 32.0, 0, 0);
|
||||
m_music.setRelativeToListener(true);
|
||||
sf::Vector3f pos = m_music.getPosition();
|
||||
//m_music.setSpati(0, 0, 0);
|
||||
qreal pan = (value - 128) / 64.0f;
|
||||
qWarning("change pan %f", pan);
|
||||
//m_music.setPosition(pan, 0.0, sqrtf(1.0 + pan*pan));
|
||||
m_music.setPosition(pan, 0.0f, -1.0f);
|
||||
//pos = m_music.getPosition();
|
||||
qWarning("%f %f %f", pos.x, pos.y, pos.z);
|
||||
qWarning("is rel %i", m_music.isRelativeToListener());
|
||||
}
|
||||
|
||||
void AudioLayerWidget::pitchChanged(int value)
|
||||
|
|
@ -158,12 +172,13 @@ void AudioLayerWidget::setVol(qreal vol)
|
|||
m_music.setVolume(vol);
|
||||
m_volumeSlider->blockSignals(true);
|
||||
m_volumeSlider->setValue(vol);
|
||||
m_volumeIndicator->setText(QString::number(vol));
|
||||
m_volumeSlider->blockSignals(false);
|
||||
}
|
||||
|
||||
void AudioLayerWidget::setPan(qreal pan)
|
||||
{
|
||||
m_music.setPosition(float((pan - 128) / 32.0), 0, 0);
|
||||
this->panChanged(pan);
|
||||
m_panSlider->blockSignals(true);
|
||||
m_panSlider->setValue(pan);
|
||||
m_panSlider->blockSignals(false);
|
||||
|
|
@ -238,7 +253,7 @@ void AudioLayerWidget::stop()
|
|||
m_music.stop();
|
||||
}
|
||||
|
||||
void AudioLayerWidget::watchDMXExpired() {
|
||||
void AudioLayerWidget::refreshGUI() {
|
||||
// m_receiveDMX->setChecked(false);
|
||||
int progress;
|
||||
switch (m_music.getStatus()) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue