Diffstat (limited to 'noncore/multimedia/opierec/waveform.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/multimedia/opierec/waveform.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/noncore/multimedia/opierec/waveform.cpp b/noncore/multimedia/opierec/waveform.cpp index 9cc40b4..7c9a25f 100644 --- a/noncore/multimedia/opierec/waveform.cpp +++ b/noncore/multimedia/opierec/waveform.cpp | |||
@@ -10,46 +10,50 @@ | |||
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 13 | ** |
14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 14 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
15 | ** | 15 | ** |
16 | ** Contact info@trolltech.com if any conditions of this licensing are | 16 | ** Contact info@trolltech.com if any conditions of this licensing are |
17 | ** not clear to you. | 17 | ** not clear to you. |
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | #include "waveform.h" | 20 | #include "waveform.h" |
21 | 21 | ||
22 | #include <qpainter.h> | 22 | /* OPIE */ |
23 | #include <opie2/odebug.h> | ||
24 | using namespace Opie::Core; | ||
23 | 25 | ||
26 | /* QT */ | ||
27 | #include <qpainter.h> | ||
24 | 28 | ||
25 | Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) | 29 | Waveform::Waveform( QWidget *parent, const char *name, WFlags fl ) |
26 | : QWidget( parent, name, fl ) | 30 | : QWidget( parent, name, fl ) |
27 | { | 31 | { |
28 | pixmap = 0; | 32 | pixmap = 0; |
29 | windowSize = 100; | 33 | windowSize = 100; |
30 | samplesPerPixel = 8000 / (5 * windowSize); | 34 | samplesPerPixel = 8000 / (5 * windowSize); |
31 | currentValue = 0; | 35 | currentValue = 0; |
32 | numSamples = 0; | 36 | numSamples = 0; |
33 | windowPosn = 0; | 37 | windowPosn = 0; |
34 | window = 0; | 38 | window = 0; |
35 | } | 39 | } |
36 | 40 | ||
37 | 41 | ||
38 | void Waveform::changeSettings( int frequency, int channels ) | 42 | void Waveform::changeSettings( int frequency, int channels ) |
39 | { | 43 | { |
40 | makePixmap(); | 44 | makePixmap(); |
41 | // qWarning("change waveform %d, %d", frequency, channels); | 45 | // owarn << "change waveform " << frequency << ", " << channels << "" << oendl; |
42 | samplesPerPixel = frequency * channels / (5 * windowSize); | 46 | samplesPerPixel = frequency * channels / (5 * windowSize); |
43 | qWarning("Waveform::changeSettings %d", samplesPerPixel); | 47 | owarn << "Waveform::changeSettings " << samplesPerPixel << "" << oendl; |
44 | if ( !samplesPerPixel ) | 48 | if ( !samplesPerPixel ) |
45 | samplesPerPixel = 1; | 49 | samplesPerPixel = 1; |
46 | currentValue = 0; | 50 | currentValue = 0; |
47 | numSamples = 0; | 51 | numSamples = 0; |
48 | windowPosn = 0; | 52 | windowPosn = 0; |
49 | draw(); | 53 | draw(); |
50 | } | 54 | } |
51 | 55 | ||
52 | 56 | ||
53 | Waveform::~Waveform() | 57 | Waveform::~Waveform() |
54 | { | 58 | { |
55 | if ( window ) | 59 | if ( window ) |
@@ -87,25 +91,25 @@ void Waveform::newSamples( const short *buf, int len ) | |||
87 | window[windowPosn++] = (short)(currentValue / numSamples); | 91 | window[windowPosn++] = (short)(currentValue / numSamples); |
88 | if ( windowPosn >= windowSize ) { | 92 | if ( windowPosn >= windowSize ) { |
89 | this->windowPosn = windowPosn; | 93 | this->windowPosn = windowPosn; |
90 | draw(); | 94 | draw(); |
91 | windowPosn = 0; | 95 | windowPosn = 0; |
92 | } | 96 | } |
93 | numSamples = 0; | 97 | numSamples = 0; |
94 | currentValue = 0; | 98 | currentValue = 0; |
95 | } | 99 | } |
96 | } | 100 | } |
97 | 101 | ||
98 | // Copy the final state back to the object. | 102 | // Copy the final state back to the object. |
99 | //qWarning("%d, %d, %d", currentValue, numSamples, windowPosn); | 103 | //owarn << "" << currentValue << ", " << numSamples << ", " << windowPosn << "" << oendl; |
100 | this->currentValue = currentValue; | 104 | this->currentValue = currentValue; |
101 | this->numSamples = numSamples; | 105 | this->numSamples = numSamples; |
102 | this->windowPosn = windowPosn; | 106 | this->windowPosn = windowPosn; |
103 | } | 107 | } |
104 | 108 | ||
105 | 109 | ||
106 | void Waveform::makePixmap() | 110 | void Waveform::makePixmap() |
107 | { | 111 | { |
108 | if ( !pixmap ) { | 112 | if ( !pixmap ) { |
109 | pixmap = new QPixmap( size() ); | 113 | pixmap = new QPixmap( size() ); |
110 | windowSize = pixmap->width(); | 114 | windowSize = pixmap->width(); |
111 | window = new short [windowSize]; | 115 | window = new short [windowSize]; |