aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-06-14 09:58:45 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2009-06-14 09:58:45 +0000
commit6153299af6c5859ed9530c845552f9f6253417bb (patch)
tree904f52bb22a505a1569a6150477be55a678f4446
parentd09469625cc54c4cd5f0b8638abbdfd3c59077c5 (diff)
downloadqmmp-6153299af6c5859ed9530c845552f9f6253417bb.tar.gz
qmmp-6153299af6c5859ed9530c845552f9f6253417bb.tar.bz2
qmmp-6153299af6c5859ed9530c845552f9f6253417bb.zip
fixed audio distortion in the end of file
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@970 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/qmmp/decoder.cpp2
-rw-r--r--src/qmmp/output.cpp2
-rw-r--r--src/qmmp/recycler.cpp14
3 files changed, 4 insertions, 14 deletions
diff --git a/src/qmmp/decoder.cpp b/src/qmmp/decoder.cpp
index 344154164..d555348cb 100644
--- a/src/qmmp/decoder.cpp
+++ b/src/qmmp/decoder.cpp
@@ -171,7 +171,7 @@ qint64 Decoder::produceSound(char *data, qint64 size, quint32 brate, int chan)
if (w < blksize + b->exceeding)
memset(b->data + w, 0, blksize + b->exceeding - w);
- b->nbytes = w;// blksize;
+ b->nbytes = w;
b->rate = brate;
output()->recycler()->add();
diff --git a/src/qmmp/output.cpp b/src/qmmp/output.cpp
index 77a28a39a..61c9658e9 100644
--- a/src/qmmp/output.cpp
+++ b/src/qmmp/output.cpp
@@ -190,7 +190,7 @@ void Output::run()
dispatchVisual(b, m_totalWritten, m_channels, m_precision);
changeVolume(b->data, b->nbytes, m_channels);
if ((l = writeAudio(b->data, b->nbytes)) > 0)
- m_totalWritten += b->nbytes;
+ m_totalWritten += l;
else
break;
}
diff --git a/src/qmmp/recycler.cpp b/src/qmmp/recycler.cpp
index 67d4e4f7e..e718d9c46 100644
--- a/src/qmmp/recycler.cpp
+++ b/src/qmmp/recycler.cpp
@@ -12,7 +12,7 @@
Recycler::Recycler ( unsigned int sz )
: add_index ( 0 ), done_index ( 0 ), current_count ( 0 )
{
- buffer_count = ( sz / Buffer::size() );
+ buffer_count = sz / Buffer::size();
if (buffer_count < 4)
{
buffer_count = 4;
@@ -87,7 +87,7 @@ void Recycler::add()
Buffer *Recycler::next()
{
- return buffers[done_index];
+ return empty() ? 0 : buffers[done_index];
}
@@ -102,16 +102,6 @@ void Recycler::done()
void Recycler::clear()
{
add_index = done_index = current_count = 0;
- /*for ( unsigned int i = 0; i < buffer_count; i ++ )
- {
- if(buffers[i]->exceeding > 0)
- {
- delete buffers[i]->data;
- buffers[i]->data = new unsigned char[Buffer::size()];
- buffers[i]->exceeding = 0;
- buffers[i]->nbytes = 0;
- }
- }*/
}