Mercurial > hg > svcore
comparison data/fileio/WavFileReader.cpp @ 742:c10cb8782576 coreaudio_tests
Merge from branch "default"
author | Chris Cannam |
---|---|
date | Sun, 01 Jul 2012 11:53:00 +0100 |
parents | 1424aa29ae95 |
children | 459235dccff6 |
comparison
equal
deleted
inserted
replaced
666:4efa7429cd85 | 742:c10cb8782576 |
---|---|
37 m_fileInfo.format = 0; | 37 m_fileInfo.format = 0; |
38 m_fileInfo.frames = 0; | 38 m_fileInfo.frames = 0; |
39 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); | 39 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); |
40 | 40 |
41 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { | 41 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { |
42 std::cerr << "WavFileReader::initialize: Failed to open file (" | 42 std::cerr << "WavFileReader::initialize: Failed to open file at \"" |
43 << m_path << "\" (" | |
43 << sf_strerror(m_file) << ")" << std::endl; | 44 << sf_strerror(m_file) << ")" << std::endl; |
44 | 45 |
45 if (m_file) { | 46 if (m_file) { |
46 m_error = QString("Couldn't load audio file '%1':\n%2") | 47 m_error = QString("Couldn't load audio file '%1':\n%2") |
47 .arg(m_path).arg(sf_strerror(m_file)); | 48 .arg(m_path).arg(sf_strerror(m_file)); |
77 | 78 |
78 if (m_file) { | 79 if (m_file) { |
79 sf_close(m_file); | 80 sf_close(m_file); |
80 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); | 81 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); |
81 if (!m_file || m_fileInfo.channels <= 0) { | 82 if (!m_file || m_fileInfo.channels <= 0) { |
82 std::cerr << "WavFileReader::updateFrameCount: Failed to open file (" | 83 std::cerr << "WavFileReader::updateFrameCount: Failed to open file at \"" << m_path << "\" (" |
83 << sf_strerror(m_file) << ")" << std::endl; | 84 << sf_strerror(m_file) << ")" << std::endl; |
84 } | 85 } |
85 } | 86 } |
86 | 87 |
87 // std::cerr << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << std::endl; | 88 // SVDEBUG << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << endl; |
88 | 89 |
89 m_frameCount = m_fileInfo.frames; | 90 m_frameCount = m_fileInfo.frames; |
90 | 91 |
91 if (m_channelCount == 0) { | 92 if (m_channelCount == 0) { |
92 m_channelCount = m_fileInfo.channels; | 93 m_channelCount = m_fileInfo.channels; |
119 if (!m_file || !m_channelCount) { | 120 if (!m_file || !m_channelCount) { |
120 return; | 121 return; |
121 } | 122 } |
122 | 123 |
123 if ((long)start >= m_fileInfo.frames) { | 124 if ((long)start >= m_fileInfo.frames) { |
124 // std::cerr << "WavFileReader::getInterleavedFrames: " << start | 125 // SVDEBUG << "WavFileReader::getInterleavedFrames: " << start |
125 // << " > " << m_fileInfo.frames << std::endl; | 126 // << " > " << m_fileInfo.frames << endl; |
126 return; | 127 return; |
127 } | 128 } |
128 | 129 |
129 if (long(start + count) > m_fileInfo.frames) { | 130 if (long(start + count) > m_fileInfo.frames) { |
130 count = m_fileInfo.frames - start; | 131 count = m_fileInfo.frames - start; |