-rw-r--r-- | noncore/graphics/opie-eye/gui/imageinfoui.cpp | 2 | ||||
-rw-r--r-- | noncore/graphics/opie-eye/gui/mainwindow.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opieplayer2/audiowidget.cpp | 2 | ||||
-rw-r--r-- | noncore/multimedia/opierec/qtrec.cpp | 18 | ||||
-rw-r--r-- | noncore/multimedia/opierec/wavFile.cpp | 14 |
5 files changed, 19 insertions, 19 deletions
diff --git a/noncore/graphics/opie-eye/gui/imageinfoui.cpp b/noncore/graphics/opie-eye/gui/imageinfoui.cpp index 27a67a6..e70d6a6 100644 --- a/noncore/graphics/opie-eye/gui/imageinfoui.cpp +++ b/noncore/graphics/opie-eye/gui/imageinfoui.cpp | |||
@@ -135,49 +135,49 @@ void imageinfo::slotChangeName(const QString&_path) | |||
135 | SlaveMaster::self()->imageInfo( currentFile ); | 135 | SlaveMaster::self()->imageInfo( currentFile ); |
136 | 136 | ||
137 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); | 137 | QPixmap*m_pix = PPixmapCache::self()->cachedImage( _path, THUMBSIZE,THUMBSIZE ); |
138 | if (!m_pix) { | 138 | if (!m_pix) { |
139 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); | 139 | PixmapLabel1->setPixmap(QPixmap( Resource::loadPixmap( "UnknownDocument" ))); |
140 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); | 140 | SlaveMaster::self()->thumbNail(currentFile,THUMBSIZE,THUMBSIZE); |
141 | } else { | 141 | } else { |
142 | PixmapLabel1->setPixmap(*m_pix); | 142 | PixmapLabel1->setPixmap(*m_pix); |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | imageinfo::~imageinfo() | 146 | imageinfo::~imageinfo() |
147 | { | 147 | { |
148 | { | 148 | { |
149 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); | 149 | QCopEnvelope( "QPE/Application/opie-eye_slave", "refDown()" ); |
150 | } | 150 | } |
151 | if (m_viewManager) { | 151 | if (m_viewManager) { |
152 | delete m_viewManager; | 152 | delete m_viewManager; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) | 156 | void imageinfo::slot_fullInfo(const QString&_path, const QString&_t) |
157 | { | 157 | { |
158 | if (_path == currentFile) { | 158 | if (_path == currentFile) { |
159 | qDebug(_t); | 159 | odebug << _t << oendl; |
160 | QString t = _t; | 160 | QString t = _t; |
161 | t.replace(QRegExp("\n"),"<br>"); | 161 | t.replace(QRegExp("\n"),"<br>"); |
162 | TextView1->setText(t); | 162 | TextView1->setText(t); |
163 | } | 163 | } |
164 | } | 164 | } |
165 | 165 | ||
166 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) | 166 | void imageinfo::slotThumbNail(const QString&_path, const QPixmap&_pix) |
167 | { | 167 | { |
168 | if (_path == currentFile) { | 168 | if (_path == currentFile) { |
169 | if (_pix.width()>0) { | 169 | if (_pix.width()>0) { |
170 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); | 170 | PPixmapCache::self()->insertImage( _path, _pix, THUMBSIZE, THUMBSIZE ); |
171 | PixmapLabel1->setPixmap( _pix ); | 171 | PixmapLabel1->setPixmap( _pix ); |
172 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); | 172 | PixmapLabel1->resize(QSize(_pix.width(),_pix.height())); |
173 | } | 173 | } |
174 | } | 174 | } |
175 | } | 175 | } |
176 | 176 | ||
177 | void imageinfo::setPath( const QString& str ) { | 177 | void imageinfo::setPath( const QString& str ) { |
178 | slotChangeName( str ); | 178 | slotChangeName( str ); |
179 | } | 179 | } |
180 | 180 | ||
181 | void imageinfo::setDestructiveClose() { | 181 | void imageinfo::setDestructiveClose() { |
182 | WFlags fl = getWFlags(); | 182 | WFlags fl = getWFlags(); |
183 | /* clear it just in case */ | 183 | /* clear it just in case */ |
diff --git a/noncore/graphics/opie-eye/gui/mainwindow.cpp b/noncore/graphics/opie-eye/gui/mainwindow.cpp index 274a22a..6fff5ab 100644 --- a/noncore/graphics/opie-eye/gui/mainwindow.cpp +++ b/noncore/graphics/opie-eye/gui/mainwindow.cpp | |||
@@ -21,49 +21,49 @@ | |||
21 | 21 | ||
22 | #include <qpe/resource.h> | 22 | #include <qpe/resource.h> |
23 | #include <qpe/config.h> | 23 | #include <qpe/config.h> |
24 | #include <qpe/ir.h> | 24 | #include <qpe/ir.h> |
25 | #include <qpe/applnk.h> | 25 | #include <qpe/applnk.h> |
26 | 26 | ||
27 | #include <qtoolbar.h> | 27 | #include <qtoolbar.h> |
28 | #include <qtoolbutton.h> | 28 | #include <qtoolbutton.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qdialog.h> | 30 | #include <qdialog.h> |
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | #include <qframe.h> | 33 | #include <qframe.h> |
34 | 34 | ||
35 | 35 | ||
36 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) | 36 | //OPIE_EXPORT_APP_V2( Opie::Core::OApplicationFactory<PMainWindow>,"Opie Eye" ) |
37 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) | 37 | OPIE_EXPORT_APP( Opie::Core::OApplicationFactory<PMainWindow>) |
38 | 38 | ||
39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) | 39 | PMainWindow::PMainWindow(QWidget* wid, const char* name, WFlags style) |
40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) | 40 | : QMainWindow( wid, name, style ), m_info( 0 ), m_disp( 0 ) |
41 | { | 41 | { |
42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); | 42 | setCaption( QObject::tr("Opie Eye Caramba" ) ); |
43 | m_cfg = new Opie::Core::OConfig("phunkview"); | 43 | m_cfg = new Opie::Core::OConfig("phunkview"); |
44 | m_cfg->setGroup("Zecke_view" ); | 44 | m_cfg->setGroup("Zecke_view" ); |
45 | // qDebug( "Process-wide OApplication object @ %0x", oApp ); | 45 | // odebug << "Process-wide OApplication object @ " << oApp << oendl; |
46 | /* | 46 | /* |
47 | * Initialize ToolBar and IconView | 47 | * Initialize ToolBar and IconView |
48 | * And Connect Them | 48 | * And Connect Them |
49 | */ | 49 | */ |
50 | QToolBar *bar = new QToolBar( this ); | 50 | QToolBar *bar = new QToolBar( this ); |
51 | bar->setHorizontalStretchable( true ); | 51 | bar->setHorizontalStretchable( true ); |
52 | setToolBarsMovable( false ); | 52 | setToolBarsMovable( false ); |
53 | 53 | ||
54 | m_stack = new Opie::Ui::OWidgetStack( this ); | 54 | m_stack = new Opie::Ui::OWidgetStack( this ); |
55 | setCentralWidget( m_stack ); | 55 | setCentralWidget( m_stack ); |
56 | 56 | ||
57 | m_view = new PIconView( m_stack, m_cfg ); | 57 | m_view = new PIconView( m_stack, m_cfg ); |
58 | m_stack->addWidget( m_view, IconView ); | 58 | m_stack->addWidget( m_view, IconView ); |
59 | m_stack->raiseWidget( IconView ); | 59 | m_stack->raiseWidget( IconView ); |
60 | connect(m_view, SIGNAL(sig_display(const QString&)), | 60 | connect(m_view, SIGNAL(sig_display(const QString&)), |
61 | this, SLOT(slotDisplay(const QString&))); | 61 | this, SLOT(slotDisplay(const QString&))); |
62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), | 62 | connect(m_view, SIGNAL(sig_showInfo(const QString&)), |
63 | this, SLOT(slotShowInfo(const QString&)) ); | 63 | this, SLOT(slotShowInfo(const QString&)) ); |
64 | 64 | ||
65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); | 65 | m_stack->forceMode(Opie::Ui::OWidgetStack::NoForce); |
66 | 66 | ||
67 | upButton = new QToolButton( bar ); | 67 | upButton = new QToolButton( bar ); |
68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); | 68 | upButton->setIconSet( Resource::loadIconSet( "up" ) ); |
69 | connect( upButton, SIGNAL(clicked()), | 69 | connect( upButton, SIGNAL(clicked()), |
diff --git a/noncore/multimedia/opieplayer2/audiowidget.cpp b/noncore/multimedia/opieplayer2/audiowidget.cpp index 95a0f45..1c08b41 100644 --- a/noncore/multimedia/opieplayer2/audiowidget.cpp +++ b/noncore/multimedia/opieplayer2/audiowidget.cpp | |||
@@ -199,49 +199,49 @@ void AudioWidget::setSeekable( bool isSeekable ) { | |||
199 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 199 | disconnect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
200 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 200 | disconnect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
201 | } else { | 201 | } else { |
202 | // this stops the slider from being moved, thus | 202 | // this stops the slider from being moved, thus |
203 | // does not stop stream when it reaches the end | 203 | // does not stop stream when it reaches the end |
204 | slider.show(); | 204 | slider.show(); |
205 | odebug << " CONNECT SET POSTION " << oendl; | 205 | odebug << " CONNECT SET POSTION " << oendl; |
206 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); | 206 | connect( &mediaPlayerState, SIGNAL( positionChanged(long) ),this, SLOT( setPosition(long) ) ); |
207 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); | 207 | connect( &mediaPlayerState, SIGNAL( positionUpdated(long) ),this, SLOT( setPosition(long) ) ); |
208 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 208 | connect( &slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
209 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 209 | connect( &slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | 212 | ||
213 | 213 | ||
214 | static QString timeAsString( long length ) { | 214 | static QString timeAsString( long length ) { |
215 | int minutes = length / 60; | 215 | int minutes = length / 60; |
216 | int seconds = length % 60; | 216 | int seconds = length % 60; |
217 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); | 217 | return QString("%1:%2%3").arg( minutes ).arg( seconds / 10 ).arg( seconds % 10 ); |
218 | } | 218 | } |
219 | 219 | ||
220 | void AudioWidget::updateSlider( long i, long max ) { | 220 | void AudioWidget::updateSlider( long i, long max ) { |
221 | 221 | ||
222 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); | 222 | time.setText( timeAsString( i ) + " / " + timeAsString( max ) ); |
223 | // qDebug( timeAsString( i ) + " / " + timeAsString( max ) ) ; | 223 | // odebug << timeAsString( i ) << " / " << timeAsString( max ) << oendl; |
224 | 224 | ||
225 | if ( max == 0 ) { | 225 | if ( max == 0 ) { |
226 | return; | 226 | return; |
227 | } | 227 | } |
228 | // Will flicker too much if we don't do this | 228 | // Will flicker too much if we don't do this |
229 | // Scale to something reasonable | 229 | // Scale to something reasonable |
230 | int width = slider.width(); | 230 | int width = slider.width(); |
231 | int val = int((double)i * width / max); | 231 | int val = int((double)i * width / max); |
232 | if ( !audioSliderBeingMoved ) { | 232 | if ( !audioSliderBeingMoved ) { |
233 | if ( slider.value() != val ) { | 233 | if ( slider.value() != val ) { |
234 | slider.setValue( val ); | 234 | slider.setValue( val ); |
235 | } | 235 | } |
236 | 236 | ||
237 | if ( slider.maxValue() != width ) { | 237 | if ( slider.maxValue() != width ) { |
238 | slider.setMaxValue( width ); | 238 | slider.setMaxValue( width ); |
239 | } | 239 | } |
240 | } | 240 | } |
241 | } | 241 | } |
242 | 242 | ||
243 | void AudioWidget::skipFor() { | 243 | void AudioWidget::skipFor() { |
244 | skipDirection = +1; | 244 | skipDirection = +1; |
245 | startTimer( 50 ); | 245 | startTimer( 50 ); |
246 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); | 246 | mediaPlayerState.setPosition( mediaPlayerState.position() + 2 ); |
247 | } | 247 | } |
diff --git a/noncore/multimedia/opierec/qtrec.cpp b/noncore/multimedia/opierec/qtrec.cpp index 6eb6524..3b8cb0d 100644 --- a/noncore/multimedia/opierec/qtrec.cpp +++ b/noncore/multimedia/opierec/qtrec.cpp | |||
@@ -100,52 +100,51 @@ typedef struct { | |||
100 | int outVol; //output volume | 100 | int outVol; //output volume |
101 | int format; //wavfile format PCM.. ADPCM | 101 | int format; //wavfile format PCM.. ADPCM |
102 | const char *fileName; //name of fiel to be played/recorded | 102 | const char *fileName; //name of fiel to be played/recorded |
103 | } fileParameters; | 103 | } fileParameters; |
104 | 104 | ||
105 | fileParameters filePara; | 105 | fileParameters filePara; |
106 | 106 | ||
107 | bool monitoring, recording, playing; | 107 | bool monitoring, recording, playing; |
108 | bool stopped; | 108 | bool stopped; |
109 | QLabel *timeLabel; | 109 | QLabel *timeLabel; |
110 | QSlider *timeSlider; | 110 | QSlider *timeSlider; |
111 | int sd; | 111 | int sd; |
112 | 112 | ||
113 | Waveform* waveform; | 113 | Waveform* waveform; |
114 | Device *soundDevice; | 114 | Device *soundDevice; |
115 | 115 | ||
116 | 116 | ||
117 | #ifdef THREADED | 117 | #ifdef THREADED |
118 | void quickRec() | 118 | void quickRec() |
119 | #else | 119 | #else |
120 | void QtRec::quickRec() | 120 | void QtRec::quickRec() |
121 | #endif | 121 | #endif |
122 | { | 122 | { |
123 | 123 | ||
124 | qDebug("%d", | 124 | odebug << ( filePara.numberSamples/filePara.sampleRate * filePara.channels ) << oendl; |
125 | filePara.numberSamples/filePara.sampleRate * filePara.channels); | 125 | odebug << "samples " << filePara.numberSamples << ", rate " << filePara.sampleRate |
126 | qDebug("samples %d, rate %d, channels %d", | 126 | << ", channels " << filePara.channels << oendl; |
127 | filePara.numberSamples, filePara.sampleRate, filePara.channels); | ||
128 | 127 | ||
129 | int total = 0; // Total number of bytes read in so far. | 128 | int total = 0; // Total number of bytes read in so far. |
130 | int bytesWritten, number; | 129 | int bytesWritten, number; |
131 | 130 | ||
132 | bytesWritten = 0; | 131 | bytesWritten = 0; |
133 | number = 0; | 132 | number = 0; |
134 | QString num; | 133 | QString num; |
135 | int level = 0; | 134 | int level = 0; |
136 | int threshold = 0; | 135 | int threshold = 0; |
137 | // int bits = filePara.resolution; | 136 | // int bits = filePara.resolution; |
138 | // odebug << "bits " << bits << "" << oendl; | 137 | // odebug << "bits " << bits << "" << oendl; |
139 | 138 | ||
140 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) | 139 | if( filePara.resolution == 16 ) { //AFMT_S16_LE) |
141 | // odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; | 140 | // odebug << "AFMT_S16_LE size " << filePara.SecondsToRecord << "" << oendl; |
142 | // odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; | 141 | // odebug << "samples to record " << filePara.samplesToRecord << "" << oendl; |
143 | // odebug << "" << filePara.sd << "" << oendl; | 142 | // odebug << "" << filePara.sd << "" << oendl; |
144 | level = 7; | 143 | level = 7; |
145 | threshold = 0; | 144 | threshold = 0; |
146 | 145 | ||
147 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { | 146 | if( filePara.format == WAVE_FORMAT_DVI_ADPCM) { |
148 | // odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; | 147 | // odebug << "start recording WAVE_FORMAT_DVI_ADPCM" << oendl; |
149 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> | 148 | // <<<<<<<<<<<<<<<<<<<<<<<<<<< WAVE_FORMAT_DVI_ADPCM >>>>>>>>>>>>>>>>>>>>>> |
150 | char abuf[ BUFSIZE/2 ]; | 149 | char abuf[ BUFSIZE/2 ]; |
151 | short sbuf[ BUFSIZE ]; | 150 | short sbuf[ BUFSIZE ]; |
@@ -898,75 +897,74 @@ void QtRec::start() { //play | |||
898 | if( openPlayFile()) | 897 | if( openPlayFile()) |
899 | if( setupAudio( false)) //recording is false | 898 | if( setupAudio( false)) //recording is false |
900 | doPlay(); | 899 | doPlay(); |
901 | } | 900 | } |
902 | } | 901 | } |
903 | 902 | ||
904 | bool QtRec::rec() { //record | 903 | bool QtRec::rec() { //record |
905 | QString timeString; | 904 | QString timeString; |
906 | timeString.sprintf("%.0f", 0.0); | 905 | timeString.sprintf("%.0f", 0.0); |
907 | timeLabel->setText( timeString+ " seconds"); | 906 | timeLabel->setText( timeString+ " seconds"); |
908 | if(!stopped) { | 907 | if(!stopped) { |
909 | monitoring = true; | 908 | monitoring = true; |
910 | return false; | 909 | return false; |
911 | } else { | 910 | } else { |
912 | secCount = 1; | 911 | secCount = 1; |
913 | playLabel2->setText(tr("Stop")); | 912 | playLabel2->setText(tr("Stop")); |
914 | monitoring = false; | 913 | monitoring = false; |
915 | setRecordButton( true); | 914 | setRecordButton( true); |
916 | 915 | ||
917 | if( setupAudio( true)) | 916 | if( setupAudio( true)) |
918 | if(setUpFile()) { | 917 | if(setUpFile()) { |
919 | int fileSize = 0; | 918 | int fileSize = 0; |
920 | Config cfg("OpieRec"); | 919 | Config cfg("OpieRec"); |
921 | cfg.setGroup("Settings"); | 920 | cfg.setGroup("Settings"); |
922 | // qDebug( "<<<<<<<Device bits %d, device rate %d, device channels %d", | 921 | // odebug << "<<<<<<<Device bits " << soundDevice->getDeviceBits() |
923 | // soundDevice->getDeviceBits(), | 922 | // << ", device rate " << soundDevice->getDeviceRate() |
924 | // soundDevice->getDeviceRate(), | 923 | // << ", device channels " << soundDevice->getDeviceChannels() << oendl; |
925 | // soundDevice->getDeviceChannels()); | ||
926 | 924 | ||
927 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); | 925 | //filePara.sampleRate = cfg.readNumEntry("samplerate", 22050); |
928 | // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; | 926 | // odebug << "sample rate is " << filePara.sampleRate << "" << oendl; |
929 | filePara.SecondsToRecord = getCurrentSizeLimit(); | 927 | filePara.SecondsToRecord = getCurrentSizeLimit(); |
930 | 928 | ||
931 | // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; | 929 | // odebug << "size limit " << filePara.SecondsToRecord << " sec" << oendl; |
932 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); | 930 | int diskSize = checkDiskSpace( (const QString &) wavFile->trackName()); |
933 | 931 | ||
934 | if( filePara.SecondsToRecord == 0) { | 932 | if( filePara.SecondsToRecord == 0) { |
935 | fileSize = diskSize; | 933 | fileSize = diskSize; |
936 | } else if( filePara.format == WAVE_FORMAT_PCM) { | 934 | } else if( filePara.format == WAVE_FORMAT_PCM) { |
937 | // odebug << "WAVE_FORMAT_PCM" << oendl; | 935 | // odebug << "WAVE_FORMAT_PCM" << oendl; |
938 | fileSize = (filePara.SecondsToRecord ) * filePara.channels | 936 | fileSize = (filePara.SecondsToRecord ) * filePara.channels |
939 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; | 937 | * filePara.sampleRate * ( filePara.resolution / 8) + 1000; |
940 | } else { | 938 | } else { |
941 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; | 939 | // odebug << "WAVE_FORMAT_DVI_ADPCM" << oendl; |
942 | fileSize = ((filePara.SecondsToRecord) * filePara.channels | 940 | fileSize = ((filePara.SecondsToRecord) * filePara.channels |
943 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; | 941 | * filePara.sampleRate * ( filePara.resolution / 8) ) / 4 + 250; |
944 | } | 942 | } |
945 | 943 | ||
946 | filePara.samplesToRecord = fileSize; | 944 | filePara.samplesToRecord = fileSize; |
947 | qDebug("filesize should be %d, bits %d, rate %d", | 945 | odebug << "filesize should be " << filePara.samplesToRecord |
948 | filePara.samplesToRecord, filePara.resolution, filePara.sampleRate); | 946 | << ", bits " << filePara.resolution << ", rate " << filePara.sampleRate; |
949 | if( paused) { | 947 | if( paused) { |
950 | paused = false; | 948 | paused = false; |
951 | } | 949 | } |
952 | // else { | 950 | // else { |
953 | odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; | 951 | odebug << "Setting timeslider " << filePara.samplesToRecord << "" << oendl; |
954 | // if(fileSize != 0) | 952 | // if(fileSize != 0) |
955 | timeSlider->setRange(0, filePara.samplesToRecord); | 953 | timeSlider->setRange(0, filePara.samplesToRecord); |
956 | // } | 954 | // } |
957 | 955 | ||
958 | if( diskSize < fileSize/1024) { | 956 | if( diskSize < fileSize/1024) { |
959 | QMessageBox::warning(this, | 957 | QMessageBox::warning(this, |
960 | tr("Low Disk Space"), | 958 | tr("Low Disk Space"), |
961 | tr("You are running low of\nrecording space\n" | 959 | tr("You are running low of\nrecording space\n" |
962 | "or a card isn't being recognized")); | 960 | "or a card isn't being recognized")); |
963 | stopped = true; //we need to be stopped | 961 | stopped = true; //we need to be stopped |
964 | stop(); | 962 | stop(); |
965 | } else { | 963 | } else { |
966 | QString msg; | 964 | QString msg; |
967 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); | 965 | msg.sprintf("%d, %d, %d", filePara.sampleRate, filePara.channels, filePara.resolution); |
968 | #ifdef DEV_VERSION | 966 | #ifdef DEV_VERSION |
969 | setCaption( msg); | 967 | setCaption( msg); |
970 | #endif | 968 | #endif |
971 | filePara.fileName=currentFile.latin1(); | 969 | filePara.fileName=currentFile.latin1(); |
972 | odebug << "Start recording thread" << oendl; | 970 | odebug << "Start recording thread" << oendl; |
diff --git a/noncore/multimedia/opierec/wavFile.cpp b/noncore/multimedia/opierec/wavFile.cpp index 7e9b50f..fc0130c 100644 --- a/noncore/multimedia/opierec/wavFile.cpp +++ b/noncore/multimedia/opierec/wavFile.cpp | |||
@@ -131,50 +131,51 @@ bool WavFile::setWavHeader(int fd, wavhdr *hdr) { | |||
131 | strncpy((*hdr).wavID, "WAVE", 4); //WAVE | 131 | strncpy((*hdr).wavID, "WAVE", 4); //WAVE |
132 | strncpy((*hdr).fmtID, "fmt ", 4); // fmt | 132 | strncpy((*hdr).fmtID, "fmt ", 4); // fmt |
133 | (*hdr).fmtLen = 16; // format length = 16 | 133 | (*hdr).fmtLen = 16; // format length = 16 |
134 | 134 | ||
135 | if( wavFormat == WAVE_FORMAT_PCM) { | 135 | if( wavFormat == WAVE_FORMAT_PCM) { |
136 | (*hdr).fmtTag = 1; // PCM | 136 | (*hdr).fmtTag = 1; // PCM |
137 | // odebug << "set header WAVE_FORMAT_PCM" << oendl; | 137 | // odebug << "set header WAVE_FORMAT_PCM" << oendl; |
138 | } | 138 | } |
139 | else { | 139 | else { |
140 | (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM | 140 | (*hdr).fmtTag = WAVE_FORMAT_DVI_ADPCM; //intel ADPCM |
141 | // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; | 141 | // odebug << "set header WAVE_FORMAT_DVI_ADPCM" << oendl; |
142 | } | 142 | } |
143 | 143 | ||
144 | // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels | 144 | // (*hdr).nChannels = 1;//filePara.channels;// ? 2 : 1*/; // channels |
145 | (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels | 145 | (*hdr).nChannels = wavChannels;// ? 2 : 1*/; // channels |
146 | 146 | ||
147 | (*hdr).sampleRate = wavSampleRate; //samples per second | 147 | (*hdr).sampleRate = wavSampleRate; //samples per second |
148 | (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second | 148 | (*hdr).avgBytesPerSec = (wavSampleRate)*( wavChannels*(wavResolution/8)); // bytes per second |
149 | (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align | 149 | (*hdr).nBlockAlign = wavChannels*( wavResolution/8); //block align |
150 | (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 | 150 | (*hdr).bitsPerSample = wavResolution; //bits per sample 8, or 16 |
151 | 151 | ||
152 | strncpy((*hdr).dataID, "data", 4); | 152 | strncpy((*hdr).dataID, "data", 4); |
153 | 153 | ||
154 | write( fd,hdr, sizeof(*hdr)); | 154 | write( fd,hdr, sizeof(*hdr)); |
155 | qDebug("writing header: bitrate%d, samplerate %d, channels %d", | 155 | odebug << "writing header: bitrate " << wavResolution |
156 | wavResolution, wavSampleRate, wavChannels); | 156 | << ", samplerate " << wavSampleRate |
157 | << ", channels " << wavChannels << oendl; | ||
157 | return true; | 158 | return true; |
158 | } | 159 | } |
159 | 160 | ||
160 | bool WavFile::adjustHeaders(int fd, int total) { | 161 | bool WavFile::adjustHeaders(int fd, int total) { |
161 | lseek(fd, 4, SEEK_SET); | 162 | lseek(fd, 4, SEEK_SET); |
162 | int i = total + 36; | 163 | int i = total + 36; |
163 | write( fd, &i, sizeof(i)); | 164 | write( fd, &i, sizeof(i)); |
164 | lseek( fd, 40, SEEK_SET); | 165 | lseek( fd, 40, SEEK_SET); |
165 | write( fd, &total, sizeof(total)); | 166 | write( fd, &total, sizeof(total)); |
166 | odebug << "adjusting header " << total << "" << oendl; | 167 | odebug << "adjusting header " << total << "" << oendl; |
167 | return true; | 168 | return true; |
168 | } | 169 | } |
169 | 170 | ||
170 | int WavFile::parseWavHeader(int fd) { | 171 | int WavFile::parseWavHeader(int fd) { |
171 | odebug << "Parsing wav header" << oendl; | 172 | odebug << "Parsing wav header" << oendl; |
172 | char string[4]; | 173 | char string[4]; |
173 | int found; | 174 | int found; |
174 | short fmt; | 175 | short fmt; |
175 | unsigned short ch, bitrate; | 176 | unsigned short ch, bitrate; |
176 | unsigned long samplerrate, longdata; | 177 | unsigned long samplerrate, longdata; |
177 | 178 | ||
178 | if (read(fd, string, 4) < 4) { | 179 | if (read(fd, string, 4) < 4) { |
179 | odebug << " Could not read from sound file.\n" << oendl; | 180 | odebug << " Could not read from sound file.\n" << oendl; |
180 | return -1; | 181 | return -1; |
@@ -191,50 +192,49 @@ int WavFile::parseWavHeader(int fd) { | |||
191 | if (strncmp(string, "WAVE", 4)) { | 192 | if (strncmp(string, "WAVE", 4)) { |
192 | odebug << "not a valid WAV file.\n" << oendl; | 193 | odebug << "not a valid WAV file.\n" << oendl; |
193 | return -1; | 194 | return -1; |
194 | } | 195 | } |
195 | found = 0; | 196 | found = 0; |
196 | 197 | ||
197 | while (!found) { | 198 | while (!found) { |
198 | if (read(fd, string, 4) < 4) { | 199 | if (read(fd, string, 4) < 4) { |
199 | odebug << "Could not read from sound file.\n" << oendl; | 200 | odebug << "Could not read from sound file.\n" << oendl; |
200 | return -1; | 201 | return -1; |
201 | } | 202 | } |
202 | if (strncmp(string, "fmt ", 4)) { | 203 | if (strncmp(string, "fmt ", 4)) { |
203 | if (read(fd, &longdata, 4) < 4) { | 204 | if (read(fd, &longdata, 4) < 4) { |
204 | odebug << "Could not read from sound file.\n" << oendl; | 205 | odebug << "Could not read from sound file.\n" << oendl; |
205 | return -1; | 206 | return -1; |
206 | } | 207 | } |
207 | lseek(fd, longdata, SEEK_CUR); | 208 | lseek(fd, longdata, SEEK_CUR); |
208 | } else { | 209 | } else { |
209 | lseek(fd, 4, SEEK_CUR); | 210 | lseek(fd, 4, SEEK_CUR); |
210 | if (read(fd, &fmt, 2) < 2) { | 211 | if (read(fd, &fmt, 2) < 2) { |
211 | odebug << "Could not read format chunk.\n" << oendl; | 212 | odebug << "Could not read format chunk.\n" << oendl; |
212 | return -1; | 213 | return -1; |
213 | } | 214 | } |
214 | if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { | 215 | if (fmt != WAVE_FORMAT_PCM && fmt != WAVE_FORMAT_DVI_ADPCM) { |
215 | qDebug("Wave file contains unknown format." | 216 | odebug << "Wave file contains unknown format. Unable to continue.\n" << oendl; |
216 | " Unable to continue.\n"); | ||
217 | return -1; | 217 | return -1; |
218 | } | 218 | } |
219 | wavFormat = fmt; | 219 | wavFormat = fmt; |
220 | // compressionFormat=fmt; | 220 | // compressionFormat=fmt; |
221 | odebug << "compressionFormat is " << fmt << "" << oendl; | 221 | odebug << "compressionFormat is " << fmt << "" << oendl; |
222 | if (read(fd, &ch, 2) < 2) { | 222 | if (read(fd, &ch, 2) < 2) { |
223 | odebug << "Could not read format chunk.\n" << oendl; | 223 | odebug << "Could not read format chunk.\n" << oendl; |
224 | return -1; | 224 | return -1; |
225 | } else { | 225 | } else { |
226 | wavChannels = ch; | 226 | wavChannels = ch; |
227 | odebug << "File has " << ch << " channels" << oendl; | 227 | odebug << "File has " << ch << " channels" << oendl; |
228 | } | 228 | } |
229 | if (read(fd, &samplerrate, 4) < 4) { | 229 | if (read(fd, &samplerrate, 4) < 4) { |
230 | odebug << "Could not read from format chunk.\n" << oendl; | 230 | odebug << "Could not read from format chunk.\n" << oendl; |
231 | return -1; | 231 | return -1; |
232 | } else { | 232 | } else { |
233 | wavSampleRate = samplerrate; | 233 | wavSampleRate = samplerrate; |
234 | // sampleRate = samplerrate; | 234 | // sampleRate = samplerrate; |
235 | odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; | 235 | odebug << "File has samplerate of " << (int) samplerrate << "" << oendl; |
236 | } | 236 | } |
237 | lseek(fd, 6, SEEK_CUR); | 237 | lseek(fd, 6, SEEK_CUR); |
238 | if (read(fd, &bitrate, 2) < 2) { | 238 | if (read(fd, &bitrate, 2) < 2) { |
239 | odebug << "Could not read format chunk.\n" << oendl; | 239 | odebug << "Could not read format chunk.\n" << oendl; |
240 | return -1; | 240 | return -1; |
@@ -245,50 +245,52 @@ int WavFile::parseWavHeader(int fd) { | |||
245 | } | 245 | } |
246 | found++; | 246 | found++; |
247 | } | 247 | } |
248 | } | 248 | } |
249 | found = 0; | 249 | found = 0; |
250 | while (!found) { | 250 | while (!found) { |
251 | if (read(fd, string, 4) < 4) { | 251 | if (read(fd, string, 4) < 4) { |
252 | odebug << "Could not read from sound file.\n" << oendl; | 252 | odebug << "Could not read from sound file.\n" << oendl; |
253 | return -1; | 253 | return -1; |
254 | } | 254 | } |
255 | 255 | ||
256 | if (strncmp(string, "data", 4)) { | 256 | if (strncmp(string, "data", 4)) { |
257 | if (read(fd, &longdata, 4)<4) { | 257 | if (read(fd, &longdata, 4)<4) { |
258 | odebug << "Could not read from sound file.\n" << oendl; | 258 | odebug << "Could not read from sound file.\n" << oendl; |
259 | return -1; | 259 | return -1; |
260 | } | 260 | } |
261 | 261 | ||
262 | lseek(fd, longdata, SEEK_CUR); | 262 | lseek(fd, longdata, SEEK_CUR); |
263 | } else { | 263 | } else { |
264 | if (read(fd, &longdata, 4) < 4) { | 264 | if (read(fd, &longdata, 4) < 4) { |
265 | odebug << "Could not read from sound file.\n" << oendl; | 265 | odebug << "Could not read from sound file.\n" << oendl; |
266 | return -1; | 266 | return -1; |
267 | } else { | 267 | } else { |
268 | wavNumberSamples = longdata; | 268 | wavNumberSamples = longdata; |
269 | qDebug("file has length of %d \nlasting %d seconds", (int)longdata, | 269 | odebug << "file hase length of " << (int)longdata << "\n" |
270 | (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) ); | 270 | << "lasting " |
271 | << (int)(( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)) | ||
272 | << " seconds" << oendl; | ||
271 | // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); | 273 | // wavSeconds = (( longdata / wavSampleRate) / wavChannels) / ( wavChannels*( wavResolution/8)); |
272 | 274 | ||
273 | return longdata; | 275 | return longdata; |
274 | } | 276 | } |
275 | } | 277 | } |
276 | } | 278 | } |
277 | 279 | ||
278 | lseek(fd, 0, SEEK_SET); | 280 | lseek(fd, 0, SEEK_SET); |
279 | 281 | ||
280 | return 0; | 282 | return 0; |
281 | } | 283 | } |
282 | 284 | ||
283 | QString WavFile::trackName() { | 285 | QString WavFile::trackName() { |
284 | return track.name(); | 286 | return track.name(); |
285 | } | 287 | } |
286 | 288 | ||
287 | int WavFile::wavHandle(){ | 289 | int WavFile::wavHandle(){ |
288 | return track.handle(); | 290 | return track.handle(); |
289 | } | 291 | } |
290 | 292 | ||
291 | int WavFile::getFormat() { | 293 | int WavFile::getFormat() { |
292 | return wavFormat; | 294 | return wavFormat; |
293 | } | 295 | } |
294 | 296 | ||