Diffstat (limited to 'noncore/multimedia/opierec/wavFile.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 86 |
1 files changed, 44 insertions, 42 deletions
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 7e9b50f..fc0130c 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp @@ -29,3 +29,3 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int { -//odebug << "new wave file" << oendl; +//odebug << "new wave file" << oendl; bool b = makeNwFile; @@ -45,3 +45,3 @@ bool WavFile::newFile() { -// odebug << "Set up new file" << oendl; +// odebug << "Set up new file" << oendl; Config cfg("OpieRec"); @@ -65,3 +65,3 @@ bool WavFile::newFile() { -// odebug << "set up file for recording: "+currentFileName << oendl; +// odebug << "set up file for recording: "+currentFileName << oendl; char pointer[] = "/tmp/opierec-XXXXXX"; @@ -73,3 +73,3 @@ bool WavFile::newFile() { // we have to write to a different filesystem first - + useTmpFile = true; @@ -79,4 +79,4 @@ bool WavFile::newFile() { } - -// odebug << "Opening tmp file " << pointer << "" << oendl; + +// odebug << "Opening tmp file " << pointer << "" << oendl; track.setName( pointer); @@ -84,3 +84,3 @@ bool WavFile::newFile() { } else { //just use regular file.. no moving - + useTmpFile = false; @@ -90,5 +90,5 @@ bool WavFile::newFile() { QString errorMsg=(QString)strerror(errno); - odebug << errorMsg << oendl; + odebug << errorMsg << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); - + return false; @@ -106,3 +106,3 @@ WavFile::~WavFile() { void WavFile::closeFile() { - if(track.isOpen()) + if(track.isOpen()) track.close(); @@ -111,5 +111,5 @@ void WavFile::closeFile() { int WavFile::openFile(const QString ¤tFileName) { -// odebug << "open play file "+currentFileName << oendl; +// odebug << "open play file "+currentFileName << oendl; closeFile(); - + track.setName(currentFileName); @@ -118,3 +118,3 @@ int WavFile::openFile(const QString ¤tFileName) { QString errorMsg=(QString)strerror(errno); - odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl; + odebug << "<<<<<<<<<<< "+errorMsg+currentFileName << oendl; QMessageBox::message("Note", "Error opening file.\n" +errorMsg); @@ -126,3 +126,3 @@ int WavFile::openFile(const QString ¤tFileName) { } - + bool WavFile::setWavHeader(int fd, wavhdr *hdr) { @@ -136,3 +136,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { (*hdr).fmtTag = 1; // PCM -// odebug << "set header WAVE_FORMAT_PCM" << oendl; +// odebug << "set header WAVE_FORMAT_PCM" << oendl; } @@ -140,3 +140,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM - // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; + // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; } @@ -154,4 +154,5 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { write( fd,hdr, sizeof(*hdr)); - qDebug("writing header: bitrate%d, samplerate %d, channels %d", - wavResolution, wavSampleRate, wavChannels); + odebug << "writing header: bitrate " << wavResolution + << ", samplerate " << wavSampleRate + << ", channels " << wavChannels << oendl; return true; @@ -165,3 +166,3 @@ bool WavFile::adjustHeaders(int fd, int total) { write( fd, &total, sizeof(total)); - odebug << "adjusting header " << total << "" << oendl; + odebug << "adjusting header " << total << "" << oendl; return true; @@ -170,3 +171,3 @@ bool WavFile::adjustHeaders(int fd, int total) { int WavFile::parseWavHeader(int fd) { - odebug << "Parsing wav header" << oendl; + odebug << "Parsing wav header" << oendl; char string[4]; @@ -178,3 +179,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, string, 4) < 4) { - odebug << " Could not read from sound file.\n" << oendl; + odebug << " Could not read from sound file.\n" << oendl; return -1; @@ -182,3 +183,3 @@ int WavFile::parseWavHeader(int fd) { if (strncmp(string, "RIFF", 4)) { - odebug << " not a valid WAV file.\n" << oendl; + odebug << " not a valid WAV file.\n" << oendl; return -1; @@ -187,3 +188,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, string, 4) < 4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -191,3 +192,3 @@ int WavFile::parseWavHeader(int fd) { if (strncmp(string, "WAVE", 4)) { - odebug << "not a valid WAV file.\n" << oendl; + odebug << "not a valid WAV file.\n" << oendl; return -1; @@ -198,3 +199,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, string, 4) < 4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -203,3 +204,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, &longdata, 4) < 4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -210,3 +211,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, &fmt, 2) < 2) { - odebug << "Could not read format chunk.\n" << oendl; + odebug << "Could not read format chunk.\n" << oendl; return -1; @@ -214,4 +215,3 @@ int WavFile::parseWavHeader(int fd) { if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { - qDebug("Wave file contains unknown format." - " Unable to continue.\n"); + odebug << "Wave file contains unknown format. Unable to continue.\n" << oendl; return -1; @@ -220,5 +220,5 @@ int WavFile::parseWavHeader(int fd) { // compressionFormat=fmt; - odebug << "compressionFormat is " << fmt << "" << oendl; + odebug << "compressionFormat is " << fmt << "" << oendl; if (read(fd, &ch, 2) < 2) { - odebug << "Could not read format chunk.\n" << oendl; + odebug << "Could not read format chunk.\n" << oendl; return -1; @@ -226,6 +226,6 @@ int WavFile::parseWavHeader(int fd) { wavChannels = ch; - odebug << "File has " << ch << " channels" << oendl; + odebug << "File has " << ch << " channels" << oendl; } if (read(fd, &samplerrate, 4) < 4) { - odebug << "Could not read from format chunk.\n" << oendl; + odebug << "Could not read from format chunk.\n" << oendl; return -1; @@ -234,3 +234,3 @@ int WavFile::parseWavHeader(int fd) { // sampleRate = samplerrate; - odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; + odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; } @@ -238,3 +238,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, &bitrate, 2) < 2) { - odebug << "Could not read format chunk.\n" << oendl; + odebug << "Could not read format chunk.\n" << oendl; return -1; @@ -243,3 +243,3 @@ int WavFile::parseWavHeader(int fd) { // resolution = bitrate; - odebug << "File has bitrate of " << bitrate << "" << oendl; + odebug << "File has bitrate of " << bitrate << "" << oendl; } @@ -251,3 +251,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, string, 4) < 4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -257,3 +257,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, &longdata, 4)<4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -264,3 +264,3 @@ int WavFile::parseWavHeader(int fd) { if (read(fd, &longdata, 4) < 4) { - odebug << "Could not read from sound file.\n" << oendl; + odebug << "Could not read from sound file.\n" << oendl; return -1; @@ -268,6 +268,8 @@ int WavFile::parseWavHeader(int fd) { wavNumberSamples = longdata; - qDebug("file has length of %d \nlasting %d seconds", (int)longdata, - (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); + odebug << "file hase length of " << (int)longdata << "\n" + << "lasting " + << (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) + << " seconds" << oendl; // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); - + return longdata; |