summaryrefslogtreecommitdiff
path: root/noncore/multimedia/opierec
Unidiff
Diffstat (limited to 'noncore/multimedia/opierec') (more/less context) (show whitespace changes)
-rw-r--r--noncore/multimedia/opierec/device.cpp16
-rw-r--r--noncore/multimedia/opierec/opierec.pro1
-rw-r--r--noncore/multimedia/opierec/qtrec.cpp21
-rw-r--r--noncore/multimedia/opierec/wavFile.cpp40
4 files changed, 43 insertions, 35 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp
index e7e0f4b..a76665e 100644
--- a/noncore/multimedia/opierec/device.cpp
+++ b/noncore/multimedia/opierec/device.cpp
@@ -60,6 +60,7 @@ Device::Device( QObject * parent, bool record )
60 if( !record){ //playing 60 if( !record){ //playing
61 owarn << "setting up DSP for playing" << oendl; 61 owarn << "New Sound device DSP for playing" << oendl;
62 flags = O_WRONLY; 62 flags = O_RDWR;
63// flags = O_WRONLY;
63 } else { //recording 64 } else { //recording
64 owarn << "setting up DSP for recording" << oendl; 65 owarn << "New Sound device DSP for recording" << oendl;
65 flags = O_RDWR; 66 flags = O_RDWR;
@@ -71,2 +72,3 @@ Device::Device( QObject * parent, bool record )
71bool Device::openDsp() { 72bool Device::openDsp() {
73 qWarning("Device::openDsp()");
72 if( openDevice( flags) == -1) { 74 if( openDevice( flags) == -1) {
@@ -79,6 +81,6 @@ bool Device::openDsp() {
79int Device::openDevice( int flags) { 81int Device::openDevice( int flags) {
80 owarn << "Opening"<< dspstr; 82 owarn << "Opening sound device:"<< DSPSTROUT << oendl;
81 83
82 if (( sd = ::open( DSPSTROUT, flags)) == -1) { 84 if (( sd = ::open( DSPSTROUT, O_RDWR)) == -1) {
83 perror("open(\"/dev/dsp\")"); 85 perror("open(\"/dev/dsp\")\n");
84 QString errorMsg="Could not open audio device\n /dev/dsp\n" 86 QString errorMsg="Could not open audio device\n /dev/dsp\n"
@@ -92,2 +94,3 @@ int Device::openDevice( int flags) {
92 } 94 }
95 qWarning("opened!");
93 return sd; 96 return sd;
@@ -152,2 +155,3 @@ bool Device::selectMicInput() {
152bool Device::closeDevice( bool) { 155bool Device::closeDevice( bool) {
156 if(sd)
153 ::close( sd); //close sound device 157 ::close( sd); //close sound device
diff --git a/noncore/multimedia/opierec/opierec.pro b/noncore/multimedia/opierec/opierec.pro
index 6a5838a..6008bf7 100644
--- a/noncore/multimedia/opierec/opierec.pro
+++ b/noncore/multimedia/opierec/opierec.pro
@@ -33,2 +33,3 @@ contains(CONFIG, pdaudio) {
33 LIBS += -lqpe -lopiecore2 -lpthread 33 LIBS += -lqpe -lopiecore2 -lpthread
34 DEFINES += THREADED
34 TARGET = opierec 35 TARGET = opierec
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp
index e827083..9b761aa 100644
--- a/noncore/multimedia/opierec/qtrec.cpp
+++ b/noncore/multimedia/opierec/qtrec.cpp
@@ -158,3 +158,3 @@ void quickRec()
158 158
159 bytesWritten = ::write( filePara.fd , (short *)abuf, number/4); 159 bytesWritten = ::write( filePara.fd , abuf, number/4);
160 160
@@ -169,3 +169,3 @@ void quickRec()
169 169
170 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2/ filePara.channels; 170 filePara.numberOfRecordedSeconds = (float)total / (float)filePara.sampleRate * (float)2;/// filePara.channels;
171 171
@@ -303,4 +303,6 @@ void playIt()
303// } 303// }
304 bytesWritten = write ( filePara.sd, sbuf, number * 4); 304 bytesWritten = write ( soundDevice->sd , sbuf, number * 4);
305 waveform->newSamples( (const short *)sbuf, number *4); 305
306 waveform->newSamples( sbuf, number );
307
306 // if(filePara.channels==1) 308 // if(filePara.channels==1)
@@ -344,3 +346,3 @@ void playIt()
344// } 346// }
345 bytesWritten = ::write( filePara.sd, inbuffer, number); 347 bytesWritten = ::write( soundDevice->sd, inbuffer, number);
346 waveform->newSamples( inbuffer, number); 348 waveform->newSamples( inbuffer, number);
@@ -790,4 +792,4 @@ void QtRec::initConfig() {
790 if( compressionCheckBox->isChecked()) { 792 if( compressionCheckBox->isChecked()) {
793 bitRateComboBox->setCurrentItem(1);
791 bitRateComboBox->setEnabled(false); 794 bitRateComboBox->setEnabled(false);
792 bitRateComboBox->setCurrentItem(0);
793 filePara.resolution=16; 795 filePara.resolution=16;
@@ -1050,3 +1052,3 @@ bool QtRec::setupAudio( bool b) {
1050 // if(soundDevice) delete soundDevice; 1052 // if(soundDevice) delete soundDevice;
1051 odebug << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl; 1053 owarn << "<<<<<<<<<<<<<<<<<<<open dsp " << filePara.sampleRate << " " << filePara.channels << " " << sampleformat << "" << oendl;
1052 // owarn << "change waveform settings" << oendl; 1054 // owarn << "change waveform settings" << oendl;
@@ -1485,3 +1487,3 @@ void QtRec::endPlaying() {
1485bool QtRec::openPlayFile() { 1487bool QtRec::openPlayFile() {
1486 1488 qWarning("opening file");
1487 qApp->processEvents(); 1489 qApp->processEvents();
@@ -1728,4 +1730,5 @@ void QtRec::compressionSelected(bool b) {
1728 if(b) { 1730 if(b) {
1729 bitRateComboBox->setEnabled( false); 1731 qWarning("set adpcm");
1730 bitRateComboBox->setCurrentItem( 1); 1732 bitRateComboBox->setCurrentItem( 1);
1733 bitRateComboBox->setEnabled( false);
1731 filePara.resolution = 16; 1734 filePara.resolution = 16;
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp
index 80453e1..b53c416 100644
--- a/noncore/multimedia/opierec/wavFile.cpp
+++ b/noncore/multimedia/opierec/wavFile.cpp
@@ -29,3 +29,3 @@ WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int
29{ 29{
30//odebug << "new wave file" << oendl; 30 owarn << "new wave file: " << fileName << oendl;
31 bool b = makeNwFile; 31 bool b = makeNwFile;
@@ -111,3 +111,3 @@ void WavFile::closeFile() {
111int WavFile::openFile(const QString &currentFileName) { 111int WavFile::openFile(const QString &currentFileName) {
112// odebug << "open play file "+currentFileName << oendl; 112 qWarning("open play file "+currentFileName);;
113 closeFile(); 113 closeFile();
@@ -154,3 +154,3 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) {
154 write( fd,hdr, sizeof(*hdr)); 154 write( fd,hdr, sizeof(*hdr));
155 odebug << "writing header: bitrate " << wavResolution << ", samplerate " << wavSampleRate << ", channels " << wavChannels << oendl; 155 owarn << "writing header: bitrate " << wavResolution << ", samplerate " << wavSampleRate << ", channels " << wavChannels << oendl;
156 return true; 156 return true;
@@ -164,3 +164,3 @@ bool WavFile::adjustHeaders(int fd, int total) {
164 write( fd, &total, sizeof(total)); 164 write( fd, &total, sizeof(total));
165 odebug << "adjusting header " << total << "" << oendl; 165 owarn << "adjusting header " << total << "" << oendl;
166 return true; 166 return true;
@@ -169,3 +169,3 @@ bool WavFile::adjustHeaders(int fd, int total) {
169int WavFile::parseWavHeader(int fd) { 169int WavFile::parseWavHeader(int fd) {
170 odebug << "Parsing wav header" << oendl; 170 owarn << "Parsing wav header" << oendl;
171 char string[4]; 171 char string[4];
@@ -177,3 +177,3 @@ int WavFile::parseWavHeader(int fd) {
177 if (read(fd, string, 4) < 4) { 177 if (read(fd, string, 4) < 4) {
178 odebug << " Could not read from sound file." << oendl; 178 owarn << " Could not read from sound file." << oendl;
179 return -1; 179 return -1;
@@ -181,3 +181,3 @@ int WavFile::parseWavHeader(int fd) {
181 if (strncmp(string, "RIFF", 4)) { 181 if (strncmp(string, "RIFF", 4)) {
182 odebug << " not a valid WAV file." << oendl; 182 owarn << " not a valid WAV file." << oendl;
183 return -1; 183 return -1;
@@ -186,3 +186,3 @@ int WavFile::parseWavHeader(int fd) {
186 if (read(fd, string, 4) < 4) { 186 if (read(fd, string, 4) < 4) {
187 odebug << "Could not read from sound file." << oendl; 187 owarn << "Could not read from sound file." << oendl;
188 return -1; 188 return -1;
@@ -190,3 +190,3 @@ int WavFile::parseWavHeader(int fd) {
190 if (strncmp(string, "WAVE", 4)) { 190 if (strncmp(string, "WAVE", 4)) {
191 odebug << "not a valid WAV file." << oendl; 191 owarn << "not a valid WAV file." << oendl;
192 return -1; 192 return -1;
@@ -197,3 +197,3 @@ int WavFile::parseWavHeader(int fd) {
197 if (read(fd, string, 4) < 4) { 197 if (read(fd, string, 4) < 4) {
198 odebug << "Could not read from sound file." << oendl; 198 owarn << "Could not read from sound file." << oendl;
199 return -1; 199 return -1;
@@ -202,3 +202,3 @@ int WavFile::parseWavHeader(int fd) {
202 if (read(fd, &longdata, 4) < 4) { 202 if (read(fd, &longdata, 4) < 4) {
203 odebug << "Could not read from sound file." << oendl; 203 owarn << "Could not read from sound file." << oendl;
204 return -1; 204 return -1;
@@ -209,3 +209,3 @@ int WavFile::parseWavHeader(int fd) {
209 if (read(fd, &fmt, 2) < 2) { 209 if (read(fd, &fmt, 2) < 2) {
210 odebug << "Could not read format chunk." << oendl; 210 owarn << "Could not read format chunk." << oendl;
211 return -1; 211 return -1;
@@ -213,3 +213,3 @@ int WavFile::parseWavHeader(int fd) {
213 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { 213 if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) {
214 odebug << "Wave file contains unknown format. Unable to continue." << oendl; 214 owarn << "Wave file contains unknown format. Unable to continue." << oendl;
215 return -1; 215 return -1;
@@ -218,5 +218,5 @@ int WavFile::parseWavHeader(int fd) {
218 // compressionFormat=fmt; 218 // compressionFormat=fmt;
219 odebug << "compressionFormat is " << fmt << "" << oendl; 219 owarn << "compressionFormat is " << fmt << "" << oendl;
220 if (read(fd, &ch, 2) < 2) { 220 if (read(fd, &ch, 2) < 2) {
221 odebug << "Could not read format chunk." << oendl; 221 owarn << "Could not read format chunk." << oendl;
222 return -1; 222 return -1;
@@ -224,6 +224,6 @@ int WavFile::parseWavHeader(int fd) {
224 wavChannels = ch; 224 wavChannels = ch;
225 odebug << "File has " << ch << " channels" << oendl; 225 owarn << "File has " << ch << " channels" << oendl;
226 } 226 }
227 if (read(fd, &samplerrate, 4) < 4) { 227 if (read(fd, &samplerrate, 4) < 4) {
228 odebug << "Could not read from format chunk." << oendl; 228 owarn << "Could not read from format chunk." << oendl;
229 return -1; 229 return -1;
@@ -232,3 +232,3 @@ int WavFile::parseWavHeader(int fd) {
232 // sampleRate = samplerrate; 232 // sampleRate = samplerrate;
233 odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; 233 owarn << "File has samplerate of " << (int) samplerrate << "" << oendl;
234 } 234 }
@@ -236,3 +236,3 @@ int WavFile::parseWavHeader(int fd) {
236 if (read(fd, &bitrate, 2) < 2) { 236 if (read(fd, &bitrate, 2) < 2) {
237 odebug << "Could not read format chunk." << oendl; 237 owarn << "Could not read format chunk." << oendl;
238 return -1; 238 return -1;
@@ -241,3 +241,3 @@ int WavFile::parseWavHeader(int fd) {
241 // resolution = bitrate; 241 // resolution = bitrate;
242 odebug << "File has bitrate of " << bitrate << "" << oendl; 242 owarn << "File has bitrate of " << bitrate << "" << oendl;
243 } 243 }