diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-08 21:38:26 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-03-08 21:38:26 +0000 |
| commit | 26968dcbfbf6f9ef63f226adb3b255b8a8ae4762 (patch) | |
| tree | 4ab98bd776d1e429343a4b47f08baf23a4b1805f /src | |
| parent | 17fb7cdbac398cb54e3bcb167da959fcfc286b40 (diff) | |
| download | qmmp-26968dcbfbf6f9ef63f226adb3b255b8a8ae4762.tar.gz qmmp-26968dcbfbf6f9ef63f226adb3b255b8a8ae4762.tar.bz2 qmmp-26968dcbfbf6f9ef63f226adb3b255b8a8ae4762.zip | |
some api changes
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@833 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src')
| -rw-r--r-- | src/plugins/Output/alsa/outputalsa.cpp | 10 | ||||
| -rw-r--r-- | src/qmmp/output.cpp | 17 | ||||
| -rw-r--r-- | src/qmmp/output.h | 3 |
3 files changed, 20 insertions, 10 deletions
diff --git a/src/plugins/Output/alsa/outputalsa.cpp b/src/plugins/Output/alsa/outputalsa.cpp index 5974efa06..63922ead1 100644 --- a/src/plugins/Output/alsa/outputalsa.cpp +++ b/src/plugins/Output/alsa/outputalsa.cpp @@ -222,15 +222,7 @@ bool OutputALSA::initialize() qint64 OutputALSA::latency() { - long used = 0; - - /*if (! m_pause) - { - if (ioctl(audio_fd, SNDCTL_DSP_GETODELAY, &used) == -1) - used = 0; - }*/ - - return used; + return m_prebuf_fill * 8000 / sampleRate() / numChannels() / sampleSize(); } qint64 OutputALSA::writeAudio(unsigned char *data, qint64 maxSize) diff --git a/src/qmmp/output.cpp b/src/qmmp/output.cpp index c5ad809f7..90591baf7 100644 --- a/src/qmmp/output.cpp +++ b/src/qmmp/output.cpp @@ -76,6 +76,21 @@ void Output::setStateHandler(StateHandler *handler) m_handler = handler; } +quint32 Output::sampleRate() +{ + return m_frequency; +} + +int Output::numChannels() +{ + return m_channels; +} + +int Output::sampleSize() +{ + return m_precision; +} + Output::~Output() {} @@ -190,7 +205,7 @@ void Output::run() void Output::status() { - qint64 ct = (m_totalWritten - latency()) / m_bytesPerMillisecond; + qint64 ct = m_totalWritten / m_bytesPerMillisecond - latency(); if (ct < 0) ct = 0; diff --git a/src/qmmp/output.h b/src/qmmp/output.h index d50be846d..24056adbd 100644 --- a/src/qmmp/output.h +++ b/src/qmmp/output.h @@ -45,6 +45,9 @@ public: Recycler *recycler(); QMutex *mutex(); void setStateHandler(StateHandler *handler); + quint32 sampleRate(); + int numChannels(); + int sampleSize(); static void registerFactory(OutputFactory *); static Output *create(QObject *); |
