summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-08-10 23:03:39 (UTC)
committer llornkcor <llornkcor>2003-08-10 23:03:39 (UTC)
commit892aac84512b257c72362702a98462289589faec (patch) (side-by-side diff)
treed514fbd450129f2a1b2a897ef06c93e27cde4b30
parent44bb1f23dcd0bea4775ba4b48fb370ad651290cc (diff)
downloadopie-892aac84512b257c72362702a98462289589faec.zip
opie-892aac84512b257c72362702a98462289589faec.tar.gz
opie-892aac84512b257c72362702a98462289589faec.tar.bz2
forgot what I changed, but I changed something I need to commit
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp200
-rw-r--r--noncore/multimedia/opierec/qtrec.h2
2 files changed, 58 insertions, 144 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 147f63d..2bf795f 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -109,7 +109,2 @@ void quickRec() {
- qDebug("%d",
- filePara.numberSamples/filePara.sampleRate * filePara.channels);
- qDebug("samples %d, rate %d, channels %d",
- filePara.numberSamples, filePara.sampleRate, filePara.channels);
-
int total = 0; // Total number of bytes read in so far.
@@ -129,14 +124,8 @@ void quickRec() {
//rate=filePara.sampleRate;
- int bits = filePara.resolution;
- qDebug("bits %d", bits);
-// if( filePara.format==WAVE_FORMAT_DVI_ADPCM)
-// else
+ // int bits = filePara.resolution;
audio_buf_info inInfo;
ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo);
- qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal);
+ // qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal);
if( filePara.resolution == 16 ) { //AFMT_S16_LE)
- qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord);
- qDebug("samples to record %d", filePara.samplesToRecord);
- qDebug("%d", filePara.sd);
level=7;
@@ -147,4 +136,3 @@ void quickRec() {
if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
- qDebug("start recording WAVE_FORMAT_DVI_ADPCM");
- // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
+ // qDebug("start recording WAVE_FORMAT_DVI_ADPCM");
char abuf[BUFSIZE/2];
@@ -158,5 +146,3 @@ void quickRec() {
if (stopped) {
- qDebug("quickRec:: stopped");
break; // stop if playing was set to false
-// return;
}
@@ -164,11 +150,8 @@ void quickRec() {
number=::read( filePara.sd, sbuf, BUFSIZE);
-
if(number <= 0) {
perror("recording error ");
- qDebug( "%s %d", filePara.fileName, number);
+ // qDebug( "%s %d", filePara.fileName, number);
// errorStop();
recording=stopped=false;
-// QMessageBox::message("Note",
-// "Error recording to file\n%s",
-// filePara.fileName);
+// QMessageBox::message("Note", "Error recording to file\n%s",filePara.fileName);
return;
@@ -178,5 +161,3 @@ void quickRec() {
adpcm_coder( sbuf, abuf, number/2, &encoder_state);
-
bytesWritten = ::write( filePara.fd , abuf, number/4);
-
long peak;
@@ -188,4 +169,2 @@ void quickRec() {
}
-
-
//------------->>>> out to file
@@ -202,13 +181,3 @@ void quickRec() {
filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2;
-
-// printf("Writing number %d, bytes %d,total %d, sample rate %d, secs %.2f \n",
-// number,
-// bytesWritten ,
-// total,
-// filePara.sampleRate,
-// filePara.numberOfRecordedSeconds);
-// fflush(stdout);
ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info);
-// qDebug("%d, %d", info.bytes, (info.bytes / filePara.sampleRate) / 2);
-
timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
@@ -221,4 +190,3 @@ void quickRec() {
} else {
- // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
- qDebug("start recording WAVE_FORMAT_PCM");
+ // qDebug("start recording WAVE_FORMAT_PCM");
short inbuffer[BUFSIZE], outbuffer[BUFSIZE];
@@ -228,5 +196,3 @@ void quickRec() {
if (stopped) {
- qDebug("quickRec:: stopped");
break; // stop if playing was set to false
- return;
}
@@ -234,9 +200,6 @@ void quickRec() {
number=::read( filePara.sd, inbuffer, BUFSIZE);
-
if(number <= 0) {
perror("recording error ");
- qDebug( filePara.fileName);
recording=stopped=false;
// errorStop();
-// QMessageBox::message("Note","error recording to file\n%s",filePara.fileName);
return;// false;
@@ -244,3 +207,2 @@ void quickRec() {
/* for (int i=0;i< number;i++) { //2*i is left channel
-
outbuffer[i]=inbuffer[i]>>1; // no clippy, please
@@ -266,4 +228,2 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
}
-
-
filePara.numberSamples = total;
@@ -278,6 +238,4 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
-
timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
timeLabel->setText( timeString + " seconds");
-
qApp->processEvents();
@@ -295,3 +253,3 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
if (stopped) {
- qDebug("quickRec:: stopped");
+ // qDebug("quickRec:: stopped");
break; // stop if playing was set to false
@@ -350,7 +308,3 @@ void playIt() {
-
-
-/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
-
QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
@@ -361,4 +315,2 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
-// signal(SIGPIPE, SIG_IGN);
-
if ( !name )
@@ -413,3 +365,2 @@ void QtRec::cleanUp() {
// if(soundDevice) delete soundDevice;
-
// QPEApplication::grabKeyboard();
@@ -756,5 +707,6 @@ void QtRec::initIconView() {
-// temp.sprintf("%d",i);
+ temp.sprintf("%d",i);
temp=cfg.readEntry(temp,""); //reads currentFile
filePath = cfg.readEntry(temp,""); //currentFileName
+ // qDebug(filePath);
@@ -861,3 +813,3 @@ void QtRec::initConfig() {
void QtRec::stop() {
- qDebug("<<<<<<<<<stop()");
+ // qDebug("<<<<<<<<<stop()");
setRecordButton(false);
@@ -889,3 +841,2 @@ void QtRec::start() { //play
if(stopped) {
- qDebug("start::");
QPixmap image3( ( const char** ) image3_data );
@@ -904,5 +855,3 @@ void QtRec::start() { //play
bool QtRec::rec() { //record
- qDebug("rec()");
if(!stopped) {
- qDebug("rec:: !stopped");
monitoring=true;
@@ -910,3 +859,2 @@ bool QtRec::rec() { //record
} else {
- qDebug("go ahead and record");
secCount=1;
@@ -919,3 +867,2 @@ bool QtRec::rec() { //record
if(setUpFile()) {
- qDebug("Ok to start recording");
int fileSize=0;
@@ -923,12 +870,6 @@ bool QtRec::rec() { //record
cfg.setGroup("Settings");
- qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d",
- soundDevice->getDeviceBits(),
- soundDevice->getDeviceRate(),
- soundDevice->getDeviceChannels());
-
//filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
- qDebug("sample rate is %d", filePara.sampleRate);
+ // qDebug("sample rate is %d", filePara.sampleRate);
filePara.SecondsToRecord = getCurrentSizeLimit();
- qDebug("size limit %d sec", filePara.SecondsToRecord);
int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
@@ -938,3 +879,2 @@ bool QtRec::rec() { //record
} else if( filePara.format==WAVE_FORMAT_PCM) {
- qDebug("WAVE_FORMAT_PCM");
fileSize = (filePara.SecondsToRecord ) * filePara.channels
@@ -942,3 +882,2 @@ bool QtRec::rec() { //record
} else {
- qDebug("WAVE_FORMAT_DVI_ADPCM");
fileSize = ((filePara.SecondsToRecord) * filePara.channels
@@ -948,4 +887,2 @@ bool QtRec::rec() { //record
filePara.samplesToRecord = fileSize;
- qDebug("filesize should be %d, bits %d, rate %d",
- filePara.samplesToRecord, filePara.resolution, filePara.sampleRate);
if(paused) {
@@ -953,7 +890,3 @@ bool QtRec::rec() { //record
}
- // else {
- qDebug("Setting timeslider %d", filePara.samplesToRecord);
- // if(fileSize != 0)
timeSlider->setRange(0, filePara.samplesToRecord);
- // }
@@ -973,3 +906,2 @@ bool QtRec::rec() { //record
filePara.fileName=currentFile.latin1();
- qDebug("Start recording thread");
@@ -977,3 +909,2 @@ bool QtRec::rec() { //record
pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
-// quickRec();
toBeginningButton->setEnabled(false);
@@ -1012,4 +943,4 @@ void QtRec::thisTab(QWidget* widg) {
- if(index==0) { //file page
- }
+// if(index==0) { //file page
+// }
@@ -1021,4 +952,4 @@ void QtRec::thisTab(QWidget* widg) {
- if(index==2) { //help page
- }
+// if(index==2) { //help page
+// }
qApp->processEvents();
@@ -1030,3 +961,2 @@ void QtRec::getOutVol( ) {
filePara.outVol = soundDevice->getOutVolume();
- qDebug("out vol %d", filePara.outVol);
OutputSlider->setValue( -filePara.outVol);
@@ -1036,3 +966,2 @@ void QtRec::getInVol() {
filePara.inVol = soundDevice->getInVolume();
- qDebug("in vol %d", filePara.inVol);
InputSlider->setValue( -filePara.inVol);
@@ -1057,3 +986,2 @@ bool QtRec::setupAudio( bool b) {
if( !b){ // we want to play
- qDebug("setting up DSP for playing");
if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) {
@@ -1071,3 +999,2 @@ bool QtRec::setupAudio( bool b) {
} else { // we want to record
- qDebug("setting up DSP for recording");
@@ -1080,3 +1007,2 @@ bool QtRec::setupAudio( bool b) {
filePara.format=WAVE_FORMAT_PCM;
- qDebug("WAVE_FORMAT_PCM");
} else {
@@ -1084,3 +1010,2 @@ bool QtRec::setupAudio( bool b) {
sampleformat=AFMT_S16_LE;
- qDebug("WAVE_FORMAT_DVI_ADPCM");
}
@@ -1088,5 +1013,3 @@ bool QtRec::setupAudio( bool b) {
stereo = filePara.channels = 1;
-// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
flags= O_RDWR;
-// flags= O_RDONLY;
dspString = DSPSTRIN;
@@ -1096,3 +1019,2 @@ bool QtRec::setupAudio( bool b) {
// if(soundDevice) delete soundDevice;
- qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat);
soundDevice = new Device( this, dspString, mixerString, b);
@@ -1101,5 +1023,2 @@ bool QtRec::setupAudio( bool b) {
- qDebug("device has been made %d", soundDevice->sd);
-
- ////////////////// <<<<<<<<<<<<>>>>>>>>>>>>
soundDevice->setDeviceFormat( sampleformat);
@@ -1113,3 +1032,3 @@ bool QtRec::setupAudio( bool b) {
#endif
- /////////////////
+
filePara.sd = soundDevice->sd;
@@ -1117,3 +1036,2 @@ bool QtRec::setupAudio( bool b) {
if ( filePara.sd == -1) {
-
monitoring=false;
@@ -1121,3 +1039,3 @@ bool QtRec::setupAudio( bool b) {
update();
- setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
+ setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ );
stopped=true;
@@ -1133,3 +1051,3 @@ bool QtRec::setupAudio( bool b) {
bool QtRec::setUpFile() { //setup file for recording
- qDebug("Setting up wavfile");
+ // qDebug("Setting up wavfile");
// if(wavFile) delete wavFile;
@@ -1162,3 +1080,3 @@ bool QtRec::doPlay() {
if( !paused) {
- qDebug("new");
+ // qDebug("new");
total=0;
@@ -1175,3 +1093,2 @@ bool QtRec::doPlay() {
// block=BUFSIZE;
- qDebug("Play number of samples %d", filePara.numberSamples);
timeSlider->setRange(0, filePara.numberSamples);
@@ -1180,7 +1097,7 @@ bool QtRec::doPlay() {
- if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
- qDebug("WAVE_FORMAT_DVI_ADPCM");
- } else {
- qDebug("WAVE_FORMAT_PCM");
- }
+// if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
+// // qDebug("WAVE_FORMAT_DVI_ADPCM");
+// } else {
+// // qDebug("WAVE_FORMAT_PCM");
+// }
QString msg;
@@ -1191,3 +1108,3 @@ bool QtRec::doPlay() {
if( filePara.resolution == 16 ) { //AFMT_S16_LE) {
- qDebug("16 bit");
+ // qDebug("16 bit");
@@ -1279,3 +1196,3 @@ bool QtRec::doPlay() {
} else { /////////////////////////////// format = AFMT_U8;
- unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE];
+ unsigned char unsigned_inbuffer[BUFSIZE];//, unsigned_outbuffer[BUFSIZE];
memset( unsigned_inbuffer,0,BUFSIZE);
@@ -1345,3 +1262,3 @@ void QtRec::changesamplerateCombo(int i) {
// delete soundDevice;
- qDebug("Change sample rate %d", rate);
+ // qDebug("Change sample rate %d", rate);
cfg.write();
@@ -1366,3 +1283,3 @@ void QtRec::changeDirCombo(int index) {
cfg.writeEntry("directory", recDir);
- qDebug("new rec dir "+recDir);
+ // qDebug("new rec dir "+recDir);
}
@@ -1381,6 +1298,6 @@ void QtRec::changeSizeLimitCombo(int) {
void QtRec::newSound() {
- qDebug("<<<<<<<<<new sound");
+ // qDebug("<<<<<<<<<new sound");
if( !rec()) {
- qDebug("rec() failed");
+ // qDebug("rec() failed");
endRecording();
@@ -1450,3 +1367,3 @@ void QtRec::deleteSound() {
#endif
- setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
+ setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ );
@@ -1515,3 +1432,3 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
case Key_Left: {
- qDebug("rewinding");
+ // qDebug("rewinding");
if( !e->isAutoRepeat())
@@ -1569,3 +1486,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
// stop();
- qDebug("Up");
+ // qDebug("Up");
break;
@@ -1577,3 +1494,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
case Key_Left:
- qDebug("Left");
+ // qDebug("Left");
rewindReleased();
@@ -1581,3 +1498,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
case Key_Right:
- qDebug("Right");
+ // qDebug("Right");
FastforwardReleased();
@@ -1588,3 +1505,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
void QtRec::endRecording() {
- qDebug("endRecording");
+ // qDebug("endRecording");
setRecordButton(false);
@@ -1619,3 +1536,3 @@ void QtRec::endRecording() {
cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName);
- qDebug("moving tmp file to "+currentFileName);
+ // qDebug("moving tmp file to "+currentFileName);
system(cmd.latin1());
@@ -1623,3 +1540,3 @@ void QtRec::endRecording() {
- qDebug("Just moved "+wavFile->currentFileName);
+ // qDebug("Just moved "+wavFile->currentFileName);
Config cfg("OpieRec");
@@ -1639,6 +1556,6 @@ void QtRec::endRecording() {
cfg.writeEntry( wavFile->currentFileName, time );
- qDebug("writing config numberOfRecordedSeconds "+time);
+ // qDebug("writing config numberOfRecordedSeconds "+time);
cfg.write();
- qDebug("finished recording");
+ // qDebug("finished recording");
timeLabel->setText("");
@@ -1654,3 +1571,3 @@ void QtRec::endPlaying() {
- qDebug("end playing");
+ // qDebug("end playing");
setRecordButton(false);
@@ -1666,3 +1583,3 @@ void QtRec::endPlaying() {
// if(soundDevice) delete soundDevice;
- qDebug("file and sound device closed");
+ // qDebug("file and sound device closed");
stopped=true;
@@ -1679,3 +1596,3 @@ void QtRec::endPlaying() {
- qDebug("track closed");
+ // qDebug("track closed");
timeSlider->setValue(0);
@@ -1701,3 +1618,3 @@ bool QtRec::openPlayFile() {
currentFileName=cfg.readEntry( currentFile, "" );
- qDebug("opening for play: "+currentFileName);
+ // qDebug("opening for play: "+currentFileName);
}
@@ -1712,3 +1629,3 @@ bool QtRec::openPlayFile() {
monitoring=false;
- setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
+ setCaption( tr( "OpieRecord " )/* + QString::number(VERSION)*/ );
QMessageBox::message(tr("Note"),tr("Could not open audio file.\n")
@@ -1823,4 +1740,4 @@ void QtRec::doRename() {
void QtRec::okRename() {
- qDebug("okRename");
- qDebug(renameBox->text());
+ // qDebug("okRename");
+ // qDebug(renameBox->text());
QString filename = renameBox->text();
@@ -1836,3 +1753,3 @@ void QtRec::okRename() {
- qDebug("filename is " + filename);
+ // qDebug("filename is " + filename);
@@ -1860,3 +1777,3 @@ void QtRec::okRename() {
void QtRec::cancelRename() {
- qDebug("cancel rename");
+ // qDebug("cancel rename");
bool resetFocus = ListView1->viewport()->focusProxy() == renameBox;
@@ -1896,3 +1813,3 @@ int QtRec::getCurrentSizeLimit() {
void QtRec::timerBreak() {
- qDebug("timer break");
+ // qDebug("timer break");
stop();
@@ -1963,4 +1880,4 @@ long QtRec::checkDiskSpace(const QString &path) {
-void QtRec::receive( const QCString &msg, const QByteArray & ) {
- qDebug("Voicerecord received message "+msg);
+void QtRec::receive( const QCString &/* msg*/, const QByteArray & ) {
+ // qDebug("Voicerecord received message "+msg);
@@ -2229,4 +2146,4 @@ long findPeak(long input ) {
// halfLife = time in seconds for output to decay to half value after an impulse
- static float output = 0.0;
- int halfLife = .25;
+ float output = 0.0;
+ float halfLife = .25;
float vsf = .0025;
@@ -2235,9 +2152,6 @@ long findPeak(long input ) {
input = -input; // Absolute value.
- if ( input >= output )
- {
+ if ( input >= output) {
// When we hit a peak, ride the peak to the top.
output = input;
- }
- else
- {
+ } else {
// Exponential decay of output when signal is low.
@@ -2252,3 +2166,3 @@ long findPeak(long input ) {
- return output;
+ return (long)output;
}
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h
index bcf5504..7965c74 100644
--- a/noncore/multimedia/opierec/qtrec.h
+++ b/noncore/multimedia/opierec/qtrec.h
@@ -6,3 +6,3 @@ copyright 2002 by L.J. Potter ljp@llornkcor.com
#define QTREC_H
-#define VERSION 20021202
+#define VERSION 1.0