summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec/wavFile.cpp
authorllornkcor <llornkcor>2003-12-25 21:52:44 (UTC)
committer llornkcor <llornkcor>2003-12-25 21:52:44 (UTC)
commitf2805565b0d7edd2e72445f6d56e43eadcdac72d (patch) (unidiff)
treeb9a74aec0c5616ae1976198c1f83945b697ed3d2 /noncore/multimedia/opierec/wavFile.cpp
parent34a7e0451c95e8a19735610553dba064b68823d9 (diff)
downloadopie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.zip
opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.gz
opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.bz2
uhhh.. helps to commit to correct branch
Diffstat (limited to 'noncore/multimedia/opierec/wavFile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index b177c91..987fa32 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -140,41 +140,41 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
140 140
141 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels 141 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels
142 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels 142 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels
143 143
144 (*hdr).sampleRate = wavSampleRate; //samples per second 144 (*hdr).sampleRate = wavSampleRate; //samples per second
145 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second 145 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second
146 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align 146 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align
147 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 147 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16
148 148
149 strncpy((*hdr).dataID, "data", 4); 149 strncpy((*hdr).dataID, "data", 4);
150 150
151 write( fd,hdr, sizeof(*hdr)); 151 write( fd,hdr, sizeof(*hdr));
152// qDebug("writing header: bitrate%d, samplerate %d, channels %d", 152 qDebug("writing header: bitrate%d, samplerate %d, channels %d",
153// wavResolution, wavSampleRate, wavChannels); 153 wavResolution, wavSampleRate, wavChannels);
154 return true; 154 return true;
155} 155}
156 156
157bool WavFile::adjustHeaders(int fd, int total) { 157bool WavFile::adjustHeaders(int fd, int total) {
158 lseek(fd, 4, SEEK_SET); 158 lseek(fd, 4, SEEK_SET);
159 int i = total + 36; 159 int i = total + 36;
160 write( fd, &i, sizeof(i)); 160 write( fd, &i, sizeof(i));
161 lseek( fd, 40, SEEK_SET); 161 lseek( fd, 40, SEEK_SET);
162 write( fd, &total, sizeof(total)); 162 write( fd, &total, sizeof(total));
163// qDebug("adjusting header %d", total); 163 qDebug("adjusting header %d", total);
164 return true; 164 return true;
165} 165}
166 166
167int WavFile::parseWavHeader(int fd) { 167int WavFile::parseWavHeader(int fd) {
168// qDebug("Parsing wav header"); 168 qDebug("Parsing wav header");
169 char string[4]; 169 char string[4];
170 int found; 170 int found;
171 short fmt; 171 short fmt;
172 unsigned short ch, bitrate; 172 unsigned short ch, bitrate;
173 unsigned long samplerrate, longdata; 173 unsigned long samplerrate, longdata;
174 174
175 if (read(fd, string, 4) < 4) { 175 if (read(fd, string, 4) < 4) {
176 qDebug(" Could not read from sound file.\n"); 176 qDebug(" Could not read from sound file.\n");
177 return -1; 177 return -1;
178 } 178 }
179 if (strncmp(string, "RIFF", 4)) { 179 if (strncmp(string, "RIFF", 4)) {
180 qDebug(" not a valid WAV file.\n"); 180 qDebug(" not a valid WAV file.\n");
@@ -285,22 +285,27 @@ int WavFile::wavHandle(){
285 return track.handle(); 285 return track.handle();
286} 286}
287 287
288int WavFile::getFormat() { 288int WavFile::getFormat() {
289return wavFormat; 289return wavFormat;
290} 290}
291 291
292int WavFile::getResolution() { 292int WavFile::getResolution() {
293return wavResolution; 293return wavResolution;
294} 294}
295 295
296int WavFile::getSampleRate() { 296int WavFile::getSampleRate() {
297return wavSampleRate; 297 return wavSampleRate;
298} 298}
299 299
300int WavFile::getNumberSamples() { 300int WavFile::getNumberSamples() {
301return wavNumberSamples; 301 return wavNumberSamples;
302} 302}
303 303
304bool WavFile::isTempFile() { 304bool WavFile::isTempFile() {
305return useTmpFile; 305return useTmpFile;
306} 306}
307
308int WavFile::getChannels() {
309
310 return wavChannels;
311}