summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qaudioinput_win32_p.cpp
diff options
context:
space:
mode:
authorKurt Korbatits <kurt.korbatits@nokia.com>2009-09-30 04:53:37 (GMT)
committerKurt Korbatits <kurt.korbatits@nokia.com>2009-09-30 04:53:37 (GMT)
commitf4bcf5c9fd51ed1923239ea1ad0d78bcd3d56f62 (patch)
treee149c3d355882cec80031b7bc0927ee1a9375809 /src/multimedia/audio/qaudioinput_win32_p.cpp
parent8c3bf71e6fcbcfb21b9574e25cfdb00614a0c68d (diff)
downloadQt-f4bcf5c9fd51ed1923239ea1ad0d78bcd3d56f62.zip
Qt-f4bcf5c9fd51ed1923239ea1ad0d78bcd3d56f62.tar.gz
Qt-f4bcf5c9fd51ed1923239ea1ad0d78bcd3d56f62.tar.bz2
Fixed error in notify() signal and totalTime() in QAudioInput and
QAudioOutput. -The notify() signal was not firing the correct number of times. -The totalTime() on wince was incorrect (unit test). Reviewed-by:Justin McPherson
Diffstat (limited to 'src/multimedia/audio/qaudioinput_win32_p.cpp')
-rw-r--r--src/multimedia/audio/qaudioinput_win32_p.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp
index 31441ae..d4226f5 100644
--- a/src/multimedia/audio/qaudioinput_win32_p.cpp
+++ b/src/multimedia/audio/qaudioinput_win32_p.cpp
@@ -59,6 +59,8 @@ QT_BEGIN_NAMESPACE
static CRITICAL_SECTION waveInCriticalSection;
+static const int minimumIntervalTime = 50;
+
QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat):
settings(audioFormat)
{
@@ -226,6 +228,7 @@ bool QAudioInputPrivate::open()
period_size = buffer_size/2;
#endif
timeStamp.restart();
+ elapsedTimeOffset = 0;
wfx.nSamplesPerSec = settings.frequency();
wfx.wBitsPerSample = settings.sampleSize();
wfx.nChannels = settings.channels();
@@ -297,6 +300,7 @@ bool QAudioInputPrivate::open()
return false;
}
timeStampOpened.restart();
+ elapsedTimeOffset = 0;
totalTimeValue = 0;
errorState = QAudio::NoError;
deviceState = QAudio::ActiveState;
@@ -473,7 +477,10 @@ int QAudioInputPrivate::periodSize() const
void QAudioInputPrivate::setNotifyInterval(int ms)
{
- intervalTime = ms;
+ if(ms >= minimumIntervalTime)
+ intervalTime = ms;
+ else
+ intervalTime = minimumIntervalTime;
}
int QAudioInputPrivate::notifyInterval() const
@@ -524,8 +531,9 @@ bool QAudioInputPrivate::deviceReady()
if(deviceState != QAudio::ActiveState)
return true;
- if(timeStamp.elapsed() > intervalTime && intervalTime > 50) {
+ if((timeStamp.elapsed() + elapsedTimeOffset) > intervalTime) {
emit notify();
+ elapsedTimeOffset = timeStamp.elapsed() + elapsedTimeOffset - intervalTime;
timeStamp.restart();
}
return true;