author | llornkcor <llornkcor> | 2003-11-13 08:33:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-11-13 08:33:15 (UTC) |
commit | 3451f19533b2dd342a57bceda4aec20edd4048b7 (patch) (unidiff) | |
tree | 9065ee04704e4f095a093696be94b1776b873c1e /noncore | |
parent | 452f0cc3d9fdd792d2050ceaffd33b3d1611fcc3 (diff) | |
download | opie-3451f19533b2dd342a57bceda4aec20edd4048b7.zip opie-3451f19533b2dd342a57bceda4aec20edd4048b7.tar.gz opie-3451f19533b2dd342a57bceda4aec20edd4048b7.tar.bz2 |
update wavfile
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 35 |
1 files changed, 20 insertions, 15 deletions
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 7bfffb6..b177c91 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp | |||
@@ -27,3 +27,3 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int | |||
27 | { | 27 | { |
28 | qDebug("new wave file"); | 28 | //qDebug("new wave file"); |
29 | bool b = makeNwFile; | 29 | bool b = makeNwFile; |
@@ -43,3 +43,3 @@ bool WavFile::newFile() { | |||
43 | 43 | ||
44 | qDebug("Set up new file"); | 44 | // qDebug("Set up new file"); |
45 | Config cfg("OpieRec"); | 45 | Config cfg("OpieRec"); |
@@ -62,4 +62,5 @@ bool WavFile::newFile() { | |||
62 | 62 | ||
63 | qDebug("set up file for recording: "+currentFileName); | 63 | // qDebug("set up file for recording: "+currentFileName); |
64 | char *pointer; | 64 | char pointer[] = "/tmp/opierec-XXXXXX"; |
65 | int fd = 0; | ||
65 | 66 | ||
@@ -71,4 +72,8 @@ bool WavFile::newFile() { | |||
71 | useTmpFile = true; | 72 | useTmpFile = true; |
72 | pointer=tmpnam(NULL); | 73 | if(( fd = mkstemp( pointer)) < 0 ) { |
73 | qDebug("Opening tmp file %s",pointer); | 74 | perror("mkstemp failed"); |
75 | return false; | ||
76 | } | ||
77 | |||
78 | // qDebug("Opening tmp file %s",pointer); | ||
74 | track.setName( pointer); | 79 | track.setName( pointer); |
@@ -103,3 +108,3 @@ void WavFile::closeFile() { | |||
103 | int WavFile::openFile(const QString ¤tFileName) { | 108 | int WavFile::openFile(const QString ¤tFileName) { |
104 | qDebug("open play file "+currentFileName); | 109 | // qDebug("open play file "+currentFileName); |
105 | closeFile(); | 110 | closeFile(); |
@@ -128,3 +133,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { | |||
128 | (*hdr).fmtTag = 1; // PCM | 133 | (*hdr).fmtTag = 1; // PCM |
129 | qDebug("set header WAVE_FORMAT_PCM"); | 134 | // qDebug("set header WAVE_FORMAT_PCM"); |
130 | } | 135 | } |
@@ -132,3 +137,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { | |||
132 | (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM | 137 | (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM |
133 | qDebug("set header WAVE_FORMAT_DVI_ADPCM"); | 138 | // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); |
134 | } | 139 | } |
@@ -146,4 +151,4 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { | |||
146 | write( fd,hdr, sizeof(*hdr)); | 151 | write( fd,hdr, sizeof(*hdr)); |
147 | qDebug("writing header: bitrate%d, samplerate %d, channels %d", | 152 | // qDebug("writing header: bitrate%d, samplerate %d, channels %d", |
148 | wavResolution, wavSampleRate, wavChannels); | 153 | // wavResolution, wavSampleRate, wavChannels); |
149 | return true; | 154 | return true; |
@@ -157,3 +162,3 @@ bool WavFile::adjustHeaders(int fd, int total) { | |||
157 | write( fd, &total, sizeof(total)); | 162 | write( fd, &total, sizeof(total)); |
158 | qDebug("adjusting header %d", total); | 163 | // qDebug("adjusting header %d", total); |
159 | return true; | 164 | return true; |
@@ -162,3 +167,3 @@ bool WavFile::adjustHeaders(int fd, int total) { | |||
162 | int WavFile::parseWavHeader(int fd) { | 167 | int WavFile::parseWavHeader(int fd) { |
163 | qDebug("Parsing wav header"); | 168 | // qDebug("Parsing wav header"); |
164 | char string[4]; | 169 | char string[4]; |
@@ -260,4 +265,4 @@ int WavFile::parseWavHeader(int fd) { | |||
260 | wavNumberSamples = longdata; | 265 | wavNumberSamples = longdata; |
261 | qDebug("file has length of %d \nlasting %d seconds", longdata, | 266 | qDebug("file has length of %d \nlasting %d seconds", (int)longdata, |
262 | (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); | 267 | (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); |
263 | // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); | 268 | // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); |