comparison data/fileio/WavFileReader.cpp @ 1170:6877f4200912 3.0-integration

Merge from default branch
author Chris Cannam
date Wed, 02 Mar 2016 16:16:36 +0000
parents 457a1a619c5f 1dd98a5432cf
children d8d6d01505ed
comparison
equal deleted inserted replaced
1160:ea636412f9fe 1170:6877f4200912
60 m_channelCount = m_fileInfo.channels; 60 m_channelCount = m_fileInfo.channels;
61 m_sampleRate = m_fileInfo.samplerate; 61 m_sampleRate = m_fileInfo.samplerate;
62 62
63 m_seekable = (m_fileInfo.seekable != 0); 63 m_seekable = (m_fileInfo.seekable != 0);
64 64
65 // Our m_seekable reports whether a file is rapidly seekable,
66 // so things like Ogg don't qualify. We cautiously report
67 // every file type of "at least" the historical period of Ogg
68 // or FLAC as non-seekable.
69 int type = m_fileInfo.format & SF_FORMAT_TYPEMASK; 65 int type = m_fileInfo.format & SF_FORMAT_TYPEMASK;
70 // cerr << "WavFileReader: format type is " << type << " (flac, ogg are " << SF_FORMAT_FLAC << ", " << SF_FORMAT_OGG << ")" << endl; 66 int subtype = m_fileInfo.format & SF_FORMAT_SUBMASK;
67
71 if (type >= SF_FORMAT_FLAC || type >= SF_FORMAT_OGG) { 68 if (type >= SF_FORMAT_FLAC || type >= SF_FORMAT_OGG) {
72 // cerr << "WavFileReader: Recording as non-seekable" << endl; 69 // Our m_seekable reports whether a file is rapidly
70 // seekable, so things like Ogg don't qualify. We
71 // cautiously report every file type of "at least" the
72 // historical period of Ogg or FLAC as non-seekable.
73 m_seekable = false; 73 m_seekable = false;
74 } else if (type == SF_FORMAT_WAV && subtype <= SF_FORMAT_DOUBLE) {
75 // libsndfile 1.0.26 has a bug (subsequently fixed in the
76 // repo) that causes all files to be reported as
77 // non-seekable. We know that certain common file types
78 // are definitely seekable so, again cautiously, identify
79 // and mark those (basically only non-adaptive WAVs).
80 m_seekable = true;
74 } 81 }
75 } 82 }
76 83
77 // cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << ", seekable " << m_seekable << endl; 84 // cerr << "WavFileReader: Filename " << m_path << ", frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << ", format " << m_fileInfo.format << ", seekable " << m_fileInfo.seekable << " adjusted to " << m_seekable << endl;
78
79 } 85 }
80 86
81 WavFileReader::~WavFileReader() 87 WavFileReader::~WavFileReader()
82 { 88 {
83 if (m_file) sf_close(m_file); 89 if (m_file) sf_close(m_file);