Fix bug when changing at the same time folder and file load two time the
file Removed sendDMX() on init Added dome doc in audiolayerwidget.h Cleaned comments on olathread.cpp and olathread.h
This commit is contained in:
parent
eb447007d9
commit
bdd72825db
5 changed files with 58 additions and 48 deletions
|
|
@ -7,14 +7,10 @@
|
|||
#include <QFile>
|
||||
#include <QTime>
|
||||
|
||||
//#include <time.h> // nanosleep y la chapuza de liberar el buffer
|
||||
|
||||
AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
||||
QGroupBox(parent)
|
||||
, m_suspendResumeButton(0)
|
||||
, m_suspendResumeButton(0)
|
||||
, m_watchDMX(new QTimer(this))
|
||||
// , m_progressCounter(new QTime(0,0,0,1))
|
||||
// , m_progressMs(0)
|
||||
, m_currentMedia(" ")
|
||||
, m_running(false)
|
||||
{
|
||||
|
|
@ -105,6 +101,8 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
connect(m_watchDMX, SIGNAL(timeout()),
|
||||
this, SLOT(watchDMXExpired()));
|
||||
m_watchDMX->start(243);
|
||||
|
||||
m_music.setAttenuation(0);
|
||||
}
|
||||
|
||||
AudioLayerWidget::~AudioLayerWidget()
|
||||
|
|
@ -117,7 +115,6 @@ void AudioLayerWidget::volumeChanged(int value)
|
|||
m_music.setVolume(value);
|
||||
}
|
||||
|
||||
// volume range 0 -100
|
||||
void AudioLayerWidget::setVol(qreal vol)
|
||||
{
|
||||
m_music.setVolume(vol);
|
||||
|
|
@ -128,8 +125,7 @@ void AudioLayerWidget::setVol(qreal vol)
|
|||
|
||||
void AudioLayerWidget::loadMedia(QString file)
|
||||
{
|
||||
if (m_currentMedia == file ) {
|
||||
fileLoaded(file);
|
||||
if (m_currentMedia.compare(file) == 0 ) {
|
||||
return;
|
||||
}
|
||||
if (!QFile::exists(file)) {
|
||||
|
|
@ -141,9 +137,8 @@ void AudioLayerWidget::loadMedia(QString file)
|
|||
qWarning("Can not open file %s", file.toLatin1().constData());
|
||||
return;
|
||||
}
|
||||
m_music.setAttenuation(0);
|
||||
|
||||
// m_progressCounter->restart();
|
||||
m_currentMedia = file;
|
||||
durationChanged(m_music.getDuration().asMilliseconds());
|
||||
fileLoaded(file);
|
||||
|
||||
|
|
@ -162,16 +157,8 @@ void AudioLayerWidget::fileLoaded(QString file)
|
|||
m_folderValue->setText(list.at(size - 2));
|
||||
m_fileValue->setText(list.at(size - 1));
|
||||
}
|
||||
// m_progressMs = 0;
|
||||
// m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(m_progressMs));
|
||||
}
|
||||
/*
|
||||
void AudioLayerWidget::notified()
|
||||
{
|
||||
|
||||
}
|
||||
*/
|
||||
// duration in miliseconds
|
||||
void AudioLayerWidget::durationChanged(qint64 dur)
|
||||
{
|
||||
m_progressSlider->setMaximum(dur);
|
||||
|
|
@ -181,13 +168,11 @@ void AudioLayerWidget::durationChanged(qint64 dur)
|
|||
void AudioLayerWidget::play()
|
||||
{
|
||||
m_music.play();
|
||||
// m_progressCounter->restart();
|
||||
}
|
||||
|
||||
void AudioLayerWidget::pause()
|
||||
{
|
||||
m_music.pause();
|
||||
// m_progressCounter->restart();
|
||||
}
|
||||
|
||||
void AudioLayerWidget::stop()
|
||||
|
|
@ -200,7 +185,6 @@ void AudioLayerWidget::watchDMXExpired() {
|
|||
int progress;
|
||||
switch (m_music.getStatus()) {
|
||||
case sf::SoundSource::Playing:
|
||||
// m_progressMs += m_progressCounter->restart();
|
||||
progress = m_music.getPlayingOffset().asMilliseconds();
|
||||
m_progressSlider->setValue(progress);
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(progress));
|
||||
|
|
@ -212,8 +196,6 @@ void AudioLayerWidget::watchDMXExpired() {
|
|||
m_suspendResumeButton->setText(tr(RESUME_LABEL));
|
||||
break;
|
||||
case sf::SoundSource::Stopped:
|
||||
// m_progressCounter->restart();
|
||||
// m_progressMs = 0;
|
||||
m_progressTime->setTime(QTime::fromMSecsSinceStartOfDay(0));
|
||||
m_statusValue->setText(STOP_LABEL);
|
||||
m_suspendResumeButton->setText(tr(RESUME_LABEL));
|
||||
|
|
@ -221,20 +203,13 @@ void AudioLayerWidget::watchDMXExpired() {
|
|||
break;
|
||||
}
|
||||
}
|
||||
/*
|
||||
void AudioLayerWidget::updateWatchDMX(bool b)
|
||||
{
|
||||
// m_receiveDMX->setChecked(b);
|
||||
}
|
||||
*/
|
||||
|
||||
void AudioLayerWidget::toggleSuspendResume()
|
||||
{
|
||||
if (m_music.getStatus() == sf::SoundSource::Playing) {
|
||||
m_music.pause();
|
||||
// m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
|
||||
} else {
|
||||
m_music.play();
|
||||
// m_suspendResumeButton->setText(tr(PLAY_LABEL));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue