summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec
authorar <ar>2004-05-12 20:25:15 (UTC)
committer ar <ar>2004-05-12 20:25:15 (UTC)
commit4b9dcabe79d0d3e73d638981ea045c4969bf21fc (patch) (unidiff)
treea29198fb88fee4fbdceba3acec7457fdc31668f8 /noncore/multimedia/opierec
parent00efb6af5ff15e43913f91fcc5c33805233c7e91 (diff)
downloadopie-4b9dcabe79d0d3e73d638981ea045c4969bf21fc.zip
opie-4b9dcabe79d0d3e73d638981ea045c4969bf21fc.tar.gz
opie-4b9dcabe79d0d3e73d638981ea045c4969bf21fc.tar.bz2
- convert qDebug to odebug
Diffstat (limited to 'noncore/multimedia/opierec') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp18
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp14
2 files changed, 16 insertions, 16 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 6eb6524..3b8cb0d 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -112,28 +112,27 @@ int sd;
112 112
113Waveform* waveform; 113Waveform* waveform;
114Device *soundDevice; 114Device *soundDevice;
115 115
116 116
117#ifdef THREADED 117#ifdef THREADED
118void quickRec() 118void quickRec()
119#else 119#else
120 void QtRec::quickRec() 120 void QtRec::quickRec()
121#endif 121#endif
122{ 122{
123 123
124 qDebug("%d", 124 odebug << ( filePara.numberSamples/filePara.sampleRate * filePara.channels ) << oendl;
125 filePara.numberSamples/filePara.sampleRate * filePara.channels); 125 odebug << "samples " << filePara.numberSamples << ", rate " << filePara.sampleRate
126 qDebug("samples %d, rate %d, channels %d", 126 << ", channels " << filePara.channels << oendl;
127 filePara.numberSamples, filePara.sampleRate, filePara.channels);
128 127
129 int total = 0; // Total number of bytes read in so far. 128 int total = 0; // Total number of bytes read in so far.
130 int bytesWritten, number; 129 int bytesWritten, number;
131 130
132 bytesWritten = 0; 131 bytesWritten = 0;
133 number = 0; 132 number = 0;
134 QString num; 133 QString num;
135 int level = 0; 134 int level = 0;
136 int threshold = 0; 135 int threshold = 0;
137// int bits = filePara.resolution; 136// int bits = filePara.resolution;
138// odebug << "bits " << bits << "" << oendl; 137// odebug << "bits " << bits << "" << oendl;
139 138
@@ -910,51 +909,50 @@ bool QtRec::rec() { //record
910 return false; 909 return false;
911 } else { 910 } else {
912 secCount = 1; 911 secCount = 1;
913 playLabel2->setText(tr("Stop")); 912 playLabel2->setText(tr("Stop"));
914 monitoring = false; 913 monitoring = false;
915 setRecordButton( true); 914 setRecordButton( true);
916 915
917 if( setupAudio( true)) 916 if( setupAudio( true))
918 if(setUpFile()) { 917 if(setUpFile()) {
919 int fileSize = 0; 918 int fileSize = 0;
920 Config cfg("OpieRec"); 919 Config cfg("OpieRec");
921 cfg.setGroup("Settings"); 920 cfg.setGroup("Settings");
922// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", 921// odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits()
923// soundDevice->getDeviceBits(), 922// << ", device rate " << soundDevice->getDeviceRate()
924// soundDevice->getDeviceRate(), 923// << ", device channels " << soundDevice->getDeviceChannels() << oendl;
925// soundDevice->getDeviceChannels());
926 924
927 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); 925 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
928// odebug << "sample rate is " << filePara.sampleRate << "" << oendl; 926// odebug << "sample rate is " << filePara.sampleRate << "" << oendl;
929 filePara.SecondsToRecord = getCurrentSizeLimit(); 927 filePara.SecondsToRecord = getCurrentSizeLimit();
930 928
931// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; 929// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl;
932 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 930 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
933 931
934 if( filePara.SecondsToRecord == 0) { 932 if( filePara.SecondsToRecord == 0) {
935 fileSize = diskSize; 933 fileSize = diskSize;
936 } else if( filePara.format == WAVE_FORMAT_PCM) { 934 } else if( filePara.format == WAVE_FORMAT_PCM) {
937// odebug << "WAVE_FORMAT_PCM" << oendl; 935// odebug << "WAVE_FORMAT_PCM" << oendl;
938 fileSize = (filePara.SecondsToRecord ) * filePara.channels 936 fileSize = (filePara.SecondsToRecord ) * filePara.channels
939 * filePara.sampleRate * ( filePara.resolution / 8) + 1000; 937 * filePara.sampleRate * ( filePara.resolution / 8) + 1000;
940 } else { 938 } else {
941// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; 939// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
942 fileSize = ((filePara.SecondsToRecord) * filePara.channels 940 fileSize = ((filePara.SecondsToRecord) * filePara.channels
943 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; 941 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250;
944 } 942 }
945 943
946 filePara.samplesToRecord = fileSize; 944 filePara.samplesToRecord = fileSize;
947 qDebug("filesize should be %d, bits %d, rate %d", 945 odebug << "filesize should be " << filePara.samplesToRecord
948 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); 946 << ", bits " << filePara.resolution << ", rate " << filePara.sampleRate;
949 if( paused) { 947 if( paused) {
950 paused = false; 948 paused = false;
951 } 949 }
952 // else { 950 // else {
953 odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; 951 odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl;
954 // if(fileSize != 0) 952 // if(fileSize != 0)
955 timeSlider->setRange(0, filePara.samplesToRecord); 953 timeSlider->setRange(0, filePara.samplesToRecord);
956 // } 954 // }
957 955
958 if( diskSize < fileSize/1024) { 956 if( diskSize < fileSize/1024) {
959 QMessageBox::warning(this, 957 QMessageBox::warning(this,
960 tr("Low Disk Space"), 958 tr("Low Disk Space"),
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
@@ -143,26 +143,27 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
143 143
144 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels 144 // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels
145 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels 145 (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels
146 146
147 (*hdr).sampleRate = wavSampleRate; //samples per second 147 (*hdr).sampleRate = wavSampleRate; //samples per second
148 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second 148 (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second
149 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align 149 (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align
150 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 150 (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16
151 151
152 strncpy((*hdr).dataID, "data", 4); 152 strncpy((*hdr).dataID, "data", 4);
153 153
154 write( fd,hdr, sizeof(*hdr)); 154 write( fd,hdr, sizeof(*hdr));
155 qDebug("writing header: bitrate%d, samplerate %d, channels %d", 155 odebug << "writing header: bitrate " << wavResolution
156 wavResolution, wavSampleRate, wavChannels); 156 << ", samplerate " << wavSampleRate
157 << ", channels " << wavChannels << oendl;
157 return true; 158 return true;
158} 159}
159 160
160bool WavFile::adjustHeaders(int fd, int total) { 161bool WavFile::adjustHeaders(int fd, int total) {
161 lseek(fd, 4, SEEK_SET); 162 lseek(fd, 4, SEEK_SET);
162 int i = total + 36; 163 int i = total + 36;
163 write( fd, &i, sizeof(i)); 164 write( fd, &i, sizeof(i));
164 lseek( fd, 40, SEEK_SET); 165 lseek( fd, 40, SEEK_SET);
165 write( fd, &total, sizeof(total)); 166 write( fd, &total, sizeof(total));
166 odebug << "adjusting header " << total << "" << oendl; 167 odebug << "adjusting header " << total << "" << oendl;
167 return true; 168 return true;
168} 169}
@@ -203,26 +204,25 @@ int WavFile::parseWavHeader(int fd) {
203 if (read(fd, &longdata, 4) < 4) { 204 if (read(fd, &longdata, 4) < 4) {
204 odebug << "Could not read from sound file.\n" << oendl; 205 odebug << "Could not read from sound file.\n" << oendl;
205 return -1; 206 return -1;
206 } 207 }
207 lseek(fd, longdata, SEEK_CUR); 208 lseek(fd, longdata, SEEK_CUR);
208 } else { 209 } else {
209 lseek(fd, 4, SEEK_CUR); 210 lseek(fd, 4, SEEK_CUR);
210 if (read(fd, &fmt, 2) < 2) { 211 if (read(fd, &fmt, 2) < 2) {
211 odebug << "Could not read format chunk.\n" << oendl; 212 odebug << "Could not read format chunk.\n" << oendl;
212 return -1; 213 return -1;
213 } 214 }
214 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { 215 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) {
215 qDebug("Wave file contains unknown format." 216 odebug << "Wave file contains unknown format. Unable to continue.\n" << oendl;
216 " Unable to continue.\n");
217 return -1; 217 return -1;
218 } 218 }
219 wavFormat = fmt; 219 wavFormat = fmt;
220 // compressionFormat=fmt; 220 // compressionFormat=fmt;
221 odebug << "compressionFormat is " << fmt << "" << oendl; 221 odebug << "compressionFormat is " << fmt << "" << oendl;
222 if (read(fd, &ch, 2) < 2) { 222 if (read(fd, &ch, 2) < 2) {
223 odebug << "Could not read format chunk.\n" << oendl; 223 odebug << "Could not read format chunk.\n" << oendl;
224 return -1; 224 return -1;
225 } else { 225 } else {
226 wavChannels = ch; 226 wavChannels = ch;
227 odebug << "File has " << ch << " channels" << oendl; 227 odebug << "File has " << ch << " channels" << oendl;
228 } 228 }
@@ -257,26 +257,28 @@ int WavFile::parseWavHeader(int fd) {
257 if (read(fd, &longdata, 4)<4) { 257 if (read(fd, &longdata, 4)<4) {
258 odebug << "Could not read from sound file.\n" << oendl; 258 odebug << "Could not read from sound file.\n" << oendl;
259 return -1; 259 return -1;
260 } 260 }
261 261
262 lseek(fd, longdata, SEEK_CUR); 262 lseek(fd, longdata, SEEK_CUR);
263 } else { 263 } else {
264 if (read(fd, &longdata, 4) < 4) { 264 if (read(fd, &longdata, 4) < 4) {
265 odebug << "Could not read from sound file.\n" << oendl; 265 odebug << "Could not read from sound file.\n" << oendl;
266 return -1; 266 return -1;
267 } else { 267 } else {
268 wavNumberSamples = longdata; 268 wavNumberSamples = longdata;
269 qDebug("file has length of %d \nlasting %d seconds", (int)longdata, 269 odebug << "file hase length of " << (int)longdata << "\n"
270 (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); 270 << "lasting "
271 << (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8))
272 << " seconds" << oendl;
271// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); 273// wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8));
272 274
273 return longdata; 275 return longdata;
274 } 276 }
275 } 277 }
276 } 278 }
277 279
278 lseek(fd, 0, SEEK_SET); 280 lseek(fd, 0, SEEK_SET);
279 281
280 return 0; 282 return 0;
281} 283}
282 284