author | llornkcor <llornkcor> | 2003-11-13 08:33:15 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2003-11-13 08:33:15 (UTC) |
commit | 3451f19533b2dd342a57bceda4aec20edd4048b7 (patch) (side-by-side diff) | |
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 { -qDebug("new wave file"); +//qDebug("new wave file"); bool b = makeNwFile; @@ -43,3 +43,3 @@ bool WavFile::newFile() { - qDebug("Set up new file"); +// qDebug("Set up new file"); Config cfg("OpieRec"); @@ -62,4 +62,5 @@ bool WavFile::newFile() { - qDebug("set up file for recording: "+currentFileName); - char *pointer; +// qDebug("set up file for recording: "+currentFileName); + char pointer[] = "/tmp/opierec-XXXXXX"; + int fd = 0; @@ -71,4 +72,8 @@ bool WavFile::newFile() { useTmpFile = true; - pointer=tmpnam(NULL); - qDebug("Opening tmp file %s",pointer); + if(( fd = mkstemp( pointer)) < 0 ) { + perror("mkstemp failed"); + return false; + } + +// qDebug("Opening tmp file %s",pointer); track.setName( pointer); @@ -103,3 +108,3 @@ void WavFile::closeFile() { int WavFile::openFile(const QString ¤tFileName) { - qDebug("open play file "+currentFileName); +// qDebug("open play file "+currentFileName); closeFile(); @@ -128,3 +133,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { (*hdr).fmtTag = 1; // PCM - qDebug("set header WAVE_FORMAT_PCM"); +// qDebug("set header WAVE_FORMAT_PCM"); } @@ -132,3 +137,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM - qDebug("set header WAVE_FORMAT_DVI_ADPCM"); + // qDebug("set header WAVE_FORMAT_DVI_ADPCM"); } @@ -146,4 +151,4 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { write( fd,hdr, sizeof(*hdr)); - qDebug("writing header: bitrate%d, samplerate %d, channels %d", - wavResolution, wavSampleRate, wavChannels); +// qDebug("writing header: bitrate%d, samplerate %d, channels %d", +// wavResolution, wavSampleRate, wavChannels); return true; @@ -157,3 +162,3 @@ bool WavFile::adjustHeaders(int fd, int total) { write( fd, &total, sizeof(total)); - qDebug("adjusting header %d", total); +// qDebug("adjusting header %d", total); return true; @@ -162,3 +167,3 @@ bool WavFile::adjustHeaders(int fd, int total) { int WavFile::parseWavHeader(int fd) { - qDebug("Parsing wav header"); +// qDebug("Parsing wav header"); char string[4]; @@ -260,4 +265,4 @@ int WavFile::parseWavHeader(int fd) { wavNumberSamples = longdata; - qDebug("file has length of %d \nlasting %d seconds", longdata, - (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); + qDebug("file has length of %d \nlasting %d seconds", (int)longdata, + (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); |