comparison data/fileio/WavFileReader.cpp @ 1279:0a9193dc136b 3.0-integration

Debug output updates
author Chris Cannam
date Tue, 22 Nov 2016 16:40:41 +0000
parents 200c60de27ca
children 54af1e21705c
comparison
equal deleted inserted replaced
1278:0be27c989c1d 1279:0a9193dc136b
41 m_fileInfo.format = 0; 41 m_fileInfo.format = 0;
42 m_fileInfo.frames = 0; 42 m_fileInfo.frames = 0;
43 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); 43 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo);
44 44
45 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) { 45 if (!m_file || (!fileUpdating && m_fileInfo.channels <= 0)) {
46 cerr << "WavFileReader::initialize: Failed to open file at \"" 46 SVDEBUG << "WavFileReader::initialize: Failed to open file at \""
47 << m_path << "\" (" 47 << m_path << "\" ("
48 << sf_strerror(m_file) << ")" << endl; 48 << sf_strerror(m_file) << ")" << endl;
49 49
50 if (m_file) { 50 if (m_file) {
51 m_error = QString("Couldn't load audio file '%1':\n%2") 51 m_error = QString("Couldn't load audio file '%1':\n%2")
52 .arg(m_path).arg(sf_strerror(m_file)); 52 .arg(m_path).arg(sf_strerror(m_file));
53 } else { 53 } else {
82 // and mark those (basically only non-adaptive WAVs). 82 // and mark those (basically only non-adaptive WAVs).
83 m_seekable = true; 83 m_seekable = true;
84 } 84 }
85 } 85 }
86 86
87 // 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; 87 SVDEBUG << "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;
88 } 88 }
89 89
90 WavFileReader::~WavFileReader() 90 WavFileReader::~WavFileReader()
91 { 91 {
92 if (m_file) sf_close(m_file); 92 if (m_file) sf_close(m_file);
101 101
102 if (m_file) { 102 if (m_file) {
103 sf_close(m_file); 103 sf_close(m_file);
104 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo); 104 m_file = sf_open(m_path.toLocal8Bit(), SFM_READ, &m_fileInfo);
105 if (!m_file || m_fileInfo.channels <= 0) { 105 if (!m_file || m_fileInfo.channels <= 0) {
106 cerr << "WavFileReader::updateFrameCount: Failed to open file at \"" << m_path << "\" (" 106 SVDEBUG << "WavFileReader::updateFrameCount: Failed to open file at \"" << m_path << "\" ("
107 << sf_strerror(m_file) << ")" << endl; 107 << sf_strerror(m_file) << ")" << endl;
108 } 108 }
109 } 109 }
110 110
111 // SVDEBUG << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << endl; 111 // SVDEBUG << "WavFileReader::updateFrameCount: now " << m_fileInfo.frames << endl;
112 112
116 m_channelCount = m_fileInfo.channels; 116 m_channelCount = m_fileInfo.channels;
117 m_sampleRate = m_fileInfo.samplerate; 117 m_sampleRate = m_fileInfo.samplerate;
118 } 118 }
119 119
120 if (m_frameCount != prevCount) { 120 if (m_frameCount != prevCount) {
121 // cerr << "frameCountChanged" << endl;
122 emit frameCountChanged(); 121 emit frameCountChanged();
123 } 122 }
124 } 123 }
125 124
126 void 125 void