summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-02-16 11:25:41 (GMT)
committerGareth Stockwell <ext-gareth.stockwell@nokia.com>2010-02-16 17:57:37 (GMT)
commit6c67fef3218ec5361b3f9a30fc53c529295da9e4 (patch)
tree50d2da8723dbcada482604635a9546434d13244d
parentf25119cb0406341e7cbb6ac679662f28fc7ab431 (diff)
downloadQt-6c67fef3218ec5361b3f9a30fc53c529295da9e4.zip
Qt-6c67fef3218ec5361b3f9a30fc53c529295da9e4.tar.gz
Qt-6c67fef3218ec5361b3f9a30fc53c529295da9e4.tar.bz2
Added missing override in audio output example
Because the QIODevice-derived class Generator owns its own internal buffer, it must override bytesAvailable(). Reviewed-by: trustme
-rw-r--r--examples/multimedia/audiooutput/audiooutput.cpp5
-rw-r--r--examples/multimedia/audiooutput/audiooutput.h1
2 files changed, 6 insertions, 0 deletions
diff --git a/examples/multimedia/audiooutput/audiooutput.cpp b/examples/multimedia/audiooutput/audiooutput.cpp
index b44accd..9a9af86 100644
--- a/examples/multimedia/audiooutput/audiooutput.cpp
+++ b/examples/multimedia/audiooutput/audiooutput.cpp
@@ -75,6 +75,11 @@ void Generator::start()
open(QIODevice::ReadOnly);
}
+qint64 Generator::bytesAvailable() const
+{
+ return (SECONDS*SYSTEM_FREQ*2)-pos + QIODevice::bytesAvailable();
+}
+
void Generator::stop()
{
close();
diff --git a/examples/multimedia/audiooutput/audiooutput.h b/examples/multimedia/audiooutput/audiooutput.h
index 372cf78..eba6446 100644
--- a/examples/multimedia/audiooutput/audiooutput.h
+++ b/examples/multimedia/audiooutput/audiooutput.h
@@ -72,6 +72,7 @@ public:
qint64 readData(char *data, qint64 maxlen);
qint64 writeData(const char *data, qint64 len);
+ qint64 bytesAvailable() const;
private:
int putShort(char *t, unsigned int value);