summaryrefslogtreecommitdiff
authorllornkcor <llornkcor>2003-12-25 21:52:44 (UTC)
committer llornkcor <llornkcor>2003-12-25 21:52:44 (UTC)
commitf2805565b0d7edd2e72445f6d56e43eadcdac72d (patch) (unidiff)
treeb9a74aec0c5616ae1976198c1f83945b697ed3d2
parent34a7e0451c95e8a19735610553dba064b68823d9 (diff)
downloadopie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.zip
opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.gz
opie-f2805565b0d7edd2e72445f6d56e43eadcdac72d.tar.bz2
uhhh.. helps to commit to correct branch
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp59
-rw-r--r--noncore/multimedia/opierec/device.h59
-rw-r--r--noncore/multimedia/opierec/main.cpp5
-rw-r--r--noncore/multimedia/opierec/opierec.control2
-rw-r--r--noncore/multimedia/opierec/opierec.pro25
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp1409
-rw-r--r--noncore/multimedia/opierec/qtrec.h15
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp17
-rw-r--r--noncore/multimedia/opierec/wavFile.h1
9 files changed, 791 insertions, 801 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index 11071d8..ce49e96 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -6,3 +6,3 @@
6#include <qpe/qcopenvelope_qws.h> 6#include <qpe/qcopenvelope_qws.h>
7#include <qpe/custom.h> 7
8 8
@@ -28,3 +28,3 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
28 mixstr = (char *)mixr; 28 mixstr = (char *)mixr;
29 29
30 devForm=-1; 30 devForm=-1;
@@ -40,3 +40,5 @@ Device::Device( QObject * parent, const char * dsp, const char * mixr, bool reco
40// flags = O_RDONLY; 40// flags = O_RDONLY;
41 selectMicInput(); 41
42// selectMicInput();
43
42 } 44 }
@@ -96,2 +98,3 @@ void Device::changedOutVolume(int vol) {
96 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false; 98 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << false;
99 qWarning("changing output vol %d", vol);
97 } 100 }
@@ -110,2 +113,3 @@ void Device::changedInVolume(int vol ) {
110 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false; 113 QCopEnvelope( "QPE/System", "micChange(bool)" ) << false;
114 qWarning("changing input volume %d", vol);
111 } 115 }
@@ -115,3 +119,3 @@ void Device::changedInVolume(int vol ) {
115bool Device::selectMicInput() { 119bool Device::selectMicInput() {
116/* 120
117 int md=0; 121 int md=0;
@@ -128,3 +132,3 @@ bool Device::selectMicInput() {
128 ::close(md); 132 ::close(md);
129*/ 133
130 return true; 134 return true;
@@ -147,3 +151,4 @@ exit(1);
147 */ 151 */
148 if (( sd = ::open( dspstr, flags)) == -1) { 152qDebug("Opening %s",dspstr);
153 if (( sd = ::open( dspstr, flags)) == -1) {
149 perror("open(\"/dev/dsp\")"); 154 perror("open(\"/dev/dsp\")");
@@ -151,3 +156,3 @@ exit(1);
151 +(QString)strerror(errno); 156 +(QString)strerror(errno);
152 qDebug(errorMsg); 157 qDebug("XXXXXXXXXXXXXXXXXXXXXXX "+errorMsg);
153 return -1; 158 return -1;
@@ -155,6 +160,9 @@ exit(1);
155 160
161qDebug("Opening mixer");
156 int mixerHandle=0; 162 int mixerHandle=0;
157 /* Set the input dsp device and its input gain the weird Zaurus way */ 163 if (( mixerHandle = open("/dev/mixer",O_RDWR))<0) {
158 if (( mixerHandle = open("/dev/mixer1",O_RDWR))<0) { 164 perror("open(\"/dev/mixer\")");
159 perror("open(\"/dev/mixer1\")"); 165 QString errorMsg="Could not open audio device\n /dev/dsp\n"
166 +(QString)strerror(errno);
167 qDebug("XXXXXXXXXXXXXXXXXXXXXX "+errorMsg);
160 } 168 }
@@ -201,3 +209,3 @@ exit(1);
201// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s); 209// qDebug("<<<<<<<<<<<<<>>>>>>>>>>>>"+s);
202 210
203// f2.close(); 211// f2.close();
@@ -205,4 +213,4 @@ exit(1);
205::close(mixerHandle ); 213::close(mixerHandle );
206 qDebug("open device %s", dspstr); 214// qDebug("open device %s", dspstr);
207 qDebug("success! %d",sd); 215// qDebug("success! %d",sd);
208 return sd; 216 return sd;
@@ -210,3 +218,3 @@ exit(1);
210 218
211bool Device::closeDevice( bool b) { 219bool Device::closeDevice( bool) {
212// if(b) {//close now 220// if(b) {//close now
@@ -224,3 +232,3 @@ bool Device::closeDevice( bool b) {
224 // sd=0; 232 // sd=0;
225 qDebug("closed dsp"); 233// qDebug("closed dsp");
226 return true; 234 return true;
@@ -292,3 +300,3 @@ int Device::getDeviceBits() {
292 int dBits=0; 300 int dBits=0;
293#if !defined(OPIE_NO_SOUND_PCM_READ_BITS) // zaurus doesnt have this 301#ifndef QT_QWS_EBX // zaurus doesnt have this
294 if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) { 302 if (ioctl( sd, SOUND_PCM_READ_BITS, &dBits) == -1) {
@@ -310,7 +318,8 @@ int Device::getDeviceFragSize() {
310 int frag_size; 318 int frag_size;
311 319
312 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) { 320 if (ioctl( sd, SNDCTL_DSP_GETBLKSIZE, &frag_size) == -1) {
313 qDebug("no fragsize"); 321 qDebug("no fragsize");
314 } else 322 } else {
315 qDebug("driver says frag size is %d", frag_size); 323 qDebug("driver says frag size is %d", frag_size);
324 }
316 return frag_size; 325 return frag_size;
@@ -335 +344,15 @@ bool Device::reset() {
335} 344}
345
346int Device::devRead(int soundDescriptor, short *buf, int size) {
347 int number = 0;
348 number = ::read( soundDescriptor, (char *)buf, size);
349 return number;
350}
351
352int Device::devWrite(int soundDescriptor, short * buf, int size) {
353 int bytesWritten = 0;
354 bytesWritten = ::write( soundDescriptor, buf, size);
355 return bytesWritten;
356}
357
358
diff --git a/noncore/multimedia/opierec/device.h b/noncore/multimedia/opierec/device.h
index f92be98..8152e85 100644
--- a/noncore/multimedia/opierec/device.h
+++ b/noncore/multimedia/opierec/device.h
@@ -7,33 +7,36 @@
7class Device : public QObject { 7class Device : public QObject {
8 Q_OBJECT 8 Q_OBJECT
9public: 9public:
10 Device( QObject * parent=0, const char * dspStr=0, const char * mixerStr=0, bool record=0 ); 10 Device( QObject * parent=0, const char * dspStr=0, const char * mixerStr=0, bool record=0 );
11 ~Device() {}; 11 ~Device() {};
12 bool closeDevice( bool); 12 bool closeDevice( bool);
13 int getChannels(); 13 int getChannels();
14 int getFormat(); 14 int getFormat();
15 int getInVolume(); 15 int getInVolume();
16 int getOutVolume(); 16 int getOutVolume();
17 int getRate(); 17 int getRate();
18 int getRes(); 18 int getRes();
19 int sd; //sound descriptor 19 int sd; //sound descriptor
20 void changedInVolume(int); 20 void changedInVolume(int);
21 void changedOutVolume(int); 21 void changedOutVolume(int);
22 bool openDsp(); 22 bool openDsp();
23 int getDeviceFormat(); 23 int getDeviceFormat();
24 int getDeviceRate(); 24 int getDeviceRate();
25 int getDeviceBits(); 25 int getDeviceBits();
26 int getDeviceChannels(); 26 int getDeviceChannels();
27 int getDeviceFragSize(); 27 int getDeviceFragSize();
28 bool setFragSize(int); 28 bool setFragSize(int);
29 bool setDeviceChannels(int); 29 bool setDeviceChannels(int);
30 bool setDeviceRate(int); 30 bool setDeviceRate(int);
31 bool setDeviceFormat(int); 31 bool setDeviceFormat(int);
32bool reset(); 32 bool reset();
33
34 int devRead(int, short *, int);
35 int devWrite(int, short *, int);
33 36
34private: 37private:
35 int devRes, devCh, devRate, devForm, flags; 38 int devRes, devCh, devRate, devForm, flags;
36 char *dspstr, *mixstr; 39 char *dspstr, *mixstr;
37 bool selectMicInput(); 40 bool selectMicInput();
38 int openDevice( int ); 41 int openDevice( int );
39private slots: 42private slots:
diff --git a/noncore/multimedia/opierec/main.cpp b/noncore/multimedia/opierec/main.cpp
index 4a94800..e36d050 100644
--- a/noncore/multimedia/opierec/main.cpp
+++ b/noncore/multimedia/opierec/main.cpp
@@ -14,3 +14,6 @@
14#include <opie/oapplicationfactory.h> 14#include <opie/oapplicationfactory.h>
15 15
16OPIE_EXPORT_APP( OApplicationFactory<QtRec> ) 16OPIE_EXPORT_APP( OApplicationFactory<QtRec> )
17
18
19
diff --git a/noncore/multimedia/opierec/opierec.control b/noncore/multimedia/opierec/opierec.control
index cb97933..b01406e 100644
--- a/noncore/multimedia/opierec/opierec.control
+++ b/noncore/multimedia/opierec/opierec.control
@@ -1,3 +1,3 @@
1Package: opierec 1Package: opierec
2Files: plugins/application/libopierec.so* bin/opierec pics/opierec apps/Applications/opierec.desktop 2Files: bin/opierec pics/opierec apps/Applications/opierec.desktop
3Priority: optional 3Priority: optional
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro
index 7dbc4f7..b607c09 100644
--- a/noncore/multimedia/opierec/opierec.pro
+++ b/noncore/multimedia/opierec/opierec.pro
@@ -1,11 +1,26 @@
1CONFIG = qt warn_on debug 1CONFIG = qt warn_on release
2#CONFIG = qt warn_on release quick-app 2#CONFIG = qt warn_on release quick-app
3HEADERS = adpcm.h pixmaps.h qtrec.h device.h wavFile.h 3HEADERS = adpcm.h \
4SOURCES = adpcm.c main.cpp qtrec.cpp device.cpp wavFile.cpp 4 pixmaps.h \
5 helpwindow.h \
6 qtrec.h \
7 device.h \
8 wavFile.h \
9 waveform.h
10SOURCES = adpcm.c \
11 helpwindow.cpp \
12 main.cpp \
13 qtrec.cpp \
14 device.cpp \
15 wavFile.cpp \
16 waveform.cpp
5INCLUDEPATH += $(OPIEDIR)/include 17INCLUDEPATH += $(OPIEDIR)/include
6DEPENDPATH += $(OPIEDIR)/include 18DEPENDPATH += $(OPIEDIR)/include
19#LIBS += -L/opt/buildroot-opie/output/staging/target/lib -lqpe -lpthread -ljpeg -lpng -lz
7LIBS += -lqpe -lpthread 20LIBS += -lqpe -lpthread
8INTERFACES = 21INTERFACES =
9TARGET = opierec 22TARGET = opierec
10#TMAKE_CXXFLAGS += -DQT_QWS_VERCEL_IDR -DQWS -fno-exceptions -fno-rtti 23DESTDIR=$(OPIEDIR)/bin
24
11include ( $(OPIEDIR)/include.pro ) 25include ( $(OPIEDIR)/include.pro )
26
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index 1e36c96..aeab26d 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -10,2 +10,4 @@
10#include "qtrec.h" 10#include "qtrec.h"
11#include "waveform.h"
12#include "device.h"
11 13
@@ -19,6 +21,2 @@ extern "C" {
19 21
20// #if defined (QTOPIA_INTERNAL_FSLP)
21// #include <qpe/lnkproperties.h>
22// #endif
23
24#include <qpe/config.h> 22#include <qpe/config.h>
@@ -57,5 +55,22 @@ extern "C" {
57#include <unistd.h> 55#include <unistd.h>
58#include<sys/wait.h> 56#include <sys/wait.h>
59#include <sys/signal.h> 57#include <sys/signal.h>
60 58
59#if defined(QT_QWS_SL5XXX)
60///#if defined(QT_QWS_EBX)
61
62#define DSPSTROUT "/dev/dsp"
63#define DSPSTRIN "/dev/dsp1"
64#define DSPSTRMIXEROUT "/dev/mixer"
65#define DSPSTRMIXERIN "/dev/mixer1"
66
67#else
68
69#define DSPSTROUT "/dev/dsp"
70#define DSPSTRIN "/dev/dsp"
71#define DSPSTRMIXERIN "/dev/mixer"
72#define DSPSTRMIXEROUT "/dev/mixer"
73
74#endif
75
61//#define ZAURUS 0 76//#define ZAURUS 0
@@ -64,5 +79,2 @@ struct adpcm_state decoder_state;
64 79
65long findPeak(long input );
66//char deviceRates[];
67
68typedef struct { 80typedef struct {
@@ -87,3 +99,3 @@ fileParameters filePara;
87 99
88bool monitoring, recording; 100bool monitoring, recording, playing;
89bool stopped; 101bool stopped;
@@ -93,18 +105,16 @@ int sd;
93 105
94// #if defined(QT_QWS_EBX) 106Waveform* waveform;
95// #define DSPSTROUT "/dev/dsp" 107Device *soundDevice;
96// #define DSPSTRIN "/dev/dsp1"
97// #define DSPSTRMIXEROUT "/dev/mixer"
98// #define DSPSTRMIXERIN "/dev/mixer1"
99// #else
100#define DSPSTROUT "/dev/dsp"
101#define DSPSTRIN "/dev/dsp"
102#define DSPSTRMIXERIN "/dev/mixer"
103#define DSPSTRMIXEROUT "/dev/mixer"
104//#endif
105 108
106// threaded recording 109// threaded recording
107void quickRec() { 110//fuckin fulgy here
111void quickRec()
112{
108//void QtRec::quickRec() { 113//void QtRec::quickRec() {
109 114
115 qDebug("%d",
116 filePara.numberSamples/filePara.sampleRate * filePara.channels);
117 qDebug("samples %d, rate %d, channels %d",
118 filePara.numberSamples, filePara.sampleRate, filePara.channels);
119
110 int total = 0; // Total number of bytes read in so far. 120 int total = 0; // Total number of bytes read in so far.
@@ -112,46 +122,40 @@ void quickRec() {
112 122
113 count_info info; 123 bytesWritten = 0;
114 124 number = 0;
115 bytesWritten=0; 125 QString num;
116 number=0; 126 int level = 0;
117 QString num, timeString; 127 int threshold = 0;
118 int level=0; 128// int bits = filePara.resolution;
119 int threshold=0; 129// qDebug("bits %d", bits);
120 // if(limit != 0)
121 // t->start( ( limit +.3) , true);
122
123 recording = true;
124 //rate=filePara.sampleRate;
125 // int bits = filePara.resolution;
126 audio_buf_info inInfo;
127 ioctl( filePara.fd, SNDCTL_DSP_GETISPACE, &inInfo);
128 // qDebug("ispace is frags %d, total %d", inInfo.fragments, inInfo.fragstotal);
129 130
130 if( filePara.resolution == 16 ) { //AFMT_S16_LE) 131 if( filePara.resolution == 16 ) { //AFMT_S16_LE)
131 level=7; 132// qDebug("AFMT_S16_LE size %d", filePara.SecondsToRecord);
132 threshold=0; 133// qDebug("samples to record %d", filePara.samplesToRecord);
133 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 134// qDebug("%d", filePara.sd);
134 timeLabel->setText( timeString+ " seconds"); 135 level = 7;
135 136 threshold = 0;
136 if( filePara.format==WAVE_FORMAT_DVI_ADPCM) { 137
137 // qDebug("start recording WAVE_FORMAT_DVI_ADPCM"); 138 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
138 char abuf[BUFSIZE/2]; 139// qDebug("start recording WAVE_FORMAT_DVI_ADPCM");
139 short sbuf[BUFSIZE]; 140 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
140 short sbuf2[BUFSIZE]; 141 char abuf[ BUFSIZE/2 ];
141 memset( abuf,0,BUFSIZE/2); 142 short sbuf[ BUFSIZE ];
142 memset( sbuf,0,BUFSIZE); 143 short sbuf2[ BUFSIZE ];
143 memset( sbuf2,0,BUFSIZE); 144 memset( abuf, 0, BUFSIZE/2);
145 memset( sbuf, 0, BUFSIZE);
146 memset( sbuf2, 0, BUFSIZE);
144 147
145 for(;;) { 148 for(;;) {
146 if (stopped) { 149 if ( stopped) {
147 break; // stop if playing was set to false 150 qDebug("quickRec:: stopped");
151 break;
148 } 152 }
149 153
150 number=::read( filePara.sd, sbuf, BUFSIZE); 154// number=::read( filePara.sd, sbuf, BUFSIZE);
155 number = soundDevice ->devRead( filePara.sd, sbuf, BUFSIZE);
156
151 if(number <= 0) { 157 if(number <= 0) {
152 perror("recording error "); 158 perror("recording error ");
153 // qDebug( "%s %d", filePara.fileName, number); 159 qDebug( "%s %d", filePara.fileName, number);
154 // errorStop(); 160 stopped = true;
155 recording=stopped=false;
156// QMessageBox::message("Note", "Error recording to file\n%s",filePara.fileName);
157 return; 161 return;
@@ -161,71 +165,55 @@ void quickRec() {
161 adpcm_coder( sbuf, abuf, number/2, &encoder_state); 165 adpcm_coder( sbuf, abuf, number/2, &encoder_state);
162 bytesWritten = ::write( filePara.fd , abuf, number/4); 166 bytesWritten = soundDevice->devWrite( filePara.fd , (short *)abuf, number/4);
163 long peak; 167 waveform->newSamples( (const short *)abuf, bytesWritten );
164 for (int i = 0; i < number; i++) 168
165 { //since Z is mono do normally
166 peak = findPeak((long)sbuf[i]);
167 printf("peak %ld\r",peak);
168 fflush(stdout);
169 }
170 //------------->>>> out to file
171 // if(filePara.channels==1)
172 // total += bytesWritten/2; //mono
173 // else
174 total += bytesWritten; 169 total += bytesWritten;
175 filePara.numberSamples = total; 170 filePara.numberSamples = total;
176// if( total >= filePara.samplesToRecord)
177// timeSlider->setValue(0);
178// else if( filePara.SecondsToRecord !=0)
179 timeSlider->setValue( total); 171 timeSlider->setValue( total);
180 172
181 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2; 173 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2 / filePara.channels;
182 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info);
183 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
184 timeLabel->setText( timeString + " seconds");
185 174
186 qApp->processEvents(); 175 qApp->processEvents();
187 if( total >= filePara.samplesToRecord) 176 if( total >= filePara.samplesToRecord) {
177 stopped = true;
188 break; 178 break;
179 }
189 } 180 }
190 } else { 181 } else {
191 // qDebug("start recording WAVE_FORMAT_PCM"); 182 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
192 short inbuffer[BUFSIZE], outbuffer[BUFSIZE]; 183 qDebug("start recording WAVE_FORMAT_PCM");
193 memset( inbuffer,0,BUFSIZE); 184 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ];
194 memset( outbuffer,0,BUFSIZE); 185 memset( inbuffer, 0, BUFSIZE);
186 memset( outbuffer, 0, BUFSIZE);
187
195 for(;;) { 188 for(;;) {
196 if (stopped) { 189 if ( stopped) {
190 qDebug("quickRec:: stopped");
191 stopped = true;
197 break; // stop if playing was set to false 192 break; // stop if playing was set to false
193 return;
198 } 194 }
199 195
200 number=::read( filePara.sd, inbuffer, BUFSIZE); 196 number = soundDevice ->devRead( filePara.sd, (short *)inbuffer, BUFSIZE);
201 if(number <= 0) { 197 waveform->newSamples( inbuffer, number );
202 perror("recording error "); 198
203 recording=stopped=false; 199 if( number <= 0) {
204 // errorStop(); 200 perror( "recording error ");
205 return;// false; 201 qDebug( filePara.fileName);
202 stopped = true;
203 return;
206 } 204 }
207/* for (int i=0;i< number;i++) { //2*i is left channel 205
208outbuffer[i]=inbuffer[i]>>1; // no clippy, please 206 bytesWritten = soundDevice->devWrite( filePara.fd , inbuffer, number);
209}*/ 207
210 bytesWritten = ::write( filePara.fd , inbuffer, number); 208 if( bytesWritten < 0) {
211//------------->>>> out to file
212 if(bytesWritten < 0) {
213 // errorStop();
214 perror("File writing error "); 209 perror("File writing error ");
215 return;// false; 210 stopped = true;
211 return;
216 } 212 }
217 213
218 // if(filePara.channels==1)
219 // total += bytesWritten/2; //mono
220 // else
221 total += bytesWritten; 214 total += bytesWritten;
222 long peak; 215
223 for (int i = 0; i < number; i++)
224 { //since Z is mono do normally
225 peak = findPeak((long)inbuffer[i]);
226 printf("peak %ld\r",peak);
227 fflush(stdout);
228 }
229 filePara.numberSamples = total; 216 filePara.numberSamples = total;
230 if(filePara.SecondsToRecord !=0) 217
218 if( filePara.SecondsToRecord != 0)
231 timeSlider->setValue( total); 219 timeSlider->setValue( total);
@@ -234,12 +222,11 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
234 222
235 ioctl( filePara.sd, SNDCTL_DSP_GETIPTR, &info); 223 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2/filePara.channels;
236// qDebug("%d, %d", info.bytes, ( info.bytes / filePara.sampleRate) / 2);
237 224
238 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
239 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
240 timeLabel->setText( timeString + " seconds");
241 qApp->processEvents(); 225 qApp->processEvents();
242 if( total >= filePara.samplesToRecord) 226
227 if( total >= filePara.samplesToRecord) {
228 stopped = true;
243 break; 229 break;
244 } 230 }
231 }
245 } //end main loop 232 } //end main loop
@@ -247,3 +234,3 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
247 } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8; 234 } else { // <<<<<<<<<<<<<<<<<<<<<<< format = AFMT_U8;
248 unsigned char unsigned_inbuffer[BUFSIZE], unsigned_outbuffer[BUFSIZE]; 235 unsigned char unsigned_inbuffer[ BUFSIZE ], unsigned_outbuffer[ BUFSIZE ];
249 memset( unsigned_inbuffer, 0, BUFSIZE); 236 memset( unsigned_inbuffer, 0, BUFSIZE);
@@ -252,33 +239,17 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
252 for(;;) { 239 for(;;) {
253 if (stopped) { 240 if ( stopped) {
254 // qDebug("quickRec:: stopped"); 241 qDebug("quickRec:: stopped");
255 break; // stop if playing was set to false 242 break; // stop if playing was set to false
256 } 243 }
257 number=::read( filePara.sd, unsigned_inbuffer, BUFSIZE); 244
258//-------------<<<< in from device 245 number = ::read( filePara.sd, unsigned_inbuffer, BUFSIZE);
259// val = (data ^ 0x80) << 8;
260
261//unsigned_outbuffer = (unsigned_inbuffer ^ 0x80) << 8;
262
263// if(number <= 0) {
264// perror("recording error ");
265// qDebug(filePara.fileName);
266// // errorStop();
267// QMessageBox::message("Note","error recording");
268// return;// false;
269// }
270// for (int i=0;i< number;i++) { //2*i is left channel
271// unsigned_outbuffer[i]=unsigned_inbuffer[i]>>1; // no clippy, please
272// }
273
274 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number); 246 bytesWritten = ::write( filePara.fd , unsigned_inbuffer, number);
275 247
276//------------->>>> out to file
277 if(bytesWritten < 0) { 248 if(bytesWritten < 0) {
278 recording=stopped=false; 249 stopped = true;
279 // errorStop();
280 QMessageBox::message("Note","There was a problem\nwriting to the file"); 250 QMessageBox::message("Note","There was a problem\nwriting to the file");
281 perror("File writing error "); 251 perror("File writing error ");
282 return;// false; 252 return;
283 } 253 }
254
284 total += bytesWritten; 255 total += bytesWritten;
@@ -287,3 +258,3 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
287 // fflush(stdout); 258 // fflush(stdout);
288 if(filePara.SecondsToRecord !=0) 259 if( filePara.SecondsToRecord !=0)
289 timeSlider->setValue( total); 260 timeSlider->setValue( total);
@@ -292,16 +263,140 @@ outbuffer[i]=inbuffer[i]>>1; // no clippy, please
292 263
293 timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
294 timeLabel->setText( timeString + " seconds");
295
296 qApp->processEvents(); 264 qApp->processEvents();
297 if( total >= filePara.samplesToRecord) 265 if( total >= filePara.samplesToRecord) {
266 stopped = true;
298 break; 267 break;
268 }
299 } //end main loop 269 } //end main loop
300 } 270 }
301// qDebug("Final %d, %d", filePara.samplesToRecord , filePara.numberOfRecordedSeconds);
302} /// END quickRec() 271} /// END quickRec()
303 272
304// threaded play
305void playIt() {
306 273
274void playIt()
275{
276 int bytesWritten, number;
277 int total = 0; // Total number of bytes read in so far.
278 if( filePara.resolution == 16 ) { //AFMT_S16_LE) {
279 if( filePara.format == WAVE_FORMAT_DVI_ADPCM) {
280 char abuf[ BUFSIZE / 2 ];
281 short sbuf[ BUFSIZE ];
282 short sbuf2[ BUFSIZE * 2 ];
283 memset( abuf, 0, BUFSIZE / 2);
284 memset( sbuf, 0, BUFSIZE);
285 memset( sbuf2, 0, BUFSIZE * 2);
286// <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
287 for(;;) { // play loop
288 if ( stopped) {
289 break;
290 return;
291 }// stop if playing was set to false
292
293 number = ::read( filePara.fd, abuf, BUFSIZE / 2);
294 adpcm_decoder( abuf, sbuf, number * 2, &decoder_state);
295
296// for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel
297// sbuf2[i+1]=sbuf2[i]=sbuf[i];
298// }
299 bytesWritten = write ( filePara.sd, sbuf, number * 4);
300 waveform->newSamples( (const short *)sbuf, number );
301 // if(filePara.channels==1)
302 // total += bytesWritten/2; //mono
303 // else
304 total += bytesWritten;
305 filePara.numberSamples = total/4;
306 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2;
307
308 timeSlider->setValue( total/4);
309// timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
310// if(filePara.numberOfRecordedSeconds>1)
311// timeLabel->setText( timeString+ tr(" seconds"));
312 printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4);
313 fflush(stdout);
314
315 qApp->processEvents();
316
317 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
318// if( total >= filePara.numberSamples ){//|| secCount > filePara.numberOfRecordedSeconds ) {
319 stopped = true;
320 break;
321 }
322 }
323 } else {
324 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
325 short inbuffer[ BUFSIZE ], outbuffer[ BUFSIZE ];
326 memset( inbuffer, 0, BUFSIZE);
327 memset( outbuffer, 0, BUFSIZE);
328
329 for(;;) { // play loop
330 if ( stopped) {
331 break;
332 return;
333 }
334// stop if playing was set to false
335 number = ::read( filePara.fd, inbuffer, BUFSIZE);
336// for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel
337// // for (int i=0;i< number ; i++) { //2*i is left channel
338// outbuffer[i+1]= outbuffer[i]=inbuffer[i];
339// }
340 bytesWritten = ::write( filePara.sd, inbuffer, number);
341 waveform->newSamples( inbuffer, bytesWritten );
342 //-------------->>>> out to device
343 // total+=bytesWritten;
344 // if(filePara.channels==1)
345 // total += bytesWritten/2; //mono
346 // else
347 total += bytesWritten;
348 timeSlider->setValue( total);
349
350 filePara.numberSamples = total;
351 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
352
353// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
354// timeLabel->setText( timeString + tr(" seconds"));
355
356 qApp->processEvents();
357
358 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
359 qWarning("Jane! Stop this crazy thing!");
360 stopped = true;
361// playing = false;
362 break;
363 }
364 }
365 printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
366 fflush(stdout);
367 } //end loop
368 } else {
369/////////////////////////////// format = AFMT_U8;
370 unsigned char unsigned_inbuffer[ BUFSIZE ]; //, unsigned_outbuffer[BUFSIZE];
371 memset( unsigned_inbuffer, 0, BUFSIZE);
372 for(;;) {
373// main loop
374 if (stopped) {
375 break; // stop if playing was set to false
376 return;
377 }
378 number = ::read( filePara.fd, unsigned_inbuffer, BUFSIZE);
379//data = (val >> 8) ^ 0x80;
380 // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80;
381 bytesWritten = write ( filePara.sd, unsigned_inbuffer, number);
382 waveform->newSamples( (const short *)unsigned_inbuffer, bytesWritten );
383 total += bytesWritten;
384
385 timeSlider->setValue( total);
386 filePara.numberSamples = total;
387
388 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate;
389// timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
390// timeLabel->setText( timeString + tr(" seconds"));
391 qApp->processEvents();
392
393 if( /*total >= filePara.numberSamples || */ bytesWritten == 0) {
394// if( total >= filePara.numberSamples ) {
395 stopped = true;
396 break;
397 }
398 printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples);
399 fflush(stdout);
400 }
401 }
307} 402}
@@ -309,8 +404,6 @@ void playIt() {
309/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>> 404/////////////////<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>
310QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
311 : QWidget( parent, name, fl ) {
312 // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device
313 // autoMute=TRUE;
314// QPEApplication::grabKeyboard();
315 405
406QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
407 : QWidget( parent, name, fl )
408{
316 if ( !name ) 409 if ( !name )
@@ -332,8 +425,8 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
332 425
333 soundDevice->closeDevice( true); 426 soundDevice->closeDevice( true);
334 soundDevice->sd=-1; 427 soundDevice->sd = -1;
335 soundDevice=0; 428 soundDevice = 0;
336 wavFile=0; 429 wavFile = 0;
337 430
338 if(soundDevice) delete soundDevice; 431 if( soundDevice) delete soundDevice;
339 432
@@ -341,6 +434,6 @@ QtRec::QtRec( QWidget* parent, const char* name, WFlags fl )
341 434
342 if(autoMute) 435 if( autoMute)
343 doMute(true); 436 doMute( true);
344 ListView1->setFocus(); 437 ListView1->setFocus();
345 playing=false; 438 playing = false;
346} 439}
@@ -353,4 +446,4 @@ void QtRec::cleanUp() {
353 446
354 if(!stopped) { 447 if( !stopped) {
355 stopped=true; 448 stopped = true;
356 endRecording(); 449 endRecording();
@@ -360,9 +453,7 @@ void QtRec::cleanUp() {
360 453
361 if(autoMute) 454 if( autoMute)
362 doMute(false); 455 doMute(false);
363 456
364 if(wavFile) delete wavFile; 457 if( wavFile) delete wavFile;
365// if(soundDevice) delete soundDevice; 458// if(soundDevice) delete soundDevice;
366// QPEApplication::grabKeyboard();
367// QPEApplication::ungrabKeyboard();
368} 459}
@@ -371,3 +462,3 @@ void QtRec::init() {
371 462
372 needsStereoOut=false; 463 needsStereoOut = false;
373 QPixmap image3( ( const char** ) image3_data ); 464 QPixmap image3( ( const char** ) image3_data );
@@ -376,3 +467,3 @@ void QtRec::init() {
376 467
377 stopped=true; 468 stopped = true;
378 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) ); 469 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
@@ -384,3 +475,3 @@ void QtRec::init() {
384 layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7); 475 layout->addMultiCellWidget(TabWidget, 0, 7, 0, 7);
385 // TabWidget->setTabShape(QTabWidget::Triangular); 476// TabWidget->setTabShape(QTabWidget::Triangular);
386 477
@@ -394,5 +485,3 @@ void QtRec::init() {
394 timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" ); 485 timeSlider = new QSlider( 0,100,10,0, QSlider::Horizontal, tab, (const char *) "timeSlider" );
395 // timeSlider->setFixedWidth(150);
396 layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3); 486 layout1->addMultiCellWidget( timeSlider, 1, 1, 0, 3);
397// timeSlider->setTickmarks(QSlider::Above);
398 487
@@ -403,3 +492,3 @@ void QtRec::init() {
403 playLabel2->setText(tr("Play") ); 492 playLabel2->setText(tr("Play") );
404 playLabel2->setFixedHeight(18); 493 playLabel2->setFixedHeight( 18);
405 layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4); 494 layout1->addMultiCellWidget( playLabel2, 0, 0, 4, 4);
@@ -408,3 +497,3 @@ void QtRec::init() {
408 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4); 497 layout1->addMultiCellWidget( Stop_PushButton, 1, 1, 4, 4);
409 Stop_PushButton->setFixedSize(22,22); 498 Stop_PushButton->setFixedSize( 22, 22);
410 Stop_PushButton->setPixmap( image4 ); 499 Stop_PushButton->setPixmap( image4 );
@@ -413,3 +502,3 @@ void QtRec::init() {
413 layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5); 502 layout1->addMultiCellWidget(toBeginningButton, 1, 1, 5, 5);
414 toBeginningButton->setFixedSize(22,22); 503 toBeginningButton->setFixedSize( 22, 22);
415 toBeginningButton->setPixmap( Resource::loadPixmap("fastback") ); 504 toBeginningButton->setPixmap( Resource::loadPixmap("fastback") );
@@ -418,3 +507,3 @@ void QtRec::init() {
418 layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6); 507 layout1->addMultiCellWidget( toEndButton, 1, 1, 6, 6);
419 toEndButton->setFixedSize(22,22); 508 toEndButton->setFixedSize( 22, 22);
420 toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) ); 509 toEndButton->setPixmap( Resource::loadPixmap( "fastforward" ) );
@@ -424,3 +513,3 @@ void QtRec::init() {
424 recLabel2->setText(tr("Rec")); 513 recLabel2->setText(tr("Rec"));
425 recLabel2->setFixedHeight(18); 514 recLabel2->setFixedHeight( 18);
426 layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7); 515 layout1->addMultiCellWidget( recLabel2, 0, 0, 7, 7);
@@ -429,3 +518,3 @@ void QtRec::init() {
429 layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7); 518 layout1->addMultiCellWidget( Rec_PushButton, 1, 1, 7, 7);
430 Rec_PushButton->setFixedSize(22,22); 519 Rec_PushButton->setFixedSize( 22, 22);
431 Rec_PushButton->setPixmap( image6 ); 520 Rec_PushButton->setPixmap( image6 );
@@ -436,6 +525,8 @@ void QtRec::init() {
436 rewindTimer = new QTimer( this ); 525 rewindTimer = new QTimer( this );
437 connect( rewindTimer, SIGNAL( timeout() ), SLOT( rewindTimerTimeout() ) ); 526 connect( rewindTimer, SIGNAL( timeout() ),
527 this, SLOT( rewindTimerTimeout() ) );
438 528
439 forwardTimer = new QTimer( this ); 529 forwardTimer = new QTimer( this );
440 connect( forwardTimer, SIGNAL( timeout() ), SLOT( forwardTimerTimeout() ) ); 530 connect( forwardTimer, SIGNAL( timeout() ),
531 this, SLOT( forwardTimerTimeout() ) );
441 532
@@ -449,17 +540,17 @@ void QtRec::init() {
449 ListView1->addColumn( tr( "Name" ) ); 540 ListView1->addColumn( tr( "Name" ) );
450 ListView1->setColumnWidth(0,140); 541 ListView1->setColumnWidth( 0, 140);
451 ListView1->setSorting( 1, false); 542 ListView1->setSorting( 1, false);
452 ListView1->addColumn( tr( "Time" ) ); //in seconds 543 ListView1->addColumn( tr( "Time" ) ); //in seconds
453 ListView1->setColumnWidth(1,50); 544 ListView1->setColumnWidth( 1, 50);
454 ListView1->addColumn( tr("Location") ); 545 ListView1->addColumn( tr("Location") );
455 ListView1->setColumnWidth(2,50); 546 ListView1->setColumnWidth( 2, 50);
456 ListView1->addColumn( tr("Date") ); 547 ListView1->addColumn( tr("Date") );
457 ListView1->setColumnWidth(3,63); 548 ListView1->setColumnWidth( 3, 63);
458 549
459 ListView1->setColumnWidthMode(0,QListView::Manual); 550 ListView1->setColumnWidthMode( 0, QListView::Manual);
460 ListView1->setColumnAlignment(1,QListView::AlignCenter); 551 ListView1->setColumnAlignment( 1, QListView::AlignCenter);
461 ListView1->setColumnAlignment(2,QListView::AlignRight); 552 ListView1->setColumnAlignment( 2, QListView::AlignRight);
462 ListView1->setColumnAlignment(3,QListView::AlignLeft); 553 ListView1->setColumnAlignment( 3, QListView::AlignLeft);
463 ListView1->setAllColumnsShowFocus( true ); 554 ListView1->setAllColumnsShowFocus( true );
464 QPEApplication::setStylusOperation( ListView1->viewport(),QPEApplication::RightOnHold); 555 QPEApplication::setStylusOperation( ListView1->viewport(), QPEApplication::RightOnHold);
465 556
@@ -469,16 +560,6 @@ void QtRec::init() {
469 tab_3 = new QWidget( TabWidget, "tab_3" ); 560 tab_3 = new QWidget( TabWidget, "tab_3" );
561 QGridLayout *glayout3 = new QGridLayout( tab_3 );
562 glayout3->setSpacing( 2);
563 glayout3->setMargin( 2);
470 //////////////////////////////////// 564 ////////////////////////////////////
471
472 Layout19 = new QHBoxLayout( tab_3);
473 Layout19->setSpacing( 2 );
474 Layout19->setMargin( 0 );
475
476 Layout18 = new QVBoxLayout(this);
477 Layout18->setSpacing( 2 );
478 Layout18->setMargin( 0 );
479
480 Layout17 = new QHBoxLayout(this);
481 Layout17->setSpacing( 2 );
482 Layout17->setMargin( 0 );
483
484 sampleGroup = new QGroupBox( tab_3, "samplegroup" ); 565 sampleGroup = new QGroupBox( tab_3, "samplegroup" );
@@ -500,3 +581,3 @@ void QtRec::init() {
500 581
501 Layout17->addWidget( sampleGroup ); 582 glayout3->addMultiCellWidget( sampleGroup, 0, 0, 0, 0);
502 583
@@ -504,3 +585,3 @@ void QtRec::init() {
504 sizeGroup->setTitle( tr( "Limit Size" ) ); 585 sizeGroup->setTitle( tr( "Limit Size" ) );
505 sizeGroup->setFixedSize(80,50); 586 sizeGroup->setFixedSize( 80, 50);
506 587
@@ -509,23 +590,12 @@ void QtRec::init() {
509 sizeLimitCombo->insertItem(tr("Unlimited")); 590 sizeLimitCombo->insertItem(tr("Unlimited"));
591
510 for(int i=1;i<13; i++) { 592 for(int i=1;i<13; i++) {
511 sizeLimitCombo->insertItem( QString::number(i*5)); 593 sizeLimitCombo->insertItem( QString::number( i * 5));
512 } 594 }
513 595
514// sizeLimitCombo->insertItem(tr("5 secs"));
515// sizeLimitCombo->insertItem(tr("10 secs"));
516// sizeLimitCombo->insertItem(tr("15 secs"));
517// sizeLimitCombo->insertItem(tr("20 secs"));
518
519 // Layout18->addWidget( sizeGroup );
520 Layout17->addWidget( sizeGroup );
521
522 Layout18->addLayout( Layout17 );
523
524 Layout16 = new QHBoxLayout(this);
525 Layout16->setSpacing( 2 );
526 Layout16->setMargin( 0 );
527 596
597 glayout3->addMultiCellWidget( sizeGroup, 0, 0, 1, 1);
528 dirGroup = new QGroupBox( tab_3, "dirGroup" ); 598 dirGroup = new QGroupBox( tab_3, "dirGroup" );
529 dirGroup->setTitle( tr( "File Directory" ) ); 599 dirGroup->setTitle( tr( "File Directory" ) );
530 dirGroup->setFixedSize(130,50); 600 dirGroup->setFixedSize( 130, 50);
531 601
@@ -534,3 +604,3 @@ void QtRec::init() {
534 604
535 Layout18->addWidget( dirGroup ); 605 glayout3->addMultiCellWidget( dirGroup, 1, 1, 0, 0);
536 606
@@ -538,3 +608,3 @@ void QtRec::init() {
538 bitGroup->setTitle( tr( "Bit Depth" ) ); 608 bitGroup->setTitle( tr( "Bit Depth" ) );
539 bitGroup->setFixedSize(65,50); 609 bitGroup->setFixedSize( 65, 50);
540 610
@@ -545,17 +615,16 @@ void QtRec::init() {
545 615
546 Layout18->addWidget( bitGroup ); 616 glayout3->addMultiCellWidget( bitGroup, 1, 1, 1, 1);
547 617
548 compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 ); 618 compressionCheckBox = new QCheckBox ( tr("Wave Compression (smaller files)"), tab_3 );
549 Layout18->addWidget( compressionCheckBox );
550 619
551 autoMuteCheckBox= new QCheckBox ( tr("auto Mute"), tab_3 ); 620 autoMuteCheckBox = new QCheckBox ( tr("Auto Mute"), tab_3 );
552 Layout18->addWidget( autoMuteCheckBox ); 621 stereoCheckBox = new QCheckBox ( tr("Stereo Channels"), tab_3 );
553 622
554 Layout19->addLayout( Layout18 ); 623 glayout3->addMultiCellWidget( compressionCheckBox, 2, 2, 0, 3);
624 glayout3->addMultiCellWidget( autoMuteCheckBox, 3, 3, 0, 0);
625 glayout3->addMultiCellWidget( stereoCheckBox, 3, 3, 1, 1);
555 626
556 QWidget *d = QApplication::desktop(); 627 QWidget *d = QApplication::desktop();
557 int width=d->width(); 628 int width = d->width();
558 int height=d->height(); 629 int height = d->height();
559
560
561 630
@@ -570,4 +639,3 @@ void QtRec::init() {
570 639
571 640 Layout15 = new QVBoxLayout( this);
572 Layout15 = new QVBoxLayout(this);
573 Layout15->setSpacing( 2 ); 641 Layout15->setSpacing( 2 );
@@ -575,3 +643,3 @@ void QtRec::init() {
575 643
576 Layout15b = new QVBoxLayout(this); 644 Layout15b = new QVBoxLayout( this);
577 Layout15b->setSpacing( 2 ); 645 Layout15b->setSpacing( 2 );
@@ -581,3 +649,3 @@ void QtRec::init() {
581 TextLabel2->setText( tr( "In")); 649 TextLabel2->setText( tr( "In"));
582 TextLabel2->setFixedWidth(35); 650 TextLabel2->setFixedWidth( 35);
583 Layout15->addWidget( TextLabel2 ); 651 Layout15->addWidget( TextLabel2 );
@@ -589,3 +657,3 @@ void QtRec::init() {
589 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" ); 657 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_5, (const char *) "InputSlider" );
590 InputSlider->setTickmarks(QSlider::Both); 658 InputSlider->setTickmarks( QSlider::Both);
591 Layout15->addWidget( InputSlider); 659 Layout15->addWidget( InputSlider);
@@ -593,3 +661,3 @@ void QtRec::init() {
593 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" ); 661 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_5,(const char *) "OutputSlider" );
594 OutputSlider->setTickmarks(QSlider::Both); 662 OutputSlider->setTickmarks( QSlider::Both);
595 663
@@ -636,3 +704,3 @@ void QtRec::init() {
636 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" ); 704 InputSlider = new QSlider( -100, 0, 10, 0, QSlider::Vertical, tab_3, (const char *) "InputSlider" );
637 // InputSlider->setTickmarks(QSlider::Both); 705 InputSlider->setTickmarks(QSlider::Both);
638 Layout15->addWidget( InputSlider); 706 Layout15->addWidget( InputSlider);
@@ -640,3 +708,3 @@ void QtRec::init() {
640 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" ); 708 OutputSlider = new QSlider( -100,0,10,0, QSlider::Vertical,tab_3,(const char *) "OutputSlider" );
641 // OutputSlider->setTickmarks(QSlider::Both); 709 OutputSlider->setTickmarks(QSlider::Both);
642 710
@@ -661,31 +729,8 @@ void QtRec::init() {
661 729
730 waveform = new Waveform( this, "waveform" );
731// waveform->setSizePolicy( QSizePolicy( (QSizePolicy::SizeType)5, (QSizePolicy::SizeType)3, waveform->sizePolicy().hasHeightForWidth() ) );
732 waveform->setMinimumSize( QSize( 0, 50 ) );
662 733
663 ///**********<<<<<<<<<<<<>>>>>>>>>>>>*************** 734 layout->addMultiCellWidget( waveform, 8, 8, 0, 7 );
664 735 waveform->setBackgroundColor ( black );
665// tab_4 = new QWidget( TabWidget, "tab_4" );
666// QGridLayout *layout4 = new QGridLayout( tab_4);
667// layout4->setSpacing( 2);
668// layout4->setMargin( 2);
669// TabWidget->insertTab( tab_4, tr( "Help"));
670
671// ///////////////////////////////////////////// FIXME change to a real helpfile path
672// QString url="/index.html";
673// HelpWindow *help = new HelpWindow( url, ".", tab_4, "opierec_help");
674// layout4->addMultiCellWidget( help, 0, 1, 0, 1);
675// if( !QFile(url).exists()) {
676// help->hide();
677// //help->showMaximized();
678// QLabel *helpLabel;
679// helpLabel = new QLabel( tab_4, "TimeLabel" );
680// layout4->addMultiCellWidget( helpLabel, 0, 3, 0, 4 );
681// helpLabel->setText( "<B>OpieRec</B><br>"
682// "Records files in standard wav format<br>"
683// "or a compressed version<br>"
684// "For help, please email the author<br>"
685// "<B>OpieRec</B> is copyright&copy; 2002 by"
686// " L.J. Potter<br>llornkcor@handhelds.org<BR>"
687// "and is licensed under the <B>QPL</B>");
688// }
689 ///**********<<<<<<<<<<<<>>>>>>>>>>>>***************
690
691} 736}
@@ -700,4 +745,5 @@ void QtRec::initIconView() {
700 745
701
702 int nFiles = cfg.readNumEntry("NumberofFiles",0); 746 int nFiles = cfg.readNumEntry("NumberofFiles",0);
747 qDebug("init number of files %d", nFiles);
748
703 for(int i=1;i<= nFiles;i++) { 749 for(int i=1;i<= nFiles;i++) {
@@ -707,6 +753,5 @@ void QtRec::initIconView() {
707 753
708 temp.sprintf("%d",i); 754 temp.sprintf( "%d",i);
709 temp=cfg.readEntry(temp,""); //reads currentFile 755 temp = cfg.readEntry( temp,""); //reads currentFile
710 filePath = cfg.readEntry(temp,""); //currentFileName 756 filePath = cfg.readEntry( temp,""); //currentFileName
711 // qDebug(filePath);
712 757
@@ -716,7 +761,7 @@ void QtRec::initIconView() {
716 fileS = cfg.readEntry( filePath, "0" );// file length in seconds 761 fileS = cfg.readEntry( filePath, "0" );// file length in seconds
717 mediaLocation=getStorage( filePath); 762 mediaLocation = getStorage( filePath);
718 if(info.exists()) { 763 if( info.exists()) {
719 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate); 764 item = new QListViewItem( ListView1, temp, fileS, mediaLocation, fileDate);
720 item->setPixmap( 0, image0); 765 item->setPixmap( 0, image0);
721 if(currentFileName == filePath) 766 if( currentFileName == filePath)
722 ListView1->setSelected( item, true); 767 ListView1->setSelected( item, true);
@@ -729,30 +774,55 @@ void QtRec::initConnections() {
729 774
730 connect( toBeginningButton, SIGNAL( pressed()), this, SLOT( rewindPressed() )); 775 connect( toBeginningButton, SIGNAL( pressed()),
731 connect( toBeginningButton, SIGNAL( released()), this, SLOT( rewindReleased() )); 776 this, SLOT( rewindPressed() ));
732 connect( toEndButton, SIGNAL( pressed()), this, SLOT( FastforwardPressed() )); 777 connect( toBeginningButton, SIGNAL( released()),
733 connect( toEndButton, SIGNAL( released()), this, SLOT( FastforwardReleased() )); 778 this, SLOT( rewindReleased() ));
734 connect( deleteSoundButton, SIGNAL(released()), this, SLOT( deleteSound() )); 779 connect( toEndButton, SIGNAL( pressed()),
735 connect( Stop_PushButton, SIGNAL(released()), this, SLOT( doPlayBtn() )); 780 this, SLOT( FastforwardPressed() ));
736 connect( Rec_PushButton, SIGNAL(released()), this, SLOT( newSound() ) ); 781 connect( toEndButton, SIGNAL( released()),
737 connect( TabWidget, SIGNAL( currentChanged( QWidget*)),this, SLOT(thisTab(QWidget*) )); 782 this, SLOT( FastforwardReleased() ));
738 connect( OutputSlider, SIGNAL(sliderReleased()), this, SLOT( changedOutVolume()) ); 783 connect( deleteSoundButton, SIGNAL(released()),
739 connect( InputSlider, SIGNAL(sliderReleased()), this, SLOT( changedInVolume()) ); 784 this, SLOT( deleteSound() ));
740 785 connect( Stop_PushButton, SIGNAL(released()),
741 // connect( OutputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedOutVolume(int)) ); 786 this, SLOT( doPlayBtn() ));
742 // connect( InputSlider, SIGNAL(valueChanged( int)), this, SLOT(changedInVolume(int)) ); 787 connect( Rec_PushButton, SIGNAL(released()),
743 788 this, SLOT( newSound() ) );
744 connect( sampleRateComboBox, SIGNAL(activated( int)), this, SLOT( changesamplerateCombo(int)) ); 789 connect( TabWidget, SIGNAL( currentChanged( QWidget*)),
745 connect( bitRateComboBox, SIGNAL(activated( int)), this, SLOT( changebitrateCombo(int)) ); 790 this, SLOT(thisTab(QWidget*) ));
746 connect( directoryComboBox, SIGNAL(activated( int)), this, SLOT( changeDirCombo(int)) ); 791 connect( OutputSlider, SIGNAL(sliderReleased()),
747 connect( sizeLimitCombo, SIGNAL(activated( int)), this, SLOT( changeSizeLimitCombo(int)) ); 792 this, SLOT( changedOutVolume()) );
748 connect( outMuteCheckBox, SIGNAL(toggled( bool)), this, SLOT( doVolMuting(bool)) ); 793 connect( InputSlider, SIGNAL(sliderReleased()),
749 connect( inMuteCheckBox , SIGNAL(toggled( bool)), this, SLOT( doMicMuting(bool)) ); 794 this, SLOT( changedInVolume()) );
750 connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),this,SLOT( itClick(QListViewItem*))); 795
796 connect( sampleRateComboBox, SIGNAL(activated( int)),
797 this, SLOT( changesamplerateCombo(int)) );
798 connect( bitRateComboBox, SIGNAL(activated( int)),
799 this, SLOT( changebitrateCombo(int)) );
800
801 connect( directoryComboBox, SIGNAL(activated( int)),
802 this, SLOT( changeDirCombo(int)) );
803 connect( sizeLimitCombo, SIGNAL(activated( int)),
804 this, SLOT( changeSizeLimitCombo(int)) );
805
806 connect( stereoCheckBox, SIGNAL(toggled( bool)),
807 this, SLOT( changeStereoCheck(bool)) );
808
809 connect( outMuteCheckBox, SIGNAL(toggled( bool)),
810 this, SLOT( doVolMuting(bool)) );
811 connect( inMuteCheckBox , SIGNAL(toggled( bool)),
812 this, SLOT( doMicMuting(bool)) );
813
814 connect( ListView1,SIGNAL(doubleClicked( QListViewItem*)),
815 this,SLOT( itClick(QListViewItem*)));
751 connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)), 816 connect( ListView1, SIGNAL( mouseButtonPressed( int, QListViewItem *, const QPoint&, int)),
752 this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) ); 817 this,SLOT( listPressed(int, QListViewItem *, const QPoint&, int)) );
753 connect( timeSlider, SIGNAL( sliderMoved( int)), this, SLOT( changeTimeSlider(int) )); 818 connect( timeSlider, SIGNAL( sliderMoved( int)),
754 connect( timeSlider, SIGNAL( sliderPressed( )), this, SLOT( timeSliderPressed() )); 819 this, SLOT( changeTimeSlider(int) ));
755 connect( timeSlider, SIGNAL( sliderReleased( )), this, SLOT( timeSliderReleased() )); 820 connect( timeSlider, SIGNAL( sliderPressed( )),
756 connect( compressionCheckBox, SIGNAL( toggled(bool)),this, SLOT( compressionSelected(bool))); 821 this, SLOT( timeSliderPressed() ));
757 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),this, SLOT( slotAutoMute(bool))); 822 connect( timeSlider, SIGNAL( sliderReleased( )),
823 this, SLOT( timeSliderReleased() ));
824 connect( compressionCheckBox, SIGNAL( toggled(bool)),
825 this, SLOT( compressionSelected(bool)));
826 connect( autoMuteCheckBox, SIGNAL( toggled(bool)),
827 this, SLOT( slotAutoMute(bool)));
758} 828}
@@ -769,3 +839,3 @@ void QtRec::initConfig() {
769 fred = sampleRateComboBox->text(ws).toInt(&ok, 10); 839 fred = sampleRateComboBox->text(ws).toInt(&ok, 10);
770 if(index == fred) { 840 if( index == fred) {
771 filePara.sampleRate = fred; 841 filePara.sampleRate = fred;
@@ -775,3 +845,3 @@ void QtRec::initConfig() {
775 845
776 i=cfg.readNumEntry("bitrate",16); 846 i = cfg.readNumEntry("bitrate",16);
777 if(i == 16) 847 if(i == 16)
@@ -782,11 +852,13 @@ void QtRec::initConfig() {
782 852
783 i=cfg.readNumEntry("sizeLimit", 5 ); 853 i = cfg.readNumEntry("sizeLimit", 5 );
784 QString temp; 854 QString temp;
785// for(int i=1;i<13; i++) {
786// temp = sizeLimitCombo->text(i);
787
788// sizeLimitCombo->insertItem( QString::number(i*5)+tr(" secs"));
789// }
790 sizeLimitCombo->setCurrentItem((i/5)); 855 sizeLimitCombo->setCurrentItem((i/5));
791 856
857 stereoCheckBox->setChecked( cfg.readBoolEntry("stereo", 1));
858 if( stereoCheckBox->isChecked()) {
859 filePara.channels = 2;
860 } else {
861 filePara.channels = 1;
862 }
863
792 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1)); 864 compressionCheckBox->setChecked( cfg.readBoolEntry("wavCompression",1));
@@ -810,9 +882,5 @@ void QtRec::initConfig() {
810 882
811//================
812
813void QtRec::stop() { 883void QtRec::stop() {
814 // qDebug("<<<<<<<<<stop()"); 884 qWarning("STOP");
815 setRecordButton(false); 885 setRecordButton(false);
816 monitoring=false;
817 stopped=true;
818 886
@@ -823,3 +891,2 @@ void QtRec::stop() {
823 timeSlider->setValue(0); 891 timeSlider->setValue(0);
824 // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << true; // mute device
825} 892}
@@ -840,9 +907,9 @@ void QtRec::doPlayBtn() {
840void QtRec::start() { //play 907void QtRec::start() { //play
841 if(stopped) { 908 if( stopped) {
842 QPixmap image3( ( const char** ) image3_data ); 909 QPixmap image3( ( const char** ) image3_data );
843 Stop_PushButton->setPixmap( image3 ); 910 Stop_PushButton->setPixmap( image3 );
844 Stop_PushButton->setDown(true); 911 Stop_PushButton->setDown( true);
845 stopped=false; 912 stopped = false;
846 paused=false; 913 paused = false;
847 secCount=1; 914 secCount = 1;
848 915
@@ -855,11 +922,13 @@ void QtRec::start() { //play
855bool QtRec::rec() { //record 922bool QtRec::rec() { //record
923 QString timeString;
924 timeString.sprintf("%.0f", 0.0);
925 timeLabel->setText( timeString+ " seconds");
856 if(!stopped) { 926 if(!stopped) {
857 monitoring=true; 927 monitoring = true;
858 return false; 928 return false;
859 } else { 929 } else {
860 secCount=1; 930 secCount = 1;
861 playLabel2->setText(tr("Stop")); 931 playLabel2->setText(tr("Stop"));
862 monitoring=false; 932 monitoring = false;
863 setRecordButton(true); 933 setRecordButton( true);
864 stopped=false;
865 934
@@ -867,9 +936,15 @@ bool QtRec::rec() { //record
867 if(setUpFile()) { 936 if(setUpFile()) {
868 int fileSize=0; 937 int fileSize = 0;
869 Config cfg("OpieRec"); 938 Config cfg("OpieRec");
870 cfg.setGroup("Settings"); 939 cfg.setGroup("Settings");
940// qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d",
941// soundDevice->getDeviceBits(),
942// soundDevice->getDeviceRate(),
943// soundDevice->getDeviceChannels());
944
871 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); 945 //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050);
872 // qDebug("sample rate is %d", filePara.sampleRate); 946// qDebug("sample rate is %d", filePara.sampleRate);
873 filePara.SecondsToRecord = getCurrentSizeLimit(); 947 filePara.SecondsToRecord = getCurrentSizeLimit();
874 948
949// qDebug("size limit %d sec", filePara.SecondsToRecord);
875 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); 950 int diskSize = checkDiskSpace( (const QString &) wavFile->trackName());
@@ -878,8 +953,10 @@ bool QtRec::rec() { //record
878 fileSize = diskSize; 953 fileSize = diskSize;
879 } else if( filePara.format==WAVE_FORMAT_PCM) { 954 } else if( filePara.format == WAVE_FORMAT_PCM) {
955// qDebug("WAVE_FORMAT_PCM");
880 fileSize = (filePara.SecondsToRecord ) * filePara.channels 956 fileSize = (filePara.SecondsToRecord ) * filePara.channels
881 * filePara.sampleRate *(filePara.resolution/8)+1000; 957 * filePara.sampleRate * ( filePara.resolution / 8) + 1000;
882 } else { 958 } else {
959// qDebug("WAVE_FORMAT_DVI_ADPCM");
883 fileSize = ((filePara.SecondsToRecord) * filePara.channels 960 fileSize = ((filePara.SecondsToRecord) * filePara.channels
884 * filePara.sampleRate *(filePara.resolution/8) )/4+250; 961 * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250;
885 } 962 }
@@ -887,6 +964,12 @@ bool QtRec::rec() { //record
887 filePara.samplesToRecord = fileSize; 964 filePara.samplesToRecord = fileSize;
888 if(paused) { 965 qDebug("filesize should be %d, bits %d, rate %d",
966 filePara.samplesToRecord, filePara.resolution, filePara.sampleRate);
967 if( paused) {
889 paused = false; 968 paused = false;
890 } 969 }
970 // else {
971 qDebug("Setting timeslider %d", filePara.samplesToRecord);
972 // if(fileSize != 0)
891 timeSlider->setRange(0, filePara.samplesToRecord); 973 timeSlider->setRange(0, filePara.samplesToRecord);
974 // }
892 975
@@ -906,9 +989,12 @@ bool QtRec::rec() { //record
906 filePara.fileName=currentFile.latin1(); 989 filePara.fileName=currentFile.latin1();
990// qDebug("Start recording thread");
991 stopped = false;
907 992
908 pthread_t thread1; 993 pthread_t thread1;
909 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/); 994 pthread_create( &thread1, NULL, (void * (*)(void *))quickRec, NULL/* &*/);
910 toBeginningButton->setEnabled(false); 995 toBeginningButton->setEnabled( false);
911 toEndButton->setEnabled(false); 996 toEndButton->setEnabled( false);
912 997
913 startTimer(1000); 998 startTimer(1000);
999// quickRec();
914 } 1000 }
@@ -916,21 +1002,2 @@ bool QtRec::rec() { //record
916 } //end setupAudio 1002 } //end setupAudio
917 // _exit( 0);
918
919 // ///* default:
920// // /* pid greater than zero is parent getting the child's pid */
921// /* printf("Child's pid is %d\n",pid);
922// waitpid( pid, &status, 0);
923// printf("Child[%d] exited with status %d\n", pid, status);*/
924 // while (wait(NULL) != pid)
925// ;
926// printf("child %ld terminated normally, return status is zero\n", (long) pid);
927 // endRecording();
928/* else { //device was not opened
929 qDebug("Audio device open failed");
930 return false;
931 }
932 }*/
933// } //end fork
934// }
935// }
936 return true; 1003 return true;
@@ -941,8 +1008,8 @@ void QtRec::thisTab(QWidget* widg) {
941 if(widg != NULL) { 1008 if(widg != NULL) {
942 int index=TabWidget->currentPageIndex(); 1009 int index = TabWidget->currentPageIndex();
943 1010
944// if(index==0) { //file page 1011 if(index == 0) { //file page
945// } 1012 }
946 1013
947 if(index ==1) { //control page 1014 if(index == 1) { //control page
948 fillDirectoryCombo(); 1015 fillDirectoryCombo();
@@ -952,4 +1019,5 @@ void QtRec::thisTab(QWidget* widg) {
952 1019
953// if(index==2) { //help page 1020 if( index==2) { //help page
954// } 1021 }
1022
955 qApp->processEvents(); 1023 qApp->processEvents();
@@ -961,2 +1029,3 @@ void QtRec::getOutVol( ) {
961 filePara.outVol = soundDevice->getOutVolume(); 1029 filePara.outVol = soundDevice->getOutVolume();
1030// qDebug("out vol %d", filePara.outVol);
962 OutputSlider->setValue( -filePara.outVol); 1031 OutputSlider->setValue( -filePara.outVol);
@@ -966,2 +1035,3 @@ void QtRec::getInVol() {
966 filePara.inVol = soundDevice->getInVolume(); 1035 filePara.inVol = soundDevice->getInVolume();
1036// qDebug("in vol %d", filePara.inVol);
967 InputSlider->setValue( -filePara.inVol); 1037 InputSlider->setValue( -filePara.inVol);
@@ -970,3 +1040,3 @@ void QtRec::getInVol() {
970void QtRec::changedOutVolume() { 1040void QtRec::changedOutVolume() {
971 soundDevice->changedOutVolume(-OutputSlider->value()); 1041 soundDevice->changedOutVolume( -OutputSlider->value());
972} 1042}
@@ -985,3 +1055,4 @@ bool QtRec::setupAudio( bool b) {
985 1055
986 if( !b){ // we want to play 1056 if( !b) {
1057// we want to play
987 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) { 1058 if( filePara.resolution == 16 || compressionCheckBox->isChecked() ) {
@@ -991,9 +1062,10 @@ bool QtRec::setupAudio( bool b) {
991 sampleformat = AFMT_U8; 1062 sampleformat = AFMT_U8;
992 filePara.resolution=8; 1063 filePara.resolution = 8;
993 } 1064 }
994 1065
995 stereo = filePara.channels = 1; 1066 stereo = filePara.channels;
996 flags= O_WRONLY; 1067 flags = O_WRONLY;
997 dspString = DSPSTROUT; 1068 dspString = DSPSTROUT;
998 mixerString = DSPSTRMIXEROUT; 1069 mixerString = DSPSTRMIXEROUT;
1070 recording = false;
999 } else { // we want to record 1071 } else { // we want to record
@@ -1006,12 +1078,17 @@ bool QtRec::setupAudio( bool b) {
1006 if( !compressionCheckBox->isChecked()) { 1078 if( !compressionCheckBox->isChecked()) {
1007 filePara.format=WAVE_FORMAT_PCM; 1079 filePara.format = WAVE_FORMAT_PCM;
1080// qDebug("WAVE_FORMAT_PCM");
1008 } else { 1081 } else {
1009 filePara.format=WAVE_FORMAT_DVI_ADPCM; 1082 filePara.format = WAVE_FORMAT_DVI_ADPCM;
1010 sampleformat=AFMT_S16_LE; 1083 sampleformat = AFMT_S16_LE;
1084// qDebug("WAVE_FORMAT_DVI_ADPCM");
1011 } 1085 }
1012 1086
1013 stereo = filePara.channels = 1; 1087 stereo = filePara.channels;
1088// filePara.sampleRate = sampleRateComboBox->currentText().toInt( &ok,10);//44100;
1014 flags= O_RDWR; 1089 flags= O_RDWR;
1090// flags= O_RDONLY;
1015 dspString = DSPSTRIN; 1091 dspString = DSPSTRIN;
1016 mixerString = DSPSTRMIXEROUT; 1092 mixerString = DSPSTRMIXEROUT;
1093 recording = true;
1017 } 1094 }
@@ -1019,2 +1096,6 @@ bool QtRec::setupAudio( bool b) {
1019 // if(soundDevice) delete soundDevice; 1096 // if(soundDevice) delete soundDevice;
1097 qDebug("<<<<<<<<<<<<<<<<<<<open dsp %d %d %d", filePara.sampleRate, filePara.channels, sampleformat);
1098 qWarning("change waveform settings");
1099 waveform->changeSettings( filePara.sampleRate, filePara.channels );
1100
1020 soundDevice = new Device( this, dspString, mixerString, b); 1101 soundDevice = new Device( this, dspString, mixerString, b);
@@ -1023,2 +1104,5 @@ bool QtRec::setupAudio( bool b) {
1023 1104
1105 qDebug("device has been made %d", soundDevice->sd);
1106
1107 ////////////////// <<<<<<<<<<<<>>>>>>>>>>>>
1024 soundDevice->setDeviceFormat( sampleformat); 1108 soundDevice->setDeviceFormat( sampleformat);
@@ -1032,3 +1116,3 @@ bool QtRec::setupAudio( bool b) {
1032#endif 1116#endif
1033 1117 /////////////////
1034 filePara.sd = soundDevice->sd; 1118 filePara.sd = soundDevice->sd;
@@ -1036,7 +1120,7 @@ bool QtRec::setupAudio( bool b) {
1036 if ( filePara.sd == -1) { 1120 if ( filePara.sd == -1) {
1037 monitoring=false; 1121
1038 stopped=true; 1122 monitoring = false;
1123 stopped = true;
1039 update(); 1124 update();
1040 setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); 1125 setCaption( tr( "OpieRecord " )+ QString::number(VERSION) );
1041 stopped=true;
1042 return false; 1126 return false;
@@ -1051,3 +1135,3 @@ bool QtRec::setupAudio( bool b) {
1051bool QtRec::setUpFile() { //setup file for recording 1135bool QtRec::setUpFile() { //setup file for recording
1052 // qDebug("Setting up wavfile"); 1136// qDebug("Setting up wavfile");
1053// if(wavFile) delete wavFile; 1137// if(wavFile) delete wavFile;
@@ -1064,3 +1148,3 @@ bool QtRec::setUpFile() { //setup file for recording
1064 } else { 1148 } else {
1065 filePara.channels=1; 1149// filePara.channels=1;
1066 } 1150 }
@@ -1072,13 +1156,4 @@ bool QtRec::doPlay() {
1072 1156
1073// pthread_t thread2;
1074// pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/);
1075
1076 // qDebug("doPlay file %d", filePara.fd);
1077 int bytesWritten, number;
1078 recording = false;
1079// int number=0;
1080 if( !paused) { 1157 if( !paused) {
1081 // qDebug("new"); 1158 total = 0;
1082 total=0;
1083 bytesWritten=0;
1084 filePara.numberOfRecordedSeconds = 0; 1159 filePara.numberOfRecordedSeconds = 0;
@@ -1088,18 +1163,19 @@ bool QtRec::doPlay() {
1088 } 1163 }
1089 playing=true; 1164 playing = true;
1090 number=0; 1165 stopped = false;
1166 recording = false;
1091 1167
1092 QString num; 1168 QString num;
1093// block=BUFSIZE; 1169 qDebug( "Play number of samples %d", filePara.numberSamples);
1094 timeSlider->setRange(0, filePara.numberSamples); 1170
1095 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds); 1171// timeSlider->setRange( 0, filePara.numberSamples);
1172
1173 timeString.sprintf("%d", filePara.numberOfRecordedSeconds);
1096 timeLabel->setText( timeString+ tr(" seconds")); 1174 timeLabel->setText( timeString+ tr(" seconds"));
1097 1175
1098// if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
1099// // qDebug("WAVE_FORMAT_DVI_ADPCM");
1100// } else {
1101// // qDebug("WAVE_FORMAT_PCM");
1102// }
1103 QString msg; 1176 QString msg;
1104 msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); 1177 msg.sprintf("%d, %d, %d",
1178 filePara.sampleRate,
1179 filePara.channels,
1180 filePara.resolution);
1105#ifdef DEV_VERSION 1181#ifdef DEV_VERSION
@@ -1107,124 +1183,10 @@ bool QtRec::doPlay() {
1107#endif 1183#endif
1108 if( filePara.resolution == 16 ) { //AFMT_S16_LE) {
1109 // qDebug("16 bit");
1110
1111 startTimer(1000);
1112
1113 if( filePara.format==WAVE_FORMAT_DVI_ADPCM) {
1114 char abuf[BUFSIZE/2];
1115 short sbuf[BUFSIZE];
1116 short sbuf2[BUFSIZE*2];
1117 memset( abuf, 0, BUFSIZE / 2);
1118 memset( sbuf, 0, BUFSIZE);
1119 memset( sbuf2, 0, BUFSIZE * 2);
1120// <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>>
1121 for(;;) { // play loop
1122 if (stopped)
1123 break; // stop if playing was set to false
1124
1125
1126 number=::read( filePara.fd, abuf, BUFSIZE/2);
1127 adpcm_decoder( abuf, sbuf, number*2, &decoder_state);
1128
1129// for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel
1130// sbuf2[i+1]=sbuf2[i]=sbuf[i];
1131// }
1132
1133 bytesWritten = write ( filePara.sd, sbuf, number*4);
1134 // if(filePara.channels==1)
1135 // total += bytesWritten/2; //mono
1136 // else
1137 total += bytesWritten;
1138 timeSlider->setValue( total / 4);
1139
1140 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / 2;
1141
1142 timeString.sprintf("%.2f", filePara.numberOfRecordedSeconds);
1143// if(filePara.numberOfRecordedSeconds>1)
1144 timeLabel->setText( timeString+ tr(" seconds"));
1145// printf("playing number %d, bytes %d, total %d\n",number, bytesWritten, total/4);
1146// printf("playing number %d, bytes %d, total %d totalsamples %d number recorded seconds %.2f\r",
1147// number, bytesWritten, total/4, filePara.numberSamples, filePara.numberOfRecordedSeconds);
1148// fflush(stdout);
1149
1150 qApp->processEvents();
1151
1152 if( bytesWritten <= 0 ){//|| secCount > filePara.numberOfRecordedSeconds ) {
1153 stopped = true;
1154 endPlaying();
1155 }
1156 }
1157 } else {
1158 // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_PCM >>>>>>>>>>>>>>>>>>>>>>
1159 short inbuffer[BUFSIZE], outbuffer[BUFSIZE];
1160 memset( inbuffer, 0, BUFSIZE);
1161 memset( outbuffer, 0, BUFSIZE);
1162
1163 for(;;) { // play loop
1164 if (stopped)
1165 break; // stop if playing was set to false
1166 number=::read( filePara.fd, inbuffer, BUFSIZE);
1167// for (int i=0;i< number * 2; 2 * i++) { //2*i is left channel
1168// // for (int i=0;i< number ; i++) { //2*i is left channel
1169// outbuffer[i+1]= outbuffer[i]=inbuffer[i];
1170// }
1171
1172 bytesWritten = ::write( filePara.sd, inbuffer, number);
1173 //-------------->>>> out to device
1174 // total+=bytesWritten;
1175 // if(filePara.channels==1)
1176 // total += bytesWritten/2; //mono
1177 // else
1178 total += bytesWritten;
1179
1180 timeSlider->setValue( total);
1181 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate / (float)2;
1182
1183 timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
1184 timeLabel->setText( timeString + tr(" seconds"));
1185
1186 qApp->processEvents();
1187 1184
1188 if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) { 1185 startTimer( 1000);
1189 stopped = true; 1186 pthread_t thread2;
1190 endPlaying(); 1187 pthread_create( &thread2, NULL, (void * (*)(void *))playIt, NULL/* &*/);
1191 }
1192 }
1193// printf("\nplaying number %d, bytes %d, total %d\r",number, bytesWritten, total);
1194// fflush(stdout);
1195 } //end loop
1196 } else { /////////////////////////////// format = AFMT_U8;
1197 unsigned char unsigned_inbuffer[BUFSIZE];//, unsigned_outbuffer[BUFSIZE];
1198 memset( unsigned_inbuffer,0,BUFSIZE);
1199 for(;;) { // main loop
1200 if (stopped)
1201 break; // stop if playing was set to false
1202 number=::read( filePara.fd, unsigned_inbuffer, BUFSIZE);
1203//data = (val >> 8) ^ 0x80;
1204 // unsigned_outbuffer = (unsigned_inbuffer >> 8) ^ 0x80;
1205 bytesWritten = write ( filePara.sd, unsigned_inbuffer, number);
1206 total+=bytesWritten;
1207 1188
1208 timeSlider->setValue( total); 1189 toBeginningButton->setEnabled( false);
1190 toEndButton->setEnabled( false);
1209 1191
1210 filePara.numberOfRecordedSeconds=(float)total/(float)filePara.sampleRate;
1211 timeString.sprintf("%.2f",filePara.numberOfRecordedSeconds);
1212 timeLabel->setText( timeString + tr(" seconds"));
1213 qApp->processEvents();
1214
1215 if( bytesWritten <= 0 && secCount > filePara.numberOfRecordedSeconds ) {
1216 stopped = true;
1217 endPlaying();
1218 }
1219 // printf("Writing number %d, bytes %d, total %d, numberSamples %d\r",number, bytesWritten , total, filePara.numberSamples);
1220 // fflush(stdout);
1221 }
1222 }
1223
1224// qDebug("\nstopped or paused %d", total/4);
1225 if(!paused && !stopped) {
1226 stopped = true;
1227// endPlaying();
1228 endPlaying();
1229 }
1230 return true; 1192 return true;
@@ -1236,7 +1198,7 @@ void QtRec::changebitrateCombo(int i) {
1236 cfg.setGroup("Settings"); 1198 cfg.setGroup("Settings");
1237 int bits=0; 1199 int bits = 0;
1238 if(i==0) { bits=16; } 1200 if( i == 0) { bits = 16; }
1239 else { bits=8; } 1201 else { bits=8; }
1240 cfg.writeEntry("bitrate", bits); 1202 cfg.writeEntry("bitrate", bits);
1241 filePara.resolution=bits; 1203 filePara.resolution = bits;
1242 cfg.write(); 1204 cfg.write();
@@ -1250,17 +1212,6 @@ void QtRec::changesamplerateCombo(int i) {
1250 rate = sampleRateComboBox->text(i).toInt(&ok, 10); 1212 rate = sampleRateComboBox->text(i).toInt(&ok, 10);
1251 cfg.writeEntry("samplerate",rate); 1213 cfg.writeEntry( "samplerate",rate);
1252 filePara.sampleRate=rate; 1214 filePara.sampleRate=rate;
1253/* soundDevice = new Device( this, DSPSTROUT, DSPSTRMIXER, false); 1215 qDebug( "Change sample rate %d", rate);
1254 soundDevice->openDsp();*/
1255//
1256// soundDevice->setDeviceFormat(AFMT_S16_LE);
1257// soundDevice->setDeviceChannels(filePara.channels);
1258// soundDevice->setDeviceRate(filePara.sampleRate);
1259//
1260// soundDevice->closeDevice( true);
1261// soundDevice=0;
1262// delete soundDevice;
1263 // qDebug("Change sample rate %d", rate);
1264 cfg.write(); 1216 cfg.write();
1265
1266} 1217}
@@ -1281,5 +1232,5 @@ void QtRec::changeDirCombo(int index) {
1281 const QString path = (*it)->path(); 1232 const QString path = (*it)->path();
1282 recDir = path; 1233 recDir = path;
1283 cfg.writeEntry("directory", recDir); 1234 cfg.writeEntry("directory", recDir);
1284 // qDebug("new rec dir "+recDir); 1235 qDebug("new rec dir "+recDir);
1285 } 1236 }
@@ -1298,6 +1249,3 @@ void QtRec::changeSizeLimitCombo(int) {
1298void QtRec::newSound() { 1249void QtRec::newSound() {
1299 // qDebug("<<<<<<<<<new sound");
1300
1301 if( !rec()) { 1250 if( !rec()) {
1302 // qDebug("rec() failed");
1303 endRecording(); 1251 endRecording();
@@ -1305,3 +1253,2 @@ void QtRec::newSound() {
1305 } 1253 }
1306
1307} 1254}
@@ -1309,3 +1256,3 @@ void QtRec::newSound() {
1309void QtRec::itClick(QListViewItem *item) { 1256void QtRec::itClick(QListViewItem *item) {
1310 currentFile=item->text(0); 1257 currentFile = item->text(0);
1311 setCaption("OpieRecord "+currentFile); 1258 setCaption("OpieRecord "+currentFile);
@@ -1316,3 +1263,3 @@ void QtRec::deleteSound() {
1316 cfg.setGroup("Sounds"); 1263 cfg.setGroup("Sounds");
1317 if( ListView1->currentItem() == NULL) 1264 if( ListView1->currentItem() == NULL)
1318 return; 1265 return;
@@ -1326,15 +1273,12 @@ void QtRec::deleteSound() {
1326 QString file = ListView1->currentItem()->text(0); 1273 QString file = ListView1->currentItem()->text(0);
1327 // qDebug("Filename to find is "+file);
1328 QString fileName; 1274 QString fileName;
1329 fileName = cfg.readEntry( file, ""); 1275 fileName = cfg.readEntry( file, "");
1330 QFile f(fileName); 1276 QFile f( fileName);
1331 // qDebug("fileName is "+fileName); 1277 if( f.exists())
1332 if(f.exists())
1333 if( !f.remove()) 1278 if( !f.remove())
1334 QMessageBox::message(tr("Error"),tr("Could not remove file.")); 1279 QMessageBox::message( tr("Error"), tr("Could not remove file."));
1335 1280
1336 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1281 int nFiles = cfg.readNumEntry( "NumberofFiles",0);
1337 bool found=false; 1282 bool found = false;
1338 for(int i=0;i<nFiles+1;i++) { 1283 for(int i=0;i<nFiles+1;i++) {
1339 // qDebug(cfg.readEntry(QString::number(i)));
1340 1284
@@ -1342,3 +1286,2 @@ void QtRec::deleteSound() {
1342 found = true; 1286 found = true;
1343// qDebug( cfg.readEntry(QString::number(i))+"\n" +cfg.readEntry(QString::number(i+1)) );
1344 cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),"")); 1287 cfg.writeEntry( QString::number(i), cfg.readEntry( QString::number(i+1),""));
@@ -1349,6 +1292,5 @@ void QtRec::deleteSound() {
1349 1292
1350 cfg.removeEntry(cfg.readEntry(file)); 1293 cfg.removeEntry( cfg.readEntry( file));
1351 cfg.removeEntry( file); 1294 cfg.removeEntry( file);
1352 // cfg.removeEntry( QString::number(nFiles)); 1295 cfg.writeEntry( "NumberofFiles", nFiles-1);
1353 cfg.writeEntry("NumberofFiles", nFiles-1);
1354 cfg.write(); 1296 cfg.write();
@@ -1356,3 +1298,2 @@ void QtRec::deleteSound() {
1356 ListView1->takeItem( ListView1->currentItem() ); 1298 ListView1->takeItem( ListView1->currentItem() );
1357 // ListView1->takeItem( ListView1->itemAt(nFiles) );
1358 delete ListView1->currentItem(); 1299 delete ListView1->currentItem();
@@ -1360,3 +1301,3 @@ void QtRec::deleteSound() {
1360 ListView1->clear(); 1301 ListView1->clear();
1361 ListView1->setSelected(ListView1->firstChild(), true); 1302 ListView1->setSelected( ListView1->firstChild(), true);
1362 initIconView(); 1303 initIconView();
@@ -1367,3 +1308,3 @@ void QtRec::deleteSound() {
1367#endif 1308#endif
1368 setCaption( tr( "OpieRecord " ) /*+ QString::number(VERSION)*/ ); 1309 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
1369 1310
@@ -1374,21 +1315,2 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
1374 switch ( e->key() ) { 1315 switch ( e->key() ) {
1375 /*
1376 vercel keys->
1377 right side
1378 0
1379 1 0x1030 Key_F1
1380 2 0x1031 Key_F2
1381 3 0x1032 Key_F3
1382 4 0x1016 Key_PageUp
1383 5 0x1017 Key_PageDown
1384 6
1385 ---------------
1386 left side
1387 Up 0x1013 Key_Up
1388 Down 0x1015 Key_Down
1389 Left 0x1012 Key_Left
1390 Right 0x1014 Key_Right
1391 0x1010 Key_Home
1392
1393 */
1394 // case Key_F1: 1316 // case Key_F1:
@@ -1432,3 +1354,3 @@ void QtRec::keyPressEvent( QKeyEvent *e) {
1432 case Key_Left: { 1354 case Key_Left: {
1433 // qDebug("rewinding"); 1355 qDebug("rewinding");
1434 if( !e->isAutoRepeat()) 1356 if( !e->isAutoRepeat())
@@ -1486,3 +1408,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1486 // stop(); 1408 // stop();
1487 // qDebug("Up"); 1409 qDebug("Up");
1488 break; 1410 break;
@@ -1494,3 +1416,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1494 case Key_Left: 1416 case Key_Left:
1495 // qDebug("Left"); 1417 qDebug("Left");
1496 rewindReleased(); 1418 rewindReleased();
@@ -1498,3 +1420,3 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1498 case Key_Right: 1420 case Key_Right:
1499 // qDebug("Right"); 1421 qDebug("Right");
1500 FastforwardReleased(); 1422 FastforwardReleased();
@@ -1505,9 +1427,10 @@ void QtRec::keyReleaseEvent( QKeyEvent *e) {
1505void QtRec::endRecording() { 1427void QtRec::endRecording() {
1506 // qDebug("endRecording"); 1428 monitoring = false;
1507 setRecordButton(false); 1429 recording = false;
1508 timeSlider->setValue(0); 1430 stopped = true;
1509 toBeginningButton->setEnabled(true); 1431 waveform->reset();
1510 toEndButton->setEnabled(true); 1432 setRecordButton( false);
1511 1433
1512 monitoring=false; 1434 toBeginningButton->setEnabled( true);
1435 toEndButton->setEnabled( true);
1513 1436
@@ -1516,3 +1439,3 @@ void QtRec::endRecording() {
1516 if(autoMute) 1439 if(autoMute)
1517 doMute(true); 1440 doMute( true);
1518 1441
@@ -1520,6 +1443,2 @@ void QtRec::endRecording() {
1520 1443
1521 recording = false;
1522 stopped=true;
1523 t->stop();
1524
1525 if( wavFile->track.isOpen()) { 1444 if( wavFile->track.isOpen()) {
@@ -1527,3 +1446,3 @@ void QtRec::endRecording() {
1527 // soundDevice->sd=-1; 1446 // soundDevice->sd=-1;
1528 filePara.numberSamples=0; 1447 filePara.numberSamples = 0;
1529 // filePara.sd=-1; 1448 // filePara.sd=-1;
@@ -1532,3 +1451,3 @@ void QtRec::endRecording() {
1532 1451
1533 if(wavFile->isTempFile()) { 1452 if( wavFile->isTempFile()) {
1534// move tmp file to regular file 1453// move tmp file to regular file
@@ -1536,7 +1455,7 @@ void QtRec::endRecording() {
1536 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName); 1455 cmd.sprintf("mv "+ wavFile->trackName() + " " + wavFile->currentFileName);
1537 // qDebug("moving tmp file to "+currentFileName); 1456// qDebug("moving tmp file to "+currentFileName);
1538 system(cmd.latin1()); 1457 system( cmd.latin1());
1539 } 1458 }
1540 1459
1541 // qDebug("Just moved "+wavFile->currentFileName); 1460 qDebug("Just moved " + wavFile->currentFileName);
1542 Config cfg("OpieRec"); 1461 Config cfg("OpieRec");
@@ -1546,7 +1465,7 @@ void QtRec::endRecording() {
1546 1465
1547 currentFile = QFileInfo(wavFile->currentFileName).fileName(); 1466 currentFile = QFileInfo( wavFile->currentFileName).fileName();
1548 currentFile=currentFile.left(currentFile.length()-4); 1467 currentFile = currentFile.left( currentFile.length() - 4);
1549 1468
1550 cfg.writeEntry( "NumberofFiles",nFiles+1); 1469 cfg.writeEntry( "NumberofFiles", nFiles + 1);
1551 cfg.writeEntry( QString::number( nFiles+1), currentFile); 1470 cfg.writeEntry( QString::number( nFiles + 1), currentFile);
1552 cfg.writeEntry( currentFile, wavFile->currentFileName); 1471 cfg.writeEntry( currentFile, wavFile->currentFileName);
@@ -1556,6 +1475,6 @@ void QtRec::endRecording() {
1556 cfg.writeEntry( wavFile->currentFileName, time ); 1475 cfg.writeEntry( wavFile->currentFileName, time );
1557 // qDebug("writing config numberOfRecordedSeconds "+time); 1476// qDebug("writing config numberOfRecordedSeconds "+time);
1558 1477
1559 cfg.write(); 1478 cfg.write();
1560 // qDebug("finished recording"); 1479 qDebug("finished recording");
1561 timeLabel->setText(""); 1480 timeLabel->setText("");
@@ -1565,4 +1484,5 @@ void QtRec::endRecording() {
1565 1484
1485 timeSlider->setValue(0);
1566 initIconView(); 1486 initIconView();
1567 selectItemByName(currentFile); 1487 selectItemByName( currentFile);
1568} 1488}
@@ -1570,29 +1490,32 @@ void QtRec::endRecording() {
1570void QtRec::endPlaying() { 1490void QtRec::endPlaying() {
1491 monitoring = false;
1492 recording = false;
1493 playing = false;
1494 stopped = true;
1495 waveform->reset();
1496// errorStop();
1497// qDebug("end playing");
1498 setRecordButton( false);
1571 1499
1572 // qDebug("end playing"); 1500 toBeginningButton->setEnabled( true);
1573 setRecordButton(false); 1501 toEndButton->setEnabled( true);
1574
1575 toBeginningButton->setEnabled(true);
1576 toEndButton->setEnabled(true);
1577 1502
1578 if(autoMute) 1503 if(autoMute)
1579 doMute(true); 1504 doMute( true);
1580 1505
1581 soundDevice->closeDevice( false); 1506 soundDevice->closeDevice( false);
1582 soundDevice->sd=-1; 1507 soundDevice->sd = -1;
1583 // if(soundDevice) delete soundDevice; 1508 // if(soundDevice) delete soundDevice;
1584 // qDebug("file and sound device closed"); 1509// qDebug("file and sound device closed");
1585 stopped=true;
1586 recording=false;
1587 playing=false;
1588 timeLabel->setText(""); 1510 timeLabel->setText("");
1589 monitoring=false;
1590 total = 0; 1511 total = 0;
1591 filePara.numberSamples=0; 1512 filePara.numberSamples = 0;
1592 filePara.sd=-1; 1513 filePara.sd = -1;
1593 wavFile->closeFile(); 1514// wavFile->closeFile();
1594 filePara.fd=0; 1515 filePara.fd = 0;
1595// if(wavFile) delete wavFile; //this crashes 1516// if(wavFile) delete wavFile; //this crashes
1596 1517
1597 // qDebug("track closed"); 1518// qDebug("track closed");
1519 killTimers();
1520 qWarning("reset slider");
1598 timeSlider->setValue(0); 1521 timeSlider->setValue(0);
@@ -1614,7 +1537,7 @@ bool QtRec::openPlayFile() {
1614 cfg.setGroup("Sounds"); 1537 cfg.setGroup("Sounds");
1615 int nFiles = cfg.readNumEntry("NumberofFiles",0); 1538 int nFiles = cfg.readNumEntry( "NumberofFiles", 0);
1616 for(int i=0;i<nFiles+1;i++) { //look for file 1539 for(int i=0;i<nFiles+1;i++) { //look for file
1617 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) { 1540 if( cfg.readEntry( QString::number(i),"").find( currentFile,0,true) != -1) {
1618 currentFileName=cfg.readEntry( currentFile, "" ); 1541 currentFileName = cfg.readEntry( currentFile, "" );
1619 // qDebug("opening for play: "+currentFileName); 1542 qDebug("opening for play: " + currentFileName);
1620 } 1543 }
@@ -1627,18 +1550,24 @@ bool QtRec::openPlayFile() {
1627 // if(!track.open(IO_ReadOnly)) { 1550 // if(!track.open(IO_ReadOnly)) {
1628 QString errorMsg=(QString)strerror(errno); 1551 QString errorMsg = (QString)strerror(errno);
1629 monitoring=false; 1552 monitoring = false;
1630 setCaption( tr( "OpieRecord " )/* + QString::number(VERSION)*/ ); 1553 setCaption( tr( "OpieRecord " ) + QString::number(VERSION) );
1631 QMessageBox::message(tr("Note"),tr("Could not open audio file.\n") 1554 QMessageBox::message(tr("Note"), tr("Could not open audio file.\n")
1632 +errorMsg+"\n"+currentFile); 1555 + errorMsg + "\n" + currentFile);
1633 return false; 1556 return false;
1634 } else { 1557 } else {
1635 filePara.numberSamples=wavFile->getNumberSamples(); 1558
1559 filePara.numberSamples = wavFile->getNumberSamples();
1636 filePara.format = wavFile->getFormat(); 1560 filePara.format = wavFile->getFormat();
1637 // qDebug("file %d, samples %f", filePara.fd, filePara.numberSamples); 1561 filePara.sampleRate = wavFile->getSampleRate();
1638 filePara.sampleRate= wavFile->getSampleRate(); 1562 filePara.resolution = wavFile->getResolution();
1639 filePara.resolution=wavFile->getResolution(); 1563 filePara.channels = wavFile->getChannels();
1640 timeSlider->setPageStep(1); 1564 timeSlider->setPageStep(1);
1641 monitoring=true; 1565 monitoring = true;
1566
1567 qDebug("file %d, samples %d %d", filePara.fd, filePara.numberSamples, filePara.sampleRate);
1568 int sec = (int) (( filePara.numberSamples / filePara.sampleRate) / filePara.channels) / ( filePara.channels*( filePara.resolution/8));
1569
1570 qWarning("seconds %d", sec);
1571
1642 timeSlider->setRange(0, filePara.numberSamples ); 1572 timeSlider->setRange(0, filePara.numberSamples );
1643 filePara.numberOfRecordedSeconds=(float) filePara.numberSamples / (float)filePara.sampleRate * (float)2;
1644 } 1573 }
@@ -1653,7 +1582,7 @@ void QtRec::listPressed( int mouse, QListViewItem *item, const QPoint &, int ) {
1653 case 1: { 1582 case 1: {
1654 if( renameBox !=0 ) //tricky 1583 if( renameBox != 0 ) //tricky
1655 cancelRename(); 1584 cancelRename();
1656 1585
1657 currentFile=item->text(0); 1586 currentFile = item->text(0);
1658 setCaption( "OpieRecord "+currentFile); 1587 setCaption( "OpieRecord " + currentFile);
1659 } 1588 }
@@ -1702,7 +1631,8 @@ void QtRec::doBeam() {
1702 for(int i=0;i<nFiles+1;i++) { 1631 for(int i=0;i<nFiles+1;i++) {
1703 if( cfg.readEntry( QString::number(i),"").find(file,0,true) != -1) { 1632 if( cfg.readEntry( QString::number( i),"").find( file, 0, true) != -1) {
1704 QString filePath = cfg.readEntry(file,""); 1633 QString filePath = cfg.readEntry(file,"");
1705 Ir *file = new Ir(this, "IR"); 1634 Ir *file = new Ir(this, "IR");
1706 connect(file, SIGNAL(done(Ir*)), this, SLOT( fileBeamFinished( Ir * ))); 1635 connect( file, SIGNAL( done(Ir*)),
1707 file->send( filePath, "OPieRec audio file\n"+filePath ); 1636 this, SLOT( fileBeamFinished( Ir * )));
1637 file->send( filePath, "OPieRec audio file\n" + filePath );
1708 } 1638 }
@@ -1740,4 +1670,3 @@ void QtRec::doRename() {
1740void QtRec::okRename() { 1670void QtRec::okRename() {
1741 // qDebug("okRename"); 1671 qDebug(renameBox->text());
1742 // qDebug(renameBox->text());
1743 QString filename = renameBox->text(); 1672 QString filename = renameBox->text();
@@ -1753,3 +1682,3 @@ void QtRec::okRename() {
1753 1682
1754 // qDebug("filename is " + filename); 1683 qDebug("filename is " + filename);
1755 1684
@@ -1764,3 +1693,3 @@ void QtRec::okRename() {
1764 cfg.writeEntry( filename, filePath ); 1693 cfg.writeEntry( filename, filePath );
1765 cfg.removeEntry(file); 1694 cfg.removeEntry( file);
1766 cfg.write(); 1695 cfg.write();
@@ -1777,3 +1706,2 @@ void QtRec::okRename() {
1777void QtRec::cancelRename() { 1706void QtRec::cancelRename() {
1778 // qDebug("cancel rename");
1779 bool resetFocus = ListView1->viewport()->focusProxy() == renameBox; 1707 bool resetFocus = ListView1->viewport()->focusProxy() == renameBox;
@@ -1813,4 +1741,3 @@ int QtRec::getCurrentSizeLimit() {
1813void QtRec::timerBreak() { 1741void QtRec::timerBreak() {
1814 // qDebug("timer break"); 1742 endPlaying();
1815 stop();
1816} 1743}
@@ -1838,3 +1765,4 @@ void QtRec::compressionSelected(bool b) {
1838 cfg.writeEntry("wavCompression", b); 1765 cfg.writeEntry("wavCompression", b);
1839 cfg.writeEntry("bitrate",16); filePara.resolution=16; 1766 cfg.writeEntry("bitrate", 16);
1767 filePara.resolution = 16;
1840 cfg.write(); 1768 cfg.write();
@@ -1842,7 +1770,7 @@ void QtRec::compressionSelected(bool b) {
1842 if(b) { 1770 if(b) {
1843 bitRateComboBox->setEnabled(false); 1771 bitRateComboBox->setEnabled( false);
1844 bitRateComboBox->setCurrentItem(0); 1772 bitRateComboBox->setCurrentItem( 0);
1845 filePara.resolution=16; 1773 filePara.resolution = 16;
1846 } else{ 1774 } else{
1847 bitRateComboBox->setEnabled(true); 1775 bitRateComboBox->setEnabled( true);
1848 } 1776 }
@@ -1880,4 +1808,4 @@ long QtRec::checkDiskSpace(const QString &path) {
1880 1808
1881void QtRec::receive( const QCString &/* msg*/, const QByteArray & ) { 1809void QtRec::receive( const QCString &msg, const QByteArray & ) {
1882 // qDebug("Voicerecord received message "+msg); 1810 qDebug("Voicerecord received message "+msg);
1883 1811
@@ -1888,3 +1816,22 @@ void QtRec::receive( const QCString &/* msg*/, const QByteArray & ) {
1888void QtRec::timerEvent( QTimerEvent *e ) { 1816void QtRec::timerEvent( QTimerEvent *e ) {
1889// qDebug( "%d", secCount ); 1817
1818// if(!recording)
1819// timeSlider->setValue( secCount);
1820// else
1821// timeSlider->setValue( filePara.numberOfRecordedSeconds);
1822
1823 if( stopped && playing) {
1824 stop();
1825 }
1826
1827 if( stopped && recording ){
1828 stop();
1829 }
1830
1831 if( recording && filePara.SecondsToRecord < secCount && filePara.SecondsToRecord != 0) {
1832 stop();
1833 }
1834
1835 qDebug( "%d", secCount );
1836 QString timeString;
1890#ifdef DEV_VERSION 1837#ifdef DEV_VERSION
@@ -1895,24 +1842,5 @@ void QtRec::timerEvent( QTimerEvent *e ) {
1895 1842
1896 if( !playing ) { 1843 timeString.sprintf("%d", secCount);
1897 if(!recording ){ 1844 timeLabel->setText( timeString + " seconds");
1898 killTimer(e->timerId()); 1845
1899///* stopped=true;
1900// recording=false;
1901///*/
1902// _exit( 0);
1903 }
1904 if(filePara.SecondsToRecord < secCount && filePara.SecondsToRecord !=0) {
1905 killTimer(e->timerId());
1906 stop();
1907 }
1908 }
1909// if( stopped && !paused) {
1910// if( filePara.numberOfRecordedSeconds < secCount) {
1911// stopped = true;
1912// // playing=false;
1913// killTimer(e->timerId());
1914// endPlaying();
1915// }
1916// }
1917// qApp->processEvents();
1918 secCount++; 1846 secCount++;
@@ -1921,3 +1849,3 @@ void QtRec::timerEvent( QTimerEvent *e ) {
1921void QtRec::changeTimeSlider(int index) { 1849void QtRec::changeTimeSlider(int index) {
1922 if(ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return; 1850 if( ListView1->currentItem() == 0 || !wavFile->track.isOpen()) return;
1923 // qDebug("Slider moved to %d",index); 1851 // qDebug("Slider moved to %d",index);
@@ -1929,6 +1857,6 @@ void QtRec::changeTimeSlider(int index) {
1929 QString timeString; 1857 QString timeString;
1930 filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2; 1858 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1931 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1859 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
1932 secCount = (int)filePara.numberOfRecordedSeconds; 1860 secCount = (int)filePara.numberOfRecordedSeconds;
1933 timeLabel->setText( timeString+ tr(" seconds")); 1861 timeLabel->setText( timeString + tr(" seconds"));
1934} 1862}
@@ -1936,3 +1864,3 @@ void QtRec::changeTimeSlider(int index) {
1936void QtRec::timeSliderPressed() { 1864void QtRec::timeSliderPressed() {
1937 if(ListView1->currentItem() == 0) return; 1865 if( ListView1->currentItem() == 0) return;
1938 // qDebug("slider pressed"); 1866 // qDebug("slider pressed");
@@ -1943,4 +1871,4 @@ void QtRec::timeSliderPressed() {
1943void QtRec::timeSliderReleased() { 1871void QtRec::timeSliderReleased() {
1944 if(ListView1->currentItem() == 0) return; 1872 if( ListView1->currentItem() == 0) return;
1945 sliderPos=timeSlider->value(); 1873 sliderPos = timeSlider->value();
1946 1874
@@ -1950,3 +1878,3 @@ void QtRec::timeSliderReleased() {
1950 total = newPos*4; 1878 total = newPos*4;
1951 filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2; 1879 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
1952 1880
@@ -1956,3 +1884,3 @@ void QtRec::timeSliderReleased() {
1956void QtRec::rewindPressed() { 1884void QtRec::rewindPressed() {
1957 if(ListView1->currentItem() == 0) return; 1885 if( ListView1->currentItem() == 0) return;
1958 if( !wavFile->track.isOpen()) { 1886 if( !wavFile->track.isOpen()) {
@@ -1967,3 +1895,3 @@ void QtRec::rewindPressed() {
1967 stopped = true; 1895 stopped = true;
1968 rewindTimer->start(50, false); 1896 rewindTimer->start( 50, false);
1969 } 1897 }
@@ -1973,3 +1901,3 @@ void QtRec::rewindTimerTimeout() {
1973 int sliderValue = timeSlider->value(); 1901 int sliderValue = timeSlider->value();
1974 sliderValue = sliderValue-(filePara.numberSamples/100); 1902 sliderValue = sliderValue - ( filePara.numberSamples / 100);
1975 // if(toBeginningButton->isDown()) 1903 // if(toBeginningButton->isDown())
@@ -1978,3 +1906,3 @@ void QtRec::rewindTimerTimeout() {
1978 QString timeString; 1906 QString timeString;
1979 filePara.numberOfRecordedSeconds=(float)sliderValue/(float)filePara.sampleRate*(float)2; 1907 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2;
1980 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1908 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
@@ -1989,5 +1917,5 @@ void QtRec::rewindReleased() {
1989 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1917 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
1990 total = newPos*4; 1918 total = newPos * 4;
1991 // qDebug("rewind released %d", total); 1919 // qDebug("rewind released %d", total);
1992 startTimer(1000); 1920 startTimer( 1000);
1993 doPlay(); 1921 doPlay();
@@ -1997,3 +1925,3 @@ void QtRec::rewindReleased() {
1997void QtRec::FastforwardPressed() { 1925void QtRec::FastforwardPressed() {
1998 if(ListView1->currentItem() == 0) return; 1926 if( ListView1->currentItem() == 0) return;
1999 if( !wavFile->track.isOpen()) 1927 if( !wavFile->track.isOpen())
@@ -2014,9 +1942,9 @@ void QtRec::forwardTimerTimeout() {
2014 int sliderValue = timeSlider->value(); 1942 int sliderValue = timeSlider->value();
2015 sliderValue = sliderValue +(filePara.numberSamples/100); 1943 sliderValue = sliderValue + ( filePara.numberSamples / 100);
2016 1944
2017 // if(toEndButton->isDown()) 1945 // if(toEndButton->isDown())
2018 timeSlider->setValue(sliderValue); 1946 timeSlider->setValue( sliderValue);
2019 1947
2020 QString timeString; 1948 QString timeString;
2021 filePara.numberOfRecordedSeconds=(float)sliderValue/(float)filePara.sampleRate*(float)2; 1949 filePara.numberOfRecordedSeconds = (float)sliderValue / (float)filePara.sampleRate * (float)2;
2022 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds); 1950 timeString.sprintf( "%.2f", filePara.numberOfRecordedSeconds);
@@ -2031,5 +1959,5 @@ void QtRec::FastforwardReleased() {
2031 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET); 1959 int newPos = lseek( filePara.fd, sliderPos, SEEK_SET);
2032 total = newPos*4; 1960 total = newPos * 4;
2033 filePara.numberOfRecordedSeconds=(float)sliderPos/(float)filePara.sampleRate*(float)2; 1961 filePara.numberOfRecordedSeconds = (float)sliderPos / (float)filePara.sampleRate * (float)2;
2034 startTimer(1000); 1962 startTimer( 1000);
2035 doPlay(); 1963 doPlay();
@@ -2046,7 +1974,7 @@ QString QtRec::getStorage(const QString &fileName) {
2046 for( ; it.current(); ++it ){ 1974 for( ; it.current(); ++it ){
2047 const QString name = (*it)->name(); 1975 const QString name = ( *it)->name();
2048 const QString path = (*it)->path(); 1976 const QString path = ( *it)->path();
2049 const QString disk = (*it)->disk(); 1977 const QString disk = ( *it)->disk();
2050 if( fileName.find(path,0,true) != -1) 1978 if( fileName.find( path,0,true) != -1)
2051 storage=name; 1979 storage = name;
2052 // const QString options = (*it)->options(); 1980 // const QString options = (*it)->options();
@@ -2073,3 +2001,3 @@ void QtRec::setRecordButton(bool b) {
2073 2001
2074 Rec_PushButton->setDown(true); 2002 Rec_PushButton->setDown( true);
2075 QPixmap image3( ( const char** ) image3_data ); 2003 QPixmap image3( ( const char** ) image3_data );
@@ -2077,4 +2005,4 @@ void QtRec::setRecordButton(bool b) {
2077 if(Stop_PushButton->isDown()) 2005 if(Stop_PushButton->isDown())
2078 Stop_PushButton->setDown(true); 2006 Stop_PushButton->setDown( true);
2079 playLabel2->setText(tr("Stop") ); 2007 playLabel2->setText( tr("Stop") );
2080 2008
@@ -2085,4 +2013,4 @@ void QtRec::setRecordButton(bool b) {
2085 if(Stop_PushButton->isDown()) 2013 if(Stop_PushButton->isDown())
2086 Stop_PushButton->setDown(false); 2014 Stop_PushButton->setDown( false);
2087 playLabel2->setText(tr("Play") ); 2015 playLabel2->setText( tr("Play") );
2088 if(Rec_PushButton->isDown()) 2016 if(Rec_PushButton->isDown())
@@ -2095,6 +2023,6 @@ void QtRec::fillDirectoryCombo() {
2095 directoryComboBox->clear(); 2023 directoryComboBox->clear();
2096 int index=0; 2024 int index = 0;
2097 Config cfg("OpieRec"); 2025 Config cfg("OpieRec");
2098 cfg.setGroup("Settings"); 2026 cfg.setGroup("Settings");
2099 QString dir= cfg.readEntry("directory", "/"); 2027 QString dir = cfg.readEntry("directory", "/");
2100 StorageInfo storageInfo; 2028 StorageInfo storageInfo;
@@ -2104,8 +2032,8 @@ void QtRec::fillDirectoryCombo() {
2104 for( ; it.current(); ++it ){ 2032 for( ; it.current(); ++it ){
2105 const QString name = (*it)->name(); 2033 const QString name = ( *it)->name();
2106 const QString path = (*it)->path(); 2034 const QString path = ( *it)->path();
2107 // directoryComboBox->insertItem(name+" "+path); 2035 // directoryComboBox->insertItem(name+" "+path);
2108 directoryComboBox->insertItem(name); 2036 directoryComboBox->insertItem(name);
2109 if(path==dir) 2037 if( path == dir)
2110 directoryComboBox->setCurrentItem(index); 2038 directoryComboBox->setCurrentItem( index);
2111 index++; 2039 index++;
@@ -2126,3 +2054,3 @@ void QtRec::doMute(bool b) {
2126void QtRec::slotAutoMute(bool b) { 2054void QtRec::slotAutoMute(bool b) {
2127 autoMute=b; 2055 autoMute = b;
2128 Config cfg("OpieRec"); 2056 Config cfg("OpieRec");
@@ -2130,3 +2058,3 @@ void QtRec::slotAutoMute(bool b) {
2130 cfg.writeEntry("useAutoMute",b); 2058 cfg.writeEntry("useAutoMute",b);
2131 doMute(b); 2059 doMute( b);
2132 outMuteCheckBox->setChecked( b); 2060 outMuteCheckBox->setChecked( b);
@@ -2138,3 +2066,3 @@ void QtRec::selectItemByName(const QString & name) {
2138 for ( ; it.current(); ++it ) 2066 for ( ; it.current(); ++it )
2139 if(name == it.current()->text(0)) 2067 if( name == it.current()->text(0))
2140 ListView1->setCurrentItem(it.current()); 2068 ListView1->setCurrentItem(it.current());
@@ -2143,26 +2071,39 @@ void QtRec::selectItemByName(const QString & name) {
2143 2071
2144long findPeak(long input ) { 2072// long findPeak(long input ) {
2145 2073
2146// halfLife = time in seconds for output to decay to half value after an impulse 2074// // halfLife = time in seconds for output to decay to half value after an impulse
2147 float output = 0.0; 2075// static float output = 0.0;
2148 float halfLife = .25; 2076// float halfLife = .0025;
2149 float vsf = .0025; 2077// float vsf = .0025;
2150 float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate )); 2078// float scalar = pow( 0.5, 1.0/(halfLife * filePara.sampleRate ));
2151 if( input < 0.0 ) 2079// if( input < 0.0 )
2152 input = -input; // Absolute value. 2080// input = -input; // Absolute value.
2153 if ( input >= output) { 2081// if ( input >= output ) {
2154 // When we hit a peak, ride the peak to the top. 2082// // When we hit a peak, ride the peak to the top.
2155 output = input; 2083// output = input;
2156 } else { 2084// } else {
2157// Exponential decay of output when signal is low. 2085// // Exponential decay of output when signal is low.
2158 output = output * scalar; 2086// output = output * scalar;
2159// 2087// //
2160// When current gets close to 0.0, set current to 0.0 to prevent FP underflow 2088// // When current gets close to 0.0, set current to 0.0 to prevent FP underflow
2161// which can cause a severe performance degradation due to a flood 2089// // which can cause a severe performance degradation due to a flood
2162// of interrupts. 2090// // of interrupts.
2163// 2091// //
2164 if( output < vsf ) output = 0.0; 2092// if( output < vsf ) output = 0.0;
2165 } 2093// }
2094
2095// return (long) output;
2096// }
2166 2097
2167 return (long)output; 2098void QtRec::changeStereoCheck(bool b) {
2099 Config cfg("OpieRec");
2100 cfg.setGroup("Settings");
2101 int ch = 0;
2102 if ( !b) { ch = 1;}
2103 else { ch = 2;}
2104 cfg.writeEntry("stereo", b);
2105 filePara.channels = ch;
2106
2107 cfg.write();
2168} 2108}
2109
diff --git a/noncore/multimedia/opierec/qtrec.h b/noncore/multimedia/opierec/qtrec.h
index ada3270..93b9b5f 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
6#define QTREC_H 6#define QTREC_H
7#define VERSION 1.0 7#define VERSION 20030920
8 8
@@ -57,3 +57,3 @@ class QtRec : public QWidget
57public: 57public:
58 static QString appName() { return QString::fromLatin1("opierec"); } 58 static QString appName() { return QString::fromLatin1("opierec"); }
59 QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 ); 59 QtRec( QWidget* parent=0, const char* name=0, WFlags fl=0 );
@@ -74,3 +74,3 @@ private:
74 QTimer *t_timer; 74 QTimer *t_timer;
75 bool needsStereoOut, paused, playing; 75 bool needsStereoOut, paused;
76 bool useTmpFile, autoMute; 76 bool useTmpFile, autoMute;
@@ -100,3 +100,2 @@ private slots:
100 100
101
102 void FastforwardPressed(); 101 void FastforwardPressed();
@@ -107,2 +106,4 @@ private slots:
107 void changebitrateCombo(int); 106 void changebitrateCombo(int);
107 void changeStereoCheck( bool);
108
108 void changedInVolume(); 109 void changedInVolume();
@@ -136,7 +137,5 @@ protected:
136 137
137 Device *soundDevice;
138 WavFile *wavFile; 138 WavFile *wavFile;
139
140 QButtonGroup *ButtonGroup1; 139 QButtonGroup *ButtonGroup1;
141 QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox; 140 QCheckBox *outMuteCheckBox, *inMuteCheckBox, *compressionCheckBox, *autoMuteCheckBox, *stereoCheckBox;
142 QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo; 141 QComboBox* sampleRateComboBox, * bitRateComboBox, *directoryComboBox, *sizeLimitCombo;
@@ -180,3 +179,3 @@ protected:
180 void showListMenu(QListViewItem * ); 179 void showListMenu(QListViewItem * );
181// void quickRec(); 180// void quickRec();
182 181
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index b177c91..987fa32 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -151,4 +151,4 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
151 write( fd,hdr, sizeof(*hdr)); 151 write( fd,hdr, sizeof(*hdr));
152// qDebug("writing header: bitrate%d, samplerate %d, channels %d", 152 qDebug("writing header: bitrate%d, samplerate %d, channels %d",
153// wavResolution, wavSampleRate, wavChannels); 153 wavResolution, wavSampleRate, wavChannels);
154 return true; 154 return true;
@@ -162,3 +162,3 @@ bool WavFile::adjustHeaders(int fd, int total) {
162 write( fd, &total, sizeof(total)); 162 write( fd, &total, sizeof(total));
163// qDebug("adjusting header %d", total); 163 qDebug("adjusting header %d", total);
164 return true; 164 return true;
@@ -167,3 +167,3 @@ bool WavFile::adjustHeaders(int fd, int total) {
167int WavFile::parseWavHeader(int fd) { 167int WavFile::parseWavHeader(int fd) {
168// qDebug("Parsing wav header"); 168 qDebug("Parsing wav header");
169 char string[4]; 169 char string[4];
@@ -296,3 +296,3 @@ return wavResolution;
296int WavFile::getSampleRate() { 296int WavFile::getSampleRate() {
297return wavSampleRate; 297 return wavSampleRate;
298} 298}
@@ -300,3 +300,3 @@ return wavSampleRate;
300int WavFile::getNumberSamples() { 300int WavFile::getNumberSamples() {
301return wavNumberSamples; 301 return wavNumberSamples;
302} 302}
@@ -306 +306,6 @@ return useTmpFile;
306} 306}
307
308int WavFile::getChannels() {
309
310 return wavChannels;
311}
diff --git a/noncore/multimedia/opierec/wavFile.h b/noncore/multimedia/opierec/wavFile.h
index b70c09d..e18cfce 100644
--- a/noncore/multimedia/opierec/wavFile.h
+++ b/noncore/multimedia/opierec/wavFile.h
@@ -43,2 +43,3 @@ public:
43 int getNumberSamples(); 43 int getNumberSamples();
44 int getChannels();
44 bool isTempFile(); 45 bool isTempFile();