Debug messages to GUI terminal
This commit is contained in:
parent
cccd987bdd
commit
a6909f8c16
7 changed files with 131 additions and 80 deletions
|
|
@ -7,13 +7,14 @@
|
|||
|
||||
AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
||||
QGroupBox(parent)
|
||||
, m_pullTimer(new QTimer(this))
|
||||
, m_suspendResumeButton(0)
|
||||
, m_deviceBox(0)
|
||||
, m_output(0)
|
||||
, m_pullTimer(new QTimer(this))
|
||||
, m_device(QAudioDeviceInfo::defaultOutputDevice())
|
||||
, m_audioOutput(0)
|
||||
, m_output(0)
|
||||
, m_buffer(BufferSize, 0)
|
||||
, m_decoder(0)
|
||||
{
|
||||
this->setTitle(name);
|
||||
|
||||
|
|
@ -110,6 +111,7 @@ AudioLayerWidget::AudioLayerWidget(QWidget *parent, QString name):
|
|||
m_format = info.nearestFormat(m_format);
|
||||
}
|
||||
m_decoder = new AudioDecoder(m_format, this);
|
||||
m_decoder->start();
|
||||
connect(m_decoder, SIGNAL(totalTimeChanged(qint64)),
|
||||
this, SLOT(durationChanged(qint64)));
|
||||
connect(m_pullTimer, SIGNAL(timeout()),
|
||||
|
|
@ -128,7 +130,8 @@ void AudioLayerWidget::createAudioOutput()
|
|||
m_audioOutput->setNotifyInterval(100);
|
||||
connect(m_audioOutput, SIGNAL(notify()), SLOT(notified()));
|
||||
connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(handleStateChanged(QAudio::State)));
|
||||
m_decoder->start();
|
||||
m_output = m_audioOutput->start();
|
||||
toggleSuspendResume();
|
||||
}
|
||||
|
||||
void AudioLayerWidget::deviceChanged(int index)
|
||||
|
|
@ -185,8 +188,8 @@ void AudioLayerWidget::pullTimerExpired()
|
|||
while (chunks) {
|
||||
const qint64 len = m_decoder->read(m_buffer.data(), m_audioOutput->periodSize());
|
||||
if ( len == -1) {
|
||||
qDebug() << "End of file";
|
||||
stop();
|
||||
qDebug()<< this->title() << " End of file";
|
||||
break;
|
||||
}
|
||||
if (len) {
|
||||
|
|
@ -250,9 +253,9 @@ void AudioLayerWidget::fileLoaded(QString file)
|
|||
|
||||
void AudioLayerWidget::play()
|
||||
{
|
||||
m_decoder->setPos(0);
|
||||
m_output = m_audioOutput->start();
|
||||
// m_decoder->setPos(0);
|
||||
m_pullTimer->start(20);
|
||||
m_audioOutput->resume();
|
||||
m_statusValue->setText(PLAY_LABEL);
|
||||
m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
|
||||
}
|
||||
|
|
@ -264,10 +267,10 @@ void AudioLayerWidget::pause()
|
|||
|
||||
void AudioLayerWidget::stop()
|
||||
{
|
||||
m_pullTimer->stop();
|
||||
m_audioOutput->suspend();
|
||||
m_audioOutput->reset();
|
||||
m_decoder->setPos(0);
|
||||
m_pullTimer->stop();
|
||||
// m_audioOutput->reset();
|
||||
m_decoder->setPos(44);
|
||||
m_statusValue->setText(STOP_LABEL);
|
||||
m_suspendResumeButton->setText(tr(RESUME_LABEL));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue