[Interest] Audio Output Example Push/Pull mode is confusing.

Steve Schilz sschilz at pasco.com
Thu Jul 10 01:47:33 CEST 2014


Hi, I'm looking at the Audio Output Example, and it seems to me that the
variable naming regarding push/pull mode is wrong.
See the comments  to the right of the code example and suggested
solution below.

void AudioTest::toggleMode()
{
    m_pullTimer->stop();
    m_audioOutput->stop();

    if (m_pullMode) {

        m_modeButton->setText(tr(PULL_MODE_LABEL));
// Text is "Enable Pull Mode", so this should maybe be
"ENABLE_PULL_MODE_LABEL".  
        m_output = m_audioOutput->start();
        m_pullMode = false;
        m_pullTimer->start(20);
// << Shouldn't this be 'm_pushTimer'????
    } else {
        m_modeButton->setText(tr(PUSH_MODE_LABEL));
// Text is "Enable Push Mode", this should maybe be
"ENABLE_PUSH_MODE_LABEL"
        m_pullMode = true;
        m_audioOutput->start(m_generator);
    }

    m_suspendResumeButton->setText(tr(SUSPEND_LABEL));
}

So if I am understanding this correctly, the following changes would
make the meaning more clear. 
1. rename  m_pullTimer  to m_pushTimer
2. rename pullTimerExpired() to pushTimerExpired()
3. Rename both MODE_LABEL #defines  to ENABLE_PUSH_MODE_LABEL and
ENABLE_PULL_MODE_LABEL


I will file a bug report if someone can confirm my understanding.


Steve Schilz
Software Engineer
PASCO scientific
10101 Foothills Blvd.
Roseville, CA. 95747 USA
916-786-3800 x8271
sschilz at pasco.com
www.pasco.com http://www.pasco.com
Innovative Solutions for Teaching Science




More information about the Interest mailing list