Fix a bug in read_wav_file() that made it process and return too few

data points when files with sample rate 11025 Hz are read.


git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@6518 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
Joe Taylor 2016-03-10 16:36:31 +00:00
parent f670af39e5
commit 697886465d

View File

@ -1610,13 +1610,14 @@ void MainWindow::read_wav_file (QString const& fname)
auto bytes_per_frame = file.format ().bytesPerFrame ();
int n = file.read (reinterpret_cast<char *> (dec_data.d2),
std::min (qint64 (bytes_per_frame * ntps), file.size ()));
int npts=n / file.format ().bytesPerFrame ();
std::memset (dec_data.d2 + n, 0, bytes_per_frame * ntps - n);
if (11025 == file.format ().sampleRate ())
{
auto sample_size = static_cast<short > (file.format ().sampleSize ());
wav12_ (dec_data.d2, dec_data.d2, &n, &sample_size);
wav12_ (dec_data.d2, dec_data.d2, &npts, &sample_size);
}
dec_data.params.kin = n / file.format ().bytesPerFrame ();
dec_data.params.kin = npts;
dec_data.params.newdat = 1;
});
m_wav_future_watcher.setFuture(m_wav_future); // call diskDat() when done