comparison data/fileio/WavFileReader.cpp @ 825:69bde159744f tonioni

Merge from default branch
author Chris Cannam
date Wed, 17 Jul 2013 15:41:20 +0100
parents f0558e69a074
children e802e550a1f2
comparison
equal deleted inserted replaced
822:54829c1e155e 825:69bde159744f
22 22
23 WavFileReader::WavFileReader(FileSource source, bool fileUpdating) : 23 WavFileReader::WavFileReader(FileSource source, bool fileUpdating) :
24 m_file(0), 24 m_file(0),
25 m_source(source), 25 m_source(source),
26 m_path(source.getLocalFilename()), 26 m_path(source.getLocalFilename()),
27 m_seekable(false),
27 m_buffer(0), 28 m_buffer(0),
28 m_bufsiz(0), 29 m_bufsiz(0),
29 m_lastStart(0), 30 m_lastStart(0),
30 m_lastCount(0), 31 m_lastCount(0),
31 m_updating(fileUpdating) 32 m_updating(fileUpdating)
52 } 53 }
53 return; 54 return;
54 } 55 }
55 56
56 if (m_fileInfo.channels > 0) { 57 if (m_fileInfo.channels > 0) {
58
57 m_frameCount = m_fileInfo.frames; 59 m_frameCount = m_fileInfo.frames;
58 m_channelCount = m_fileInfo.channels; 60 m_channelCount = m_fileInfo.channels;
59 m_sampleRate = m_fileInfo.samplerate; 61 m_sampleRate = m_fileInfo.samplerate;
60 } 62
61 63 m_seekable = (m_fileInfo.seekable != 0);
62 // std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << std::endl; 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;
70 // std::cerr << "WavFileReader: format type is " << type << " (flac, ogg are " << SF_FORMAT_FLAC << ", " << SF_FORMAT_OGG << ")" << std::endl;
71 if (type >= SF_FORMAT_FLAC || type >= SF_FORMAT_OGG) {
72 // std::cerr << "WavFileReader: Recording as non-seekable" << std::endl;
73 m_seekable = false;
74 }
75 }
76
77 // std::cerr << "WavFileReader: Frame count " << m_frameCount << ", channel count " << m_channelCount << ", sample rate " << m_sampleRate << ", seekable " << m_seekable << std::endl;
63 78
64 } 79 }
65 80
66 WavFileReader::~WavFileReader() 81 WavFileReader::~WavFileReader()
67 { 82 {