Ejemplo n.º 1
0
    void timerCallback()
    {
        if (isRunning && recordedSampleNum >= recordedSound.getNumSamples())
        {
            isRunning = false;
            stopTimer();

            // Test has finished, so calculate the result..
            String message;

            const int latencySamples = calculateLatencySamples();

            if (latencySamples >= 0)
            {
                message << "\n\nLatency test results:\n"
                        << latencySamples << " samples (" << String (latencySamples * 1000.0 / sampleRate, 1) << " milliseconds)\n"
                        << "The audio device reports an input latency of "
                        << deviceInputLatency << " samples, output latency of "
                        << deviceOutputLatency << " samples."
                        << "\nSo the corrected latency = "
                        << (latencySamples - deviceInputLatency - deviceOutputLatency)
                        << " samples (" << String ((latencySamples - deviceInputLatency - deviceOutputLatency) * 1000.0 / sampleRate, 2)
                        << " milliseconds)";
            }
            else
            {
                message = "\n\nCouldn't detect the test signal!!\nMake sure there's no background noise that might be confusing it..";
            }

            resultsBox->setCaretPosition (INT_MAX);
            resultsBox->insertTextAtCaret (message);
            resultsBox->setCaretPosition (INT_MAX);
        }
    }
Ejemplo n.º 2
0
    void timerCallback()
    {
        if (testIsRunning && recordedSampleNum >= recordedSound.getNumSamples())
        {
            testIsRunning = false;
            stopTimer();

            // Test has finished, so calculate the result..
            const int latencySamples = calculateLatencySamples();

            resultsBox.moveCaretToEnd();
            resultsBox.insertTextAtCaret (getMessageDescribingResult (latencySamples));
            resultsBox.moveCaretToEnd();
        }
    }