mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2025-05-28 12:22:32 -04:00
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:
parent
f670af39e5
commit
697886465d
@ -1610,13 +1610,14 @@ void MainWindow::read_wav_file (QString const& fname)
|
|||||||
auto bytes_per_frame = file.format ().bytesPerFrame ();
|
auto bytes_per_frame = file.format ().bytesPerFrame ();
|
||||||
int n = file.read (reinterpret_cast<char *> (dec_data.d2),
|
int n = file.read (reinterpret_cast<char *> (dec_data.d2),
|
||||||
std::min (qint64 (bytes_per_frame * ntps), file.size ()));
|
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);
|
std::memset (dec_data.d2 + n, 0, bytes_per_frame * ntps - n);
|
||||||
if (11025 == file.format ().sampleRate ())
|
if (11025 == file.format ().sampleRate ())
|
||||||
{
|
{
|
||||||
auto sample_size = static_cast<short > (file.format ().sampleSize ());
|
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;
|
dec_data.params.newdat = 1;
|
||||||
});
|
});
|
||||||
m_wav_future_watcher.setFuture(m_wav_future); // call diskDat() when done
|
m_wav_future_watcher.setFuture(m_wav_future); // call diskDat() when done
|
||||||
|
Loading…
x
Reference in New Issue
Block a user