diff options
author | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-02-16 13:45:40 (GMT) |
---|---|---|
committer | Gareth Stockwell <ext-gareth.stockwell@nokia.com> | 2010-02-16 17:57:45 (GMT) |
commit | 14c280f706c5612f6e01f5d6677cc85c88df7eb7 (patch) | |
tree | 78c131e6fab0182c1b0ba3ed8ae624de21bb37b0 /examples/multimedia/audiooutput | |
parent | 3b2d9d0644a57ac377a7bcbfd40f8bd6da32cd1f (diff) | |
download | Qt-14c280f706c5612f6e01f5d6677cc85c88df7eb7.zip Qt-14c280f706c5612f6e01f5d6677cc85c88df7eb7.tar.gz Qt-14c280f706c5612f6e01f5d6677cc85c88df7eb7.tar.bz2 |
Changed function names in audio output example to clarify meaning
Reviewed-by: trustme
Diffstat (limited to 'examples/multimedia/audiooutput')
-rw-r--r-- | examples/multimedia/audiooutput/audiooutput.cpp | 31 | ||||
-rw-r--r-- | examples/multimedia/audiooutput/audiooutput.h | 12 |
2 files changed, 20 insertions, 23 deletions
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp index 0c44b4f..4866d36 100644 --- a/examples/multimedia/audiooutput/audiooutput.cpp +++ b/examples/multimedia/audiooutput/audiooutput.cpp @@ -156,7 +156,7 @@ qint64 Generator::bytesAvailable() const } AudioTest::AudioTest() - : m_timer(new QTimer(this)) + : m_pullTimer(new QTimer(this)) , m_modeButton(0) , m_suspendResumeButton(0) , m_deviceBox(0) @@ -182,12 +182,12 @@ void AudioTest::initializeWindow() m_modeButton = new QPushButton(this); m_modeButton->setText(PushModeLabel); - connect(m_modeButton,SIGNAL(clicked()),SLOT(toggle())); + connect(m_modeButton, SIGNAL(clicked()), SLOT(toggleMode())); layout->addWidget(m_modeButton); m_suspendResumeButton = new QPushButton(this); m_suspendResumeButton->setText(SuspendLabel); - connect(m_suspendResumeButton,SIGNAL(clicked()),SLOT(togglePlay())); + connect(m_suspendResumeButton, SIGNAL(clicked()), SLOT(toggleSuspendResume())); layout->addWidget(m_suspendResumeButton); window->setLayout(layout.data()); @@ -200,7 +200,7 @@ void AudioTest::initializeWindow() void AudioTest::initializeAudio() { - connect(m_timer, SIGNAL(timeout()), SLOT(writeMore())); + connect(m_pullTimer, SIGNAL(timeout()), SLOT(pullTimerExpired())); m_pullMode = true; @@ -227,8 +227,8 @@ void AudioTest::createAudioOutput() delete m_audioOutput; m_audioOutput = 0; m_audioOutput = new QAudioOutput(m_format, this); - connect(m_audioOutput, SIGNAL(notify()), SLOT(status())); - connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(state(QAudio::State))); + connect(m_audioOutput, SIGNAL(notify()), SLOT(notified())); + connect(m_audioOutput, SIGNAL(stateChanged(QAudio::State)), SLOT(stateChanged(QAudio::State))); m_generator->start(); m_audioOutput->start(m_generator); } @@ -240,7 +240,7 @@ AudioTest::~AudioTest() void AudioTest::deviceChanged(int index) { - m_timer->stop(); + m_pullTimer->stop(); m_generator->stop(); m_audioOutput->stop(); m_audioOutput->disconnect(this); @@ -248,14 +248,14 @@ void AudioTest::deviceChanged(int index) createAudioOutput(); } -void AudioTest::status() +void AudioTest::notified() { qWarning() << "bytesFree = " << m_audioOutput->bytesFree() << ", " << "elapsedUSecs = " << m_audioOutput->elapsedUSecs() << ", " << "processedUSecs = " << m_audioOutput->processedUSecs(); } -void AudioTest::writeMore() +void AudioTest::pullTimerExpired() { if (m_audioOutput && m_audioOutput->state() != QAudio::StoppedState) { int chunks = m_audioOutput->bytesFree()/m_audioOutput->periodSize(); @@ -270,18 +270,16 @@ void AudioTest::writeMore() } } -void AudioTest::toggle() +void AudioTest::toggleMode() { - // Change between pull and push modes - - m_timer->stop(); + m_pullTimer->stop(); m_audioOutput->stop(); if (m_pullMode) { m_modeButton->setText(PullModeLabel); m_output = m_audioOutput->start(); m_pullMode = false; - m_timer->start(20); + m_pullTimer->start(20); } else { m_modeButton->setText(PushModeLabel); m_pullMode = true; @@ -291,9 +289,8 @@ void AudioTest::toggle() m_suspendResumeButton->setText(SuspendLabel); } -void AudioTest::togglePlay() +void AudioTest::toggleSuspendResume() { - // toggle suspend/resume if (m_audioOutput->state() == QAudio::SuspendedState) { qWarning() << "status: Suspended, resume()"; m_audioOutput->resume(); @@ -311,7 +308,7 @@ void AudioTest::togglePlay() } } -void AudioTest::state(QAudio::State state) +void AudioTest::stateChanged(QAudio::State state) { qWarning() << "state = " << state; } diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h index 1880d8d..889482b 100644 --- a/examples/multimedia/audiooutput/audiooutput.h +++ b/examples/multimedia/audiooutput/audiooutput.h @@ -86,7 +86,7 @@ private: void createAudioOutput(); private: - QTimer* m_timer; + QTimer* m_pullTimer; // Owned by layout QPushButton* m_modeButton; @@ -108,11 +108,11 @@ private: static const QString ResumeLabel; private slots: - void status(); - void writeMore(); - void toggle(); - void togglePlay(); - void state(QAudio::State state); + void notified(); + void pullTimerExpired(); + void toggleMode(); + void toggleSuspendResume(); + void stateChanged(QAudio::State state); void deviceChanged(int index); }; |