comparison data/fileio/MP3FileReader.cpp @ 1343:c380e56c95f5 3.0-integration

Untabify some more
author Chris Cannam
date Fri, 06 Jan 2017 09:50:13 +0000
parents c0fece5e7755
children 75ad55315db4
comparison
equal deleted inserted replaced
1342:c0fece5e7755 1343:c380e56c95f5
97 #endif 97 #endif
98 , 0)) < 0) { 98 , 0)) < 0) {
99 m_error = QString("Failed to open file %1 for reading.").arg(m_path); 99 m_error = QString("Failed to open file %1 for reading.").arg(m_path);
100 SVDEBUG << "MP3FileReader: " << m_error << endl; 100 SVDEBUG << "MP3FileReader: " << m_error << endl;
101 return; 101 return;
102 } 102 }
103 103
104 try { 104 try {
105 // We need a mysterious MAD_BUFFER_GUARD (== 8) zero bytes at 105 // We need a mysterious MAD_BUFFER_GUARD (== 8) zero bytes at
106 // end of input, to ensure libmad decodes the last frame 106 // end of input, to ensure libmad decodes the last frame
107 // correctly. Otherwise the decoded audio is truncated. 107 // correctly. Otherwise the decoded audio is truncated.
481 return data->reader->accept(header, pcm); 481 return data->reader->accept(header, pcm);
482 } 482 }
483 483
484 enum mad_flow 484 enum mad_flow
485 MP3FileReader::accept(struct mad_header const *header, 485 MP3FileReader::accept(struct mad_header const *header,
486 struct mad_pcm *pcm) 486 struct mad_pcm *pcm)
487 { 487 {
488 int channels = pcm->channels; 488 int channels = pcm->channels;
489 int frames = pcm->length; 489 int frames = pcm->length;
490 490
491 if (header) { 491 if (header) {
550 550
551 for (int ch = 0; ch < channels; ++ch) { 551 for (int ch = 0; ch < channels; ++ch) {
552 552
553 for (int i = 0; i < frames; ++i) { 553 for (int i = 0; i < frames; ++i) {
554 554
555 mad_fixed_t sample = 0; 555 mad_fixed_t sample = 0;
556 if (ch < activeChannels) { 556 if (ch < activeChannels) {
557 sample = pcm->samples[ch][i]; 557 sample = pcm->samples[ch][i];
558 } 558 }
559 float fsample = float(sample) / float(MAD_F_ONE); 559 float fsample = float(sample) / float(MAD_F_ONE);
560 560
561 m_sampleBuffer[ch][i] = fsample; 561 m_sampleBuffer[ch][i] = fsample;
562 } 562 }
563 } 563 }
564 564
565 addSamplesToDecodeCache(m_sampleBuffer, frames); 565 addSamplesToDecodeCache(m_sampleBuffer, frames);
566 566
567 ++m_mp3FrameCount; 567 ++m_mp3FrameCount;