summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec
Side-by-side diff
Diffstat (limited to 'noncore/multimedia/opierec') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp178
1 files changed, 91 insertions, 87 deletions
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 2187d5a..6eb6524 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -119,6 +119,6 @@ void quickRec()
#else
- void QtRec::quickRec()
+ void QtRec::quickRec()
#endif
{
-
+
qDebug("%d",
@@ -137,8 +137,8 @@ void quickRec()
// int bits = filePara.resolution;
-// odebug << "bits " << bits << "" << oendl;
+// odebug << "bits " << bits << "" << oendl;
if( filePara.resolution == 16 ) { //AFMT_S16_LE)
-// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl;
-// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl;
-// odebug << "" << filePara.sd << "" << oendl;
+// odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl;
+// odebug << "samples to record " << filePara.samplesToRecord << "" << oendl;
+// odebug << "" << filePara.sd << "" << oendl;
level = 7;
@@ -147,4 +147,4 @@ void quickRec()
if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
-// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl;
- // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
+// odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl;
+// <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
char abuf[ BUFSIZE/2 ];
@@ -158,3 +158,3 @@ void quickRec()
if ( stopped) {
-// odebug << "quickRec:: stopped" << oendl;
+// odebug << "quickRec:: stopped" << oendl;
break;
@@ -167,3 +167,3 @@ void quickRec()
perror("recording error ");
- odebug << "" << filePara.fileName << " " << number << "" << oendl;
+ odebug << "" << filePara.fileName << " " << number << "" << oendl;
stopped = true;
@@ -177,3 +177,3 @@ void quickRec()
- waveform->newSamples( (const short *)abuf, bytesWritten );
+ waveform->newSamples( sbuf, number );
@@ -183,3 +183,4 @@ void quickRec()
- filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels;
+ filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2
+ / filePara.channels;
@@ -193,3 +194,3 @@ void quickRec()
// <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
- odebug << "start recording WAVE_FORMAT_PCM" << oendl;
+ odebug << "start recording WAVE_FORMAT_PCM" << oendl;
short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ];
@@ -200,3 +201,3 @@ void quickRec()
if ( stopped) {
- odebug << "quickRec:: stopped" << oendl;
+ odebug << "quickRec:: stopped" << oendl;
stopped = true;
@@ -207,3 +208,2 @@ void quickRec()
number = soundDevice->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
- waveform->newSamples( inbuffer, number );
@@ -211,3 +211,3 @@ void quickRec()
perror( "recording error ");
- odebug << filePara.fileName << oendl;
+ odebug << filePara.fileName << oendl;
stopped = true;
@@ -217,2 +217,3 @@ void quickRec()
bytesWritten = ::write( filePara.fd , inbuffer, number);
+ waveform->newSamples( inbuffer, number );
@@ -233,3 +234,4 @@ void quickRec()
- filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels;
+ filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate
+ / (float)2/filePara.channels;
qApp->processEvents();
@@ -251,8 +253,9 @@ void quickRec()
if ( stopped) {
- odebug << "quickRec:: stopped" << oendl;
+ odebug << "quickRec:: stopped" << oendl;
break; // stop if playing was set to false
}
-
+
number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
+ waveform->newSamples( (const short *) unsigned_inbuffer, number );
@@ -260,3 +263,3 @@ void quickRec()
stopped = true;
- QMessageBox::message("Note","There was a problem\nwriting to the file");
+ QMessageBox::message("Note","<p>There was a problem writing to the file</p>");
perror("File writing error ");
@@ -315,3 +318,3 @@ void playIt()
bytesWritten = write ( filePara.sd, sbuf, number * 4);
- waveform->newSamples( (const short *)sbuf, number );
+ waveform->newSamples( (const short *)sbuf, number *4);
// if(filePara.channels==1)
@@ -356,3 +359,3 @@ void playIt()
bytesWritten = ::write( filePara.sd, inbuffer, number);
- waveform->newSamples( inbuffer, bytesWritten );
+ waveform->newSamples( inbuffer, number);
//-------------->>>> out to device
@@ -374,3 +377,3 @@ void playIt()
if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
- owarn << "Jane! Stop this crazy thing!" << oendl;
+ owarn << "Jane! Stop this crazy thing!" << oendl;
stopped = true;
@@ -380,4 +383,4 @@ void playIt()
}
- printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
- fflush(stdout);
+// printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
+// fflush(stdout);
} //end loop
@@ -434,3 +437,3 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
-
+
soundDevice = new Device( this,
@@ -452,3 +455,3 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
- if( soundDevice) delete soundDevice;
+// if( soundDevice) delete soundDevice;
@@ -463,2 +466,3 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
QtRec::~QtRec() {
+// if( soundDevice) delete soundDevice;
@@ -478,3 +482,3 @@ void QtRec::cleanUp() {
- if( wavFile) delete wavFile;
+// if( wavFile) delete wavFile;
// if(soundDevice) delete soundDevice;
@@ -719,3 +723,3 @@ void QtRec::initIconView() {
int nFiles = cfg.readNumEntry("NumberofFiles",0);
-// odebug << "init number of files " << nFiles << "" << oendl;
+// odebug << "init number of files " << nFiles << "" << oendl;
@@ -780,3 +784,3 @@ void QtRec::initConnections() {
this, SLOT( changeStereoCheck(bool)) );
-
+
connect( outMuteCheckBox, SIGNAL(toggled(bool)),
@@ -861,3 +865,3 @@ void QtRec::initConfig() {
void QtRec::stop() {
- owarn << "STOP" << oendl;
+ owarn << "STOP" << oendl;
setRecordButton(false);
@@ -923,6 +927,6 @@ bool QtRec::rec() { //record
//filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
-// odebug << "sample rate is " << filePara.sampleRate << "" << oendl;
+// odebug << "sample rate is " << filePara.sampleRate << "" << oendl;
filePara.SecondsToRecord = getCurrentSizeLimit();
-// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl;
+// odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl;
int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
@@ -932,3 +936,3 @@ bool QtRec::rec() { //record
} else if( filePara.format == WAVE_FORMAT_PCM) {
-// odebug << "WAVE_FORMAT_PCM" << oendl;
+// odebug << "WAVE_FORMAT_PCM" << oendl;
fileSize = (filePara.SecondsToRecord ) * filePara.channels
@@ -936,3 +940,3 @@ bool QtRec::rec() { //record
} else {
-// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
+// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
fileSize = ((filePara.SecondsToRecord) * filePara.channels
@@ -948,3 +952,3 @@ bool QtRec::rec() { //record
// else {
- odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl;
+ odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl;
// if(fileSize != 0)
@@ -967,3 +971,3 @@ bool QtRec::rec() { //record
filePara.fileName=currentFile.latin1();
- odebug << "Start recording thread" << oendl;
+ odebug << "Start recording thread" << oendl;
stopped = false;
@@ -1003,3 +1007,3 @@ void QtRec::thisTab(QWidget* widg) {
}
-
+
qApp->processEvents();
@@ -1011,3 +1015,3 @@ void QtRec::getOutVol( ) {
filePara.outVol = soundDevice->getOutVolume();
-// odebug << "out vol " << filePara.outVol << "" << oendl;
+// odebug << "out vol " << filePara.outVol << "" << oendl;
OutputSlider->setValue( -filePara.outVol);
@@ -1017,3 +1021,3 @@ void QtRec::getInVol() {
filePara.inVol = soundDevice->getInVolume();
-// odebug << "in vol " << filePara.inVol << "" << oendl;
+// odebug << "in vol " << filePara.inVol << "" << oendl;
InputSlider->setValue( -filePara.inVol);
@@ -1063,3 +1067,3 @@ bool QtRec::setupAudio( bool b) {
#endif
-
+
stereo = filePara.channels;
@@ -1091,3 +1095,3 @@ bool QtRec::setupAudio( bool b) {
filePara.format = WAVE_FORMAT_PCM;
-// odebug << "WAVE_FORMAT_PCM" << oendl;
+// odebug << "WAVE_FORMAT_PCM" << oendl;
} else {
@@ -1095,6 +1099,6 @@ bool QtRec::setupAudio( bool b) {
sampleformat = AFMT_S16_LE;
-// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
+// odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl;
}
#endif
-
+
stereo = filePara.channels;
@@ -1111,4 +1115,4 @@ bool QtRec::setupAudio( bool b) {
// if(soundDevice) delete soundDevice;
- odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl;
- owarn << "change waveform settings" << oendl;
+ odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl;
+ owarn << "change waveform settings" << oendl;
waveform->changeSettings( filePara.sampleRate, filePara.channels );
@@ -1119,3 +1123,3 @@ bool QtRec::setupAudio( bool b) {
- odebug << "device has been made " << soundDevice->sd << "" << oendl;
+ odebug << "device has been made " << soundDevice->sd << "" << oendl;
@@ -1150,3 +1154,3 @@ bool QtRec::setupAudio( bool b) {
bool QtRec::setUpFile() { //setup file for recording
-// odebug << "Setting up wavfile" << oendl;
+// odebug << "Setting up wavfile" << oendl;
// if(wavFile) delete wavFile;
@@ -1183,3 +1187,3 @@ bool QtRec::doPlay() {
QString num;
- odebug << "Play number of samples " << filePara.numberSamples << "" << oendl;
+ odebug << "Play number of samples " << filePara.numberSamples << "" << oendl;
@@ -1204,3 +1208,3 @@ bool QtRec::doPlay() {
#endif
-
+
toBeginningButton->setEnabled( false);
@@ -1235,3 +1239,3 @@ void QtRec::changesamplerateCombo(int i) {
filePara.sampleRate=rate;
- odebug << "Change sample rate " << rate << "" << oendl;
+ odebug << "Change sample rate " << rate << "" << oendl;
cfg.write();
@@ -1255,3 +1259,3 @@ void QtRec::changeDirCombo(int index) {
cfg.writeEntry("directory", recDir);
- odebug << "new rec dir "+recDir << oendl;
+ odebug << "new rec dir "+recDir << oendl;
}
@@ -1375,3 +1379,3 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
case Key_Left: {
- odebug << "rewinding" << oendl;
+ odebug << "rewinding" << oendl;
if( !e->isAutoRepeat())
@@ -1429,3 +1433,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
// stop();
- odebug << "Up" << oendl;
+ odebug << "Up" << oendl;
break;
@@ -1433,3 +1437,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
// start();
- // odebug << "Down" << oendl;
+ // odebug << "Down" << oendl;
// newSound();
@@ -1437,3 +1441,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
case Key_Left:
- odebug << "Left" << oendl;
+ odebug << "Left" << oendl;
rewindReleased();
@@ -1441,3 +1445,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
case Key_Right:
- odebug << "Right" << oendl;
+ odebug << "Right" << oendl;
FastforwardReleased();
@@ -1476,7 +1480,7 @@ void QtRec::endRecording() {
cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName);
-// odebug << "moving tmp file to "+currentFileName << oendl;
+// odebug << "moving tmp file to "+currentFileName << oendl;
system( cmd.latin1());
}
-
- odebug << "Just moved " + wavFile->currentFileName << oendl;
+
+ odebug << "Just moved " + wavFile->currentFileName << oendl;
Config cfg("OpieRec");
@@ -1496,6 +1500,6 @@ void QtRec::endRecording() {
cfg.writeEntry( wavFile->currentFileName, time );
-// odebug << "writing config numberOfRecordedSeconds "+time << oendl;
+// odebug << "writing config numberOfRecordedSeconds "+time << oendl;
cfg.write();
- odebug << "finished recording" << oendl;
+ odebug << "finished recording" << oendl;
timeLabel->setText("");
@@ -1503,3 +1507,3 @@ void QtRec::endRecording() {
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
@@ -1517,3 +1521,3 @@ void QtRec::endPlaying() {
// errorStop();
-// odebug << "end playing" << oendl;
+// odebug << "end playing" << oendl;
setRecordButton( false);
@@ -1529,3 +1533,3 @@ void QtRec::endPlaying() {
// if(soundDevice) delete soundDevice;
-// odebug << "file and sound device closed" << oendl;
+// odebug << "file and sound device closed" << oendl;
timeLabel->setText("");
@@ -1538,8 +1542,8 @@ void QtRec::endPlaying() {
-// odebug << "track closed" << oendl;
+// odebug << "track closed" << oendl;
killTimers();
- owarn << "reset slider" << oendl;
+ owarn << "reset slider" << oendl;
timeSlider->setValue(0);
- if(soundDevice) delete soundDevice;
+// if(soundDevice) delete soundDevice;
@@ -1562,3 +1566,3 @@ bool QtRec::openPlayFile() {
currentFileName = cfg.readEntry( currentFile, "" );
- odebug << "opening for play: " + currentFileName << oendl;
+ odebug << "opening for play: " + currentFileName << oendl;
}
@@ -1587,6 +1591,6 @@ bool QtRec::openPlayFile() {
- odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl;
+ odebug << "file " << filePara.fd << ", samples " << filePara.numberSamples << " " << filePara.sampleRate << "" << oendl;
int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8));
- owarn << "seconds " << sec << "" << oendl;
+ owarn << "seconds " << sec << "" << oendl;
@@ -1691,3 +1695,3 @@ void QtRec::doRename() {
void QtRec::okRename() {
- odebug << renameBox->text() << oendl;
+ odebug << renameBox->text() << oendl;
QString filename = renameBox->text();
@@ -1703,3 +1707,3 @@ void QtRec::okRename() {
- odebug << "filename is " + filename << oendl;
+ odebug << "filename is " + filename << oendl;
@@ -1774,3 +1778,3 @@ void QtRec::doVolMuting(bool b) {
void QtRec::doMicMuting(bool b) {
- // odebug << "mic mute" << oendl;
+ // odebug << "mic mute" << oendl;
Config cfg( "qpe" );
@@ -1792,3 +1796,3 @@ void QtRec::compressionSelected(bool b) {
bitRateComboBox->setEnabled( false);
- bitRateComboBox->setCurrentItem( 0);
+ bitRateComboBox->setCurrentItem( 1);
filePara.resolution = 16;
@@ -1830,3 +1834,3 @@ long QtRec::checkDiskSpace(const QString &path) {
void QtRec::receive( const QCString &msg, const QByteArray & ) {
- odebug << "Voicerecord received message "+msg << oendl;
+ odebug << "Voicerecord received message "+msg << oendl;
@@ -1850,3 +1854,3 @@ void QtRec::timerEvent( QTimerEvent * ) {
}
-
+
if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) {
@@ -1854,4 +1858,4 @@ void QtRec::timerEvent( QTimerEvent * ) {
}
-
- odebug << "" << secCount << "" << oendl;
+
+ odebug << "" << secCount << "" << oendl;
QString timeString;
@@ -1871,3 +1875,3 @@ void QtRec::changeTimeSlider(int index) {
if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return;
- // odebug << "Slider moved to " << index << "" << oendl;
+ // odebug << "Slider moved to " << index << "" << oendl;
paused = true;
@@ -1886,3 +1890,3 @@ void QtRec::timeSliderPressed() {
if( ListView1->currentItem() == 0) return;
- // odebug << "slider pressed" << oendl;
+ // odebug << "slider pressed" << oendl;
paused = true;
@@ -1895,3 +1899,3 @@ void QtRec::timeSliderReleased() {
- // odebug << "slider released " << sliderPos << "" << oendl;
+ // odebug << "slider released " << sliderPos << "" << oendl;
stopped = false;
@@ -1925,3 +1929,3 @@ void QtRec::rewindTimerTimeout() {
timeSlider->setValue( sliderValue ) ;
- // odebug << "" << sliderValue << "" << oendl;
+ // odebug << "" << sliderValue << "" << oendl;
QString timeString;
@@ -1939,3 +1943,3 @@ void QtRec::rewindReleased() {
total = newPos * 4;
- // odebug << "rewind released " << total << "" << oendl;
+ // odebug << "rewind released " << total << "" << oendl;
startTimer( 1000);
@@ -2003,3 +2007,3 @@ QString QtRec::getStorage(const QString &fileName) {
// storageComboBox->insertItem( name +" -> "+disk);
- // odebug << name << oendl;
+ // odebug << name << oendl;
}
@@ -2126,3 +2130,3 @@ void QtRec::changeStereoCheck(bool b) {
filePara.channels = ch;
-
+
cfg.write();
@@ -2130,2 +2134,2 @@ void QtRec::changeStereoCheck(bool b) {
-
+