summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2004-01-01 01:42:49 (UTC)
committer llornkcor <llornkcor>2004-01-01 01:42:49 (UTC)
commit0e411b3eb674699979998d4878388f03ffbcb1cd (patch) (unidiff)
tree1c7dfb9ac61b9403f66a78e30ef5fb4fcf8ff49e
parentc395fd13c51385f212648c9995361715ffc9e182 (diff)
downloadopie-0e411b3eb674699979998d4878388f03ffbcb1cd.zip
opie-0e411b3eb674699979998d4878388f03ffbcb1cd.tar.gz
opie-0e411b3eb674699979998d4878388f03ffbcb1cd.tar.bz2
make device user configurable
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/opierec.pro5
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp143
-rw-r--r--noncore/multimedia/opierec/qtrec.h2
3 files changed, 62 insertions, 88 deletions
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro
index 39fe493..5651151 100644
--- a/noncore/multimedia/opierec/opierec.pro
+++ b/noncore/multimedia/opierec/opierec.pro
@@ -1,8 +1,8 @@
1#CONFIG = qt qtopia warn_on release pdaudio 1CONFIG = qt qtopia warn_on release pdaudio
2CONFIG = qt warn_on release opie 2#CONFIG = qt warn_on release opie
3#CONFIG = qt warn_on release quick-app 3#CONFIG = qt warn_on release quick-app
4HEADERS = adpcm.h \ 4HEADERS = adpcm.h \
5 pixmaps.h \ 5 pixmaps.h \
6 helpwindow.h \ 6 helpwindow.h \
7 qtrec.h \ 7 qtrec.h \
8 device.h \ 8 device.h \
@@ -20,12 +20,13 @@ INTERFACES =
20contains(CONFIG, pdaudio) { 20contains(CONFIG, pdaudio) {
21# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz 21# LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz
22 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz 22 LIBS += -L$(QPEDIR)/lib -lqpe -lpthread -ljpeg -lpng -lz
23 INCLUDEPATH += $(QPEDIR)/include 23 INCLUDEPATH += $(QPEDIR)/include
24 DEPENDPATH += $(QPEDIR)/include 24 DEPENDPATH += $(QPEDIR)/include
25 DEFINES += PDAUDIO 25 DEFINES += PDAUDIO
26 DEFINES += THREADED
26 TARGET = qperec 27 TARGET = qperec
27 28
28# DESTDIR=$(QPEDIR)/bin 29# DESTDIR=$(QPEDIR)/bin
29} 30}
30 31
31contains(CONFIG, opie) { 32contains(CONFIG, opie) {
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index bc6abcc..0a6e5ae 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -1,12 +1,11 @@
1/**************************************************************************** 1/****************************************************************************
2 // qtrec.cpp 2 // qtrec.cpp
3 Created: Thu Jan 17 11:19:58 2002 3 Created: Thu Jan 17 11:19:58 2002
4 copyright 2002 by L.J. Potter <ljp@llornkcor.com> 4 copyright 2002 by L.J. Potter <ljp@llornkcor.com>
5****************************************************************************/ 5****************************************************************************/
6
7#define DEV_VERSION 6#define DEV_VERSION
8 7
9#include "pixmaps.h" 8#include "pixmaps.h"
10#include "qtrec.h" 9#include "qtrec.h"
11#include "waveform.h" 10#include "waveform.h"
12#include "device.h" 11#include "device.h"
@@ -113,17 +112,19 @@ QLabel *timeLabel;
113QSlider *timeSlider; 112QSlider *timeSlider;
114int sd; 113int sd;
115 114
116Waveform* waveform; 115Waveform* waveform;
117Device *soundDevice; 116Device *soundDevice;
118 117
119// threaded recording 118
120//fuckin fulgy here 119#ifdef THREADED
121//void quickRec() 120void quickRec()
122//{ 121#else
123void QtRec::quickRec() { 122 void QtRec::quickRec()
123#endif
124{
124 125
125 qDebug("%d", 126 qDebug("%d",
126 filePara.numberSamples/filePara.sampleRate * filePara.channels); 127 filePara.numberSamples/filePara.sampleRate * filePara.channels);
127 qDebug("samples %d, rate %d, channels %d", 128 qDebug("samples %d, rate %d, channels %d",
128 filePara.numberSamples, filePara.sampleRate, filePara.channels); 129 filePara.numberSamples, filePara.sampleRate, filePara.channels);
129 130
@@ -154,13 +155,13 @@ void QtRec::quickRec() {
154 memset( abuf, 0, BUFSIZE/2); 155 memset( abuf, 0, BUFSIZE/2);
155 memset( sbuf, 0, BUFSIZE); 156 memset( sbuf, 0, BUFSIZE);
156 memset( sbuf2, 0, BUFSIZE); 157 memset( sbuf2, 0, BUFSIZE);
157 158
158 for(;;) { 159 for(;;) {
159 if ( stopped) { 160 if ( stopped) {
160 qDebug("quickRec:: stopped"); 161 // qDebug("quickRec:: stopped");
161 break; 162 break;
162 } 163 }
163 164
164// number=::read( filePara.sd, sbuf, BUFSIZE); 165// number=::read( filePara.sd, sbuf, BUFSIZE);
165 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE); 166 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE);
166 167
@@ -230,23 +231,23 @@ void QtRec::quickRec() {
230 if( filePara.SecondsToRecord != 0) 231 if( filePara.SecondsToRecord != 0)
231 timeSlider->setValue( total); 232 timeSlider->setValue( total);
232// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total); 233// printf("Writing number %d, bytes %d,total %d\r",number, bytesWritten , total);
233// fflush(stdout); 234// fflush(stdout);
234 235
235 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels; 236 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels;
236
237 qApp->processEvents(); 237 qApp->processEvents();
238 238
239 if( total >= filePara.samplesToRecord) { 239 if( total >= filePara.samplesToRecord) {
240 stopped = true; 240 stopped = true;
241 break; 241 break;
242 } 242 }
243 } 243 }
244 } //end main loop 244 } //end main loop
245 245
246 } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; 246 } else {
247// <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8;
247 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ]; 248 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ];
248 memset( unsigned_inbuffer, 0, BUFSIZE); 249 memset( unsigned_inbuffer, 0, BUFSIZE);
249 memset( unsigned_outbuffer, 0, BUFSIZE); 250 memset( unsigned_outbuffer, 0, BUFSIZE);
250 251
251 for(;;) { 252 for(;;) {
252 if ( stopped) { 253 if ( stopped) {
@@ -279,17 +280,21 @@ void QtRec::quickRec() {
279 break; 280 break;
280 } 281 }
281 } //end main loop 282 } //end main loop
282 } 283 }
283} /// END quickRec() 284} /// END quickRec()
284 285
285void QtRec::playIt()
286 286
287//void playIt() 287#ifdef THREADED
288void playIt()
289#else
290 void QtRec::playIt()
291#endif
288{ 292{
289 int bytesWritten, number; 293 int bytesWritten = 0;
294 int number = 0;
290 int total = 0; // Total number of bytes read in so far. 295 int total = 0; // Total number of bytes read in so far.
291 if( filePara.resolution == 16 ) { //AFMT_S16_LE) { 296 if( filePara.resolution == 16 ) { //AFMT_S16_LE) {
292 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { 297 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
293 char abuf[ BUFSIZE / 2 ]; 298 char abuf[ BUFSIZE / 2 ];
294 short sbuf[ BUFSIZE ]; 299 short sbuf[ BUFSIZE ];
295 short sbuf2[ BUFSIZE * 2 ]; 300 short sbuf2[ BUFSIZE * 2 ];
@@ -319,14 +324,14 @@ void QtRec::playIt()
319 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2; 324 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2;
320 325
321 timeSlider->setValue( total/4); 326 timeSlider->setValue( total/4);
322// timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 327// timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
323// if(filePara.numberOfRecordedSeconds>1) 328// if(filePara.numberOfRecordedSeconds>1)
324// timeLabel->setText( timeString+ tr(" seconds")); 329// timeLabel->setText( timeString+ tr(" seconds"));
325 printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4); 330 // printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4);
326 fflush(stdout); 331 // fflush(stdout);
327 332
328 qApp->processEvents(); 333 qApp->processEvents();
329 334
330 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { 335 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
331// if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) { 336// if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) {
332 stopped = true; 337 stopped = true;
@@ -405,32 +410,38 @@ void QtRec::playIt()
405 410
406 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) { 411 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
407// if( total >= filePara.numberSamples ) { 412// if( total >= filePara.numberSamples ) {
408 stopped = true; 413 stopped = true;
409 break; 414 break;
410 } 415 }
411 printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples); 416 // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples);
412 fflush(stdout); 417 // fflush(stdout);
413 } 418 }
414 } 419 }
415} 420}
416 421
417/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
418 422
419QtRec::QtRec( QWidget* parent, const char* name, WFlags fl ) 423QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
420 : QWidget( parent, name, fl ) 424 : QWidget( parent, name, fl )
421{ 425{
422 if ( !name ) 426 if ( !name )
423 setName( "OpieRec" ); 427 setName( "OpieRec" );
424 init(); 428 init();
425 initConfig(); 429 initConfig();
426 initConnections(); 430 initConnections();
427 renameBox = 0; 431 renameBox = 0;
428 432
429// open sound device to get volumes 433// open sound device to get volumes
430 soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXEROUT, false); 434 Config hwcfg("OpieRec");
435 hwcfg.setGroup("Hardware");
436
437
438 soundDevice = new Device( this,
439 hwcfg.readEntry( "Audio",DSPSTROUT),
440 hwcfg.readEntry( "Mixer",DSPSTRMIXEROUT), false);
441 // soundDevice = new Device( this, hwcfg.readEntry( "Audio","hw:0"), hwcfg.readEntry( "Mixer","hw:0"), false);
431 442
432// soundDevice->setDeviceFormat(AFMT_S16_LE); 443// soundDevice->setDeviceFormat(AFMT_S16_LE);
433// soundDevice->setDeviceChannels(1); 444// soundDevice->setDeviceChannels(1);
434// soundDevice->setDeviceRate( 22050); 445// soundDevice->setDeviceRate( 22050);
435 446
436 getInVol(); 447 getInVol();
@@ -637,18 +648,12 @@ void QtRec::init() {
637 stereoCheckBox = new QCheckBox ( tr("Stereo Channels"), tab_3 ); 648 stereoCheckBox = new QCheckBox ( tr("Stereo Channels"), tab_3 );
638 649
639 glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3); 650 glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3);
640 glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0); 651 glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0);
641 glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1); 652 glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1);
642 653
643 QWidget *d = QApplication::desktop();
644 int width = d->width();
645 int height = d->height();
646
647 if( width < height) {
648
649 tab_5 = new QWidget( TabWidget, "tab_5" ); 654 tab_5 = new QWidget( TabWidget, "tab_5" );
650 655
651 QHBoxLayout *Layout19a; 656 QHBoxLayout *Layout19a;
652 Layout19a = new QHBoxLayout( tab_5); 657 Layout19a = new QHBoxLayout( tab_5);
653 Layout19a->setSpacing( 2 ); 658 Layout19a->setSpacing( 2 );
654 Layout19a->setMargin( 0 ); 659 Layout19a->setMargin( 0 );
@@ -693,58 +698,12 @@ void QtRec::init() {
693 fillDirectoryCombo(); 698 fillDirectoryCombo();
694 699
695 TabWidget->insertTab( tab_3, tr( "Options" ) ); 700 TabWidget->insertTab( tab_3, tr( "Options" ) );
696 701
697 TabWidget->insertTab( tab_5, tr( "Volume" ) ); 702 TabWidget->insertTab( tab_5, tr( "Volume" ) );
698 703
699 } else {// landscape
700
701 // Layout16->addWidget( dirGroup );
702 // Layout18->addLayout( Layout16 );
703 Layout15 = new QVBoxLayout(this);
704 Layout15->setSpacing( 2 );
705 Layout15->setMargin( 0 );
706
707 Layout15b = new QVBoxLayout(this);
708 Layout15b->setSpacing( 2 );
709 Layout15b->setMargin( 0 );
710
711 TextLabel2 = new QLabel( tab_3, "InputLabel" );
712 TextLabel2->setText( tr( "In"));
713 TextLabel2->setFixedWidth(35);
714 Layout15->addWidget( TextLabel2 );
715
716 TextLabel3 = new QLabel( tab_3, "OutputLabel" );
717 TextLabel3->setText( tr( "Out" ) );
718 Layout15b->addWidget( TextLabel3 );
719
720 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" );
721 InputSlider->setTickmarks(QSlider::Both);
722 Layout15->addWidget( InputSlider);
723
724 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" );
725 OutputSlider->setTickmarks(QSlider::Both);
726
727 Layout15b->addWidget( OutputSlider );
728
729 outMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 );
730 Layout15->addWidget( outMuteCheckBox );
731
732 inMuteCheckBox = new QCheckBox ( tr("mute"), tab_3 );
733 inMuteCheckBox-> setFocusPolicy ( QWidget::NoFocus );
734 Layout15b->addWidget( inMuteCheckBox );
735
736
737 Layout19->addLayout( Layout15 );
738 Layout19->addLayout( Layout15b );
739
740 fillDirectoryCombo();
741
742 TabWidget->insertTab( tab_3, tr( "Options" ) );
743
744 }
745 704
746 waveform = new Waveform( this, "waveform" ); 705 waveform = new Waveform( this, "waveform" );
747// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) ); 706// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) );
748 waveform->setMinimumSize( QSize( 0, 50 ) ); 707 waveform->setMinimumSize( QSize( 0, 50 ) );
749 708
750 layout->addMultiCellWidget( waveform, 8, 8, 0, 7 ); 709 layout->addMultiCellWidget( waveform, 8, 8, 0, 7 );
@@ -757,13 +716,13 @@ void QtRec::initIconView() {
757 Config cfg("OpieRec"); 716 Config cfg("OpieRec");
758 cfg.setGroup("Sounds"); 717 cfg.setGroup("Sounds");
759 QString temp; 718 QString temp;
760 QPixmap image0( ( const char** ) image0_data ); 719 QPixmap image0( ( const char** ) image0_data );
761 720
762 int nFiles = cfg.readNumEntry("NumberofFiles",0); 721 int nFiles = cfg.readNumEntry("NumberofFiles",0);
763 qDebug("init number of files %d", nFiles); 722 // qDebug("init number of files %d", nFiles);
764 723
765 for(int i=1;i<= nFiles;i++) { 724 for(int i=1;i<= nFiles;i++) {
766 725
767 QListViewItem * item; 726 QListViewItem * item;
768 QString fileS, mediaLocation, fileDate, filePath; 727 QString fileS, mediaLocation, fileDate, filePath;
769 728
@@ -1005,22 +964,26 @@ bool QtRec::rec() { //record
1005 QString msg; 964 QString msg;
1006 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 965 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution);
1007#ifdef DEV_VERSION 966#ifdef DEV_VERSION
1008 setCaption( msg); 967 setCaption( msg);
1009#endif 968#endif
1010 filePara.fileName=currentFile.latin1(); 969 filePara.fileName=currentFile.latin1();
1011// qDebug("Start recording thread"); 970 qDebug("Start recording thread");
1012 stopped = false; 971 stopped = false;
1013 972
1014// pthread_t thread1; 973#ifdef THREADED
1015// pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 974 pthread_t thread1;
975 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
976#endif
1016 toBeginningButton->setEnabled( false); 977 toBeginningButton->setEnabled( false);
1017 toEndButton->setEnabled( false); 978 toEndButton->setEnabled( false);
1018 979
1019 startTimer(1000); 980 startTimer(1000);
981#ifndef THREADED
1020 quickRec(); 982 quickRec();
983#endif
1021 } 984 }
1022 } //end setUpFile 985 } //end setUpFile
1023 } //end setupAudio 986 } //end setupAudio
1024 return true; 987 return true;
1025} 988}
1026/* 989/*
@@ -1067,18 +1030,19 @@ void QtRec::changedInVolume( ) {
1067} 1030}
1068 1031
1069 1032
1070bool QtRec::setupAudio( bool b) { 1033bool QtRec::setupAudio( bool b) {
1071 bool ok; 1034 bool ok;
1072 int sampleformat, stereo, flags; 1035 int sampleformat, stereo, flags;
1073 char * dspString, *mixerString; 1036 QString dspString, mixerString;
1074 1037
1075 filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16 1038 filePara.resolution = bitRateComboBox->currentText().toInt( &ok,10); //16
1076 1039
1040 if( !b) {
1041// we want to play
1077#ifdef PDAUDIO //ALSA 1042#ifdef PDAUDIO //ALSA
1078 if( !b) { // we want to play
1079 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { 1043 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) {
1080 sampleformat = SND_PCM_FORMAT_S16; 1044 sampleformat = SND_PCM_FORMAT_S16;
1081 filePara.resolution = 16; 1045 filePara.resolution = 16;
1082 } else if( filePara.resolution == 24 || compressionCheckBox->isChecked() ) { 1046 } else if( filePara.resolution == 24 || compressionCheckBox->isChecked() ) {
1083 sampleformat = SND_PCM_FORMAT_S24; 1047 sampleformat = SND_PCM_FORMAT_S24;
1084 filePara.resolution = 24; 1048 filePara.resolution = 24;
@@ -1087,27 +1051,28 @@ bool QtRec::setupAudio( bool b) {
1087 filePara.resolution = 32; 1051 filePara.resolution = 32;
1088 } else { 1052 } else {
1089 sampleformat = SND_PCM_FORMAT_U8; 1053 sampleformat = SND_PCM_FORMAT_U8;
1090 filePara.resolution = 8; 1054 filePara.resolution = 8;
1091 } 1055 }
1092#else 1056#else
1093 if( !b) {
1094// we want to play 1057// we want to play
1095 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { 1058 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) {
1096 sampleformat = AFMT_S16_LE; 1059 sampleformat = AFMT_S16_LE;
1097 filePara.resolution = 16; 1060 filePara.resolution = 16;
1098 } else { 1061 } else {
1099 sampleformat = AFMT_U8; 1062 sampleformat = AFMT_U8;
1100 filePara.resolution = 8; 1063 filePara.resolution = 8;
1101 } 1064 }
1102#endif 1065#endif
1103 1066
1104 stereo = filePara.channels; 1067 stereo = filePara.channels;
1105 flags = O_WRONLY; 1068 flags = O_WRONLY;
1106 dspString = DSPSTROUT; 1069 Config hwcfg("OpieRec");
1107 mixerString = DSPSTRMIXEROUT; 1070 hwcfg.setGroup("Hardware");
1071 dspString = hwcfg.readEntry( "Audio", DSPSTROUT);
1072 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXEROUT);
1108 recording = false; 1073 recording = false;
1109 } else { // we want to record 1074 } else { // we want to record
1110 1075
1111#ifdef PDAUDIO //ALSA 1076#ifdef PDAUDIO //ALSA
1112 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16") 1077 if( !bitRateComboBox->isEnabled() || bitRateComboBox->currentText() == "16")
1113 sampleformat = SND_PCM_FORMAT_S16; 1078 sampleformat = SND_PCM_FORMAT_S16;
@@ -1135,14 +1100,16 @@ bool QtRec::setupAudio( bool b) {
1135#endif 1100#endif
1136 1101
1137 stereo = filePara.channels; 1102 stereo = filePara.channels;
1138// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100; 1103// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
1139 flags= O_RDWR; 1104 flags= O_RDWR;
1140// flags= O_RDONLY; 1105// flags= O_RDONLY;
1141 dspString = DSPSTRIN; 1106 Config hwcfg("OpieRec");
1142 mixerString = DSPSTRMIXEROUT; 1107 hwcfg.setGroup("Hardware");
1108 dspString = hwcfg.readEntry( "Audio", DSPSTRIN);
1109 mixerString = hwcfg.readEntry( "Mixer", DSPSTRMIXERIN);
1143 recording = true; 1110 recording = true;
1144 } 1111 }
1145 1112
1146 // if(soundDevice) delete soundDevice; 1113 // if(soundDevice) delete soundDevice;
1147 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat); 1114 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat);
1148 qWarning("change waveform settings"); 1115 qWarning("change waveform settings");
@@ -1217,32 +1184,35 @@ bool QtRec::doPlay() {
1217 1184
1218 QString num; 1185 QString num;
1219 qDebug( "Play number of samples %d", filePara.numberSamples); 1186 qDebug( "Play number of samples %d", filePara.numberSamples);
1220 1187
1221// timeSlider->setRange( 0, filePara.numberSamples); 1188// timeSlider->setRange( 0, filePara.numberSamples);
1222 1189
1223 timeString.sprintf("%d", filePara.numberOfRecordedSeconds); 1190 timeString.sprintf("%f", filePara.numberOfRecordedSeconds);
1224 timeLabel->setText( timeString+ tr(" seconds")); 1191 timeLabel->setText( timeString+ tr(" seconds"));
1225 1192
1226 QString msg; 1193 QString msg;
1227 msg.sprintf("%d, %d, %d", 1194 msg.sprintf("%d, %d, %d",
1228 filePara.sampleRate, 1195 filePara.sampleRate,
1229 filePara.channels, 1196 filePara.channels,
1230 filePara.resolution); 1197 filePara.resolution);
1231#ifdef DEV_VERSION 1198#ifdef DEV_VERSION
1232 setCaption( msg); 1199 setCaption( msg);
1233#endif 1200#endif
1234 1201
1235 startTimer( 1000); 1202 startTimer( 1000);
1236// pthread_t thread2; 1203#ifdef THREADED
1237// pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/); 1204 pthread_t thread2;
1205 pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/);
1206#endif
1238 1207
1239 toBeginningButton->setEnabled( false); 1208 toBeginningButton->setEnabled( false);
1240 toEndButton->setEnabled( false); 1209 toEndButton->setEnabled( false);
1210#ifndef THREADED
1241 playIt(); 1211 playIt();
1242 1212#endif
1243 return true; 1213 return true;
1244} 1214}
1245 1215
1246 1216
1247void QtRec::changebitrateCombo(int i) { 1217void QtRec::changebitrateCombo(int i) {
1248 Config cfg("OpieRec"); 1218 Config cfg("OpieRec");
@@ -1863,13 +1833,13 @@ void QtRec::receive( const QCString &msg, const QByteArray & ) {
1863 qDebug("Voicerecord received message "+msg); 1833 qDebug("Voicerecord received message "+msg);
1864 1834
1865} 1835}
1866 1836
1867 1837
1868///////////////////////////// timerEvent 1838///////////////////////////// timerEvent
1869void QtRec::timerEvent( QTimerEvent *e ) { 1839void QtRec::timerEvent( QTimerEvent * ) {
1870 1840
1871// if(!recording) 1841// if(!recording)
1872// timeSlider->setValue( secCount); 1842// timeSlider->setValue( secCount);
1873// else 1843// else
1874// timeSlider->setValue( filePara.numberOfRecordedSeconds); 1844// timeSlider->setValue( filePara.numberOfRecordedSeconds);
1875 1845
@@ -2157,6 +2127,7 @@ void QtRec::changeStereoCheck(bool b) {
2157 cfg.writeEntry("stereo", b); 2127 cfg.writeEntry("stereo", b);
2158 filePara.channels = ch; 2128 filePara.channels = ch;
2159 2129
2160 cfg.write(); 2130 cfg.write();
2161} 2131}
2162 2132
2133
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h
index 31cff9e..5878d37 100644
--- a/noncore/multimedia/opierec/qtrec.h
+++ b/noncore/multimedia/opierec/qtrec.h
@@ -174,12 +174,14 @@ protected:
174 void fileBeamFinished( Ir *ir); 174 void fileBeamFinished( Ir *ir);
175 void initIconView(); 175 void initIconView();
176 void keyPressEvent( QKeyEvent *e); 176 void keyPressEvent( QKeyEvent *e);
177 void keyReleaseEvent( QKeyEvent *e); 177 void keyReleaseEvent( QKeyEvent *e);
178 void receive( const QCString &, const QByteArray & ); 178 void receive( const QCString &, const QByteArray & );
179 void showListMenu(QListViewItem * ); 179 void showListMenu(QListViewItem * );
180#ifndef THREADED
180 void quickRec(); 181 void quickRec();
181 void playIt(); 182 void playIt();
183#endif
182 184
183}; 185};
184 186
185#endif // QTREC_H 187#endif // QTREC_H