-rw-r--r-- | noncore/multimedia/opierec/device.cpp | 6 | ||||
-rw-r--r-- | noncore/multimedia/opierec/helpwindow.cpp | 23 | ||||
-rw-r--r-- | noncore/multimedia/opierec/opierec.control | 2 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 16 | ||||
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 2 |
5 files changed, 1 insertions, 48 deletions
diff --git a/noncore/multimedia/opierec/device.cpp b/noncore/multimedia/opierec/device.cpp index c2029b7..f9a80c5 100644 --- a/noncore/multimedia/opierec/device.cpp +++ b/noncore/multimedia/opierec/device.cpp @@ -1,78 +1,72 @@ // device.cpp #include "device.h" -#include "qtrec.h" -#include <qpe/qpeapplication.h> #include <qpe/config.h> #include <qpe/qcopenvelope_qws.h> -#include <qslider.h> -#include <qmessagebox.h> -#include <qfile.h> -#include <qtextstream.h> #include <fcntl.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <unistd.h> #include<sys/wait.h> // #include <sys/stat.h> // #include <sys/time.h> // #include <sys/types.h> #include <unistd.h> #include <errno.h> //extern QtRec *qperec; Device::Device( QObject * parent, const char * dsp, const char * mixr, bool record ) : QObject( parent) { dspstr = (char *)dsp; mixstr = (char *)mixr; devForm=-1; devCh=-1; devRate=-1; if( !record){ //playing qDebug("setting up DSP for playing"); flags = O_WRONLY; } else { //recording qDebug("setting up DSP for recording"); flags = O_RDWR; // flags = O_RDONLY; selectMicInput(); } } bool Device::openDsp() { if( openDevice( flags) == -1) { perror("<<<<<<<<<<<<<<ioctl(\"Open device\")"); return false; } return true; } int Device::getOutVolume( ) { unsigned int volume; int mixerHandle = open( mixstr, O_RDWR ); if ( mixerHandle >= 0 ) { if(ioctl( mixerHandle, MIXER_READ(SOUND_MIXER_VOLUME), &volume )==-1) perror("<<<<<<<<<<<<<<ioctl(\"MIXER_READ\")"); ::close( mixerHandle ); } else perror("open(\"/dev/mixer\")"); printf("<<<<<<<<<<<<<<<<<<<<output volume %d\n",volume); Config cfg("qpe"); cfg.setGroup("Volume"); return cfg.readNumEntry("VolumePercent"); } int Device::getInVolume() { unsigned int volume=0; int mixerHandle = ::open( mixstr, O_RDWR ); diff --git a/noncore/multimedia/opierec/helpwindow.cpp b/noncore/multimedia/opierec/helpwindow.cpp index 0c4ac78..1ab6510 100644 --- a/noncore/multimedia/opierec/helpwindow.cpp +++ b/noncore/multimedia/opierec/helpwindow.cpp @@ -1,105 +1,82 @@ /**************************************************************************** ** $Id$ ** ** Copyright (C) 1992-2000 Trolltech AS. All rights reserved. ** ** This file is part of an example program for Qt. This example ** program may be used, distributed and modified without limitation. ** *****************************************************************************/ #include "helpwindow.h" -#include <qstatusbar.h> -#include <qstringlist.h> #include <qlayout.h> -#include <qpe/qpemenubar.h> #include <qpe/qpetoolbar.h> #include <qpe/resource.h> #include <qaction.h> -#include <qpixmap.h> -#include <qpopupmenu.h> #include <qmenubar.h> -#include <qtoolbutton.h> -#include <qiconset.h> -#include <qfile.h> -#include <qtextstream.h> -#include <qstylesheet.h> -#include <qmessagebox.h> -#include <qfiledialog.h> -#include <qapplication.h> -#include <qcombobox.h> -#include <qevent.h> -#include <qlineedit.h> -#include <qobjectlist.h> -#include <qfileinfo.h> -#include <qfile.h> -#include <qdatastream.h> -#include <qprinter.h> -#include <qsimplerichtext.h> -#include <qpaintdevicemetrics.h> #include <ctype.h> HelpWindow::HelpWindow( const QString& home_, const QString& _path, QWidget* parent, const char *name ) : QMainWindow( parent, name, WDestructiveClose ), pathCombo( 0 ), selectedURL() { QGridLayout *layout = new QGridLayout( this ); layout->setSpacing( 2); layout->setMargin( 2); qDebug(_path); browser = new QTextBrowser( this ); QStringList Strlist; Strlist.append( home_); browser->mimeSourceFactory()->setFilePath( Strlist ); browser->setFrameStyle( QFrame::Panel | QFrame::Sunken ); connect( browser, SIGNAL( textChanged() ), this, SLOT( textChanged() ) ); if ( !home_.isEmpty() ) browser->setSource( home_ ); QPEToolBar *toolbar = new QPEToolBar( this ); QAction *a = new QAction( tr( "Backward" ), Resource::loadPixmap( "back" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) ); a->addTo( toolbar ); a = new QAction( tr( "Forward" ), Resource::loadPixmap( "forward" ), QString::null, 0, this, 0 ); connect( a, SIGNAL( activated() ), browser, SLOT( forward() ) ); a->addTo( toolbar ); layout->addMultiCellWidget( toolbar, 0, 0, 0, 0); layout->addMultiCellWidget( browser, 1, 2, 0, 2); browser->setFocus(); } void HelpWindow::setBackwardAvailable( bool b) { menuBar()->setItemEnabled( backwardId, b); } void HelpWindow::setForwardAvailable( bool b) { menuBar()->setItemEnabled( forwardId, b); } void HelpWindow::textChanged() { if ( browser->documentTitle().isNull() ) { setCaption( "QpeRec - Helpviewer - " + browser->context() ); selectedURL = browser->context(); } else { setCaption( "QpeRec - Helpviewer - " + browser->documentTitle() ) ; selectedURL = browser->documentTitle(); } // if ( !selectedURL.isEmpty() && pathCombo ) { // bool exists = FALSE; // int i; diff --git a/noncore/multimedia/opierec/opierec.control b/noncore/multimedia/opierec/opierec.control index e8396ae..455691f 100644 --- a/noncore/multimedia/opierec/opierec.control +++ b/noncore/multimedia/opierec/opierec.control @@ -1,10 +1,10 @@ -Package: opierec +Package: opie-rec Files: bin/opierec pics/opierec apps/Applications/opierec.desktop Priority: optional Section: multimedia/applications Maintainer: L.J. Potter <ljp@llornkcor.com> Architecture: arm Version: 1.5-2 Depends: opie ($QPE_VERSION) Description: audio sampling recorder A simple audio recording/playing application. diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 28f6546..0307d99 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp @@ -1,123 +1,107 @@ /**************************************************************************** // qtrec.cpp Created: Thu Jan 17 11:19:58 2002 copyright 2002 by L.J. Potter <ljp@llornkcor.com> ****************************************************************************/ #define DEV_VERSION #include "pixmaps.h" #include "qtrec.h" -#include "helpwindow.h" -#include "device.h" -#include "wavFile.h" #include <pthread.h> extern "C" { #include "adpcm.h" } #include <sys/soundcard.h> // #if defined (QTOPIA_INTERNAL_FSLP) // #include <qpe/lnkproperties.h> // #endif -#include <qpe/applnk.h> #include <qpe/config.h> -#include <qpe/ir.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/qpeapplication.h> #include <qpe/resource.h> #include <qpe/storage.h> -#include <qlineedit.h> -#include <qbuttongroup.h> #include <qcheckbox.h> #include <qcombobox.h> -#include <qcursor.h> //#include <qdatetime.h> #include <qdir.h> -#include <qfile.h> -#include <qtextstream.h> #include <qgroupbox.h> -#include <qiconview.h> -#include <qimage.h> #include <qlabel.h> #include <qlayout.h> -#include <qlineedit.h> #include <qlistview.h> #include <qmessagebox.h> -#include <qpixmap.h> #include <qpopupmenu.h> #include <qpushbutton.h> -#include <qregexp.h> #include <qslider.h> #include <qtabwidget.h> #include <qtimer.h> -#include <qvariant.h> #include <errno.h> #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <sys/ioctl.h> #include <sys/soundcard.h> #include <sys/stat.h> #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> #include <unistd.h> #include<sys/wait.h> #include <sys/signal.h> //#define ZAURUS 0 struct adpcm_state encoder_state; struct adpcm_state decoder_state; long findPeak(long input ); //char deviceRates[]; typedef struct { int sampleRate; /* int fragSize; */ /* int blockSize; */ int resolution; //bitrate int channels; //number of channels int fd; //file descriptor int sd; //sound device descriptor int numberSamples; //total number of samples int SecondsToRecord; // number of seconds that should be recorded float numberOfRecordedSeconds; //total number of samples recorded int samplesToRecord; //number of samples to be recorded int inVol; //input volume int outVol; //output volume int format; //wavfile format PCM.. ADPCM const char *fileName; //name of fiel to be played/recorded } fileParameters; fileParameters filePara; bool monitoring, recording; bool stopped; QLabel *timeLabel; QSlider *timeSlider; int sd; #if defined(QT_QWS_EBX) #define DSPSTROUT "/dev/dsp" #define DSPSTRIN "/dev/dsp1" #define DSPSTRMIXEROUT "/dev/mixer" #define DSPSTRMIXERIN "/dev/mixer1" #else #define DSPSTROUT "/dev/dsp" #define DSPSTRIN "/dev/dsp" #define DSPSTRMIXERIN "/dev/mixer" #define DSPSTRMIXEROUT "/dev/mixer" #endif // threaded recording void quickRec() { diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 0bb5736..7bfffb6 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp @@ -1,70 +1,68 @@ //wavFile.cpp #include "wavFile.h" #include "qtrec.h" -#include <qdatetime.h> -#include <qstring.h> #include <qmessagebox.h> #include <qdir.h> #include <qpe/timestring.h> #include <qpe/config.h> #include <errno.h> #include <sys/time.h> #include <sys/types.h> #include <sys/vfs.h> #include <fcntl.h> #include <math.h> #include <mntent.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> WavFile::WavFile( QObject * parent,const QString &fileName, bool makeNwFile, int sampleRate, int channels, int resolution, int format ) : QObject( parent) { qDebug("new wave file"); bool b = makeNwFile; wavSampleRate=sampleRate; wavFormat=format; wavChannels=channels; wavResolution=resolution; useTmpFile=false; if( b) { newFile(); } else { openFile(fileName); } } bool WavFile::newFile() { qDebug("Set up new file"); Config cfg("OpieRec"); cfg.setGroup("Settings"); currentFileName=cfg.readEntry("directory",QDir::homeDirPath()); QString date; date = TimeString::dateString( QDateTime::currentDateTime(),false,true); date.replace(QRegExp("'"),""); date.replace(QRegExp(" "),"_"); date.replace(QRegExp(":"),"."); date.replace(QRegExp(","),""); QString currentFile=date; if(currentFileName.right(1).find("/",0,true) == -1) currentFileName += "/" + date; else currentFileName += date; currentFileName+=".wav"; qDebug("set up file for recording: "+currentFileName); char *pointer; if( currentFileName.find("/mnt",0,true) == -1 && currentFileName.find("/tmp",0,true) == -1 ) { // if destination file is most likely in flash (assuming jffs2) |