Diffstat (limited to 'core/multimedia/opieplayer/audiodevice.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/audiodevice.cpp | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp index 6a38fc9..d296d27 100644 --- a/core/multimedia/opieplayer/audiodevice.cpp +++ b/core/multimedia/opieplayer/audiodevice.cpp | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <stdio.h> | 24 | #include <stdio.h> |
25 | #include <qpe/qpeapplication.h> | 25 | #include <qpe/qpeapplication.h> |
26 | #include <qpe/config.h> | 26 | #include <qpe/config.h> |
27 | #include <qpe/custom.h> | ||
27 | #include <qmessagebox.h> | 28 | #include <qmessagebox.h> |
28 | 29 | ||
29 | #include "audiodevice.h" | 30 | #include "audiodevice.h" |
@@ -31,8 +32,8 @@ | |||
31 | 32 | ||
32 | #include <errno.h> | 33 | #include <errno.h> |
33 | 34 | ||
34 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 35 | #if !defined(QT_NO_COP) |
35 | #include "qpe/qcopenvelope_qws.h" | 36 | #include <qpe/qcopenvelope_qws.h> |
36 | #endif | 37 | #endif |
37 | 38 | ||
38 | #if defined(Q_WS_X11) || defined(Q_WS_QWS) | 39 | #if defined(Q_WS_X11) || defined(Q_WS_QWS) |
@@ -45,11 +46,11 @@ | |||
45 | #include <unistd.h> | 46 | #include <unistd.h> |
46 | #endif | 47 | #endif |
47 | 48 | ||
48 | # if defined(QT_QWS_IPAQ) | 49 | #ifdef OPIE_SOUND_FRAGMENT_SHIFT |
49 | static const int sound_fragment_shift = 14; | 50 | static const int sound_fragment_shift = OPIE_SOUND_FRAGMENT_SHIFT; |
50 | # else | 51 | #else |
51 | static const int sound_fragment_shift = 16; | 52 | static const int sound_fragment_shift = 16; |
52 | # endif | 53 | #endif |
53 | static const int sound_fragment_bytes = (1<<sound_fragment_shift); | 54 | static const int sound_fragment_bytes = (1<<sound_fragment_shift); |
54 | //#endif | 55 | //#endif |
55 | 56 | ||
@@ -145,10 +146,10 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
145 | # endif | 146 | # endif |
146 | 147 | ||
147 | //#endif | 148 | //#endif |
148 | // qDebug( "setting volume to: 0x%x", volume ); | 149 | // qDebug( "setting volume to: 0x%x", volume ); |
149 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) | 150 | #if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) |
150 | // Send notification that the volume has changed | 151 | // Send notification that the volume has changed |
151 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; | 152 | QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; |
152 | #endif | 153 | #endif |
153 | } | 154 | } |
154 | 155 | ||
@@ -156,7 +157,7 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume, | |||
156 | 157 | ||
157 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | 158 | AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { |
158 | // qDebug("creating new audio device"); | 159 | // qDebug("creating new audio device"); |
159 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | 160 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; |
160 | d = new AudioDevicePrivate; | 161 | d = new AudioDevicePrivate; |
161 | d->frequency = f; | 162 | d->frequency = f; |
162 | d->channels = chs; | 163 | d->channels = chs; |
@@ -172,7 +173,7 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
172 | int fragments = 0x10000 * 8 + sound_fragment_shift; | 173 | int fragments = 0x10000 * 8 + sound_fragment_shift; |
173 | int capabilities = 0; | 174 | int capabilities = 0; |
174 | 175 | ||
175 | 176 | ||
176 | #ifdef KEEP_DEVICE_OPEN | 177 | #ifdef KEEP_DEVICE_OPEN |
177 | if ( AudioDevicePrivate::dspFd == 0 ) { | 178 | if ( AudioDevicePrivate::dspFd == 0 ) { |
178 | #endif | 179 | #endif |
@@ -187,7 +188,7 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
187 | QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort")); | 188 | QMessageBox::critical(0, "Vmemo", errorMsg, tr("Abort")); |
188 | exit(-1); //harsh? | 189 | exit(-1); //harsh? |
189 | } | 190 | } |
190 | #ifdef KEEP_DEVICE_OPEN | 191 | #ifdef KEEP_DEVICE_OPEN |
191 | AudioDevicePrivate::dspFd = d->handle; | 192 | AudioDevicePrivate::dspFd = d->handle; |
192 | } else { | 193 | } else { |
193 | d->handle = AudioDevicePrivate::dspFd; | 194 | d->handle = AudioDevicePrivate::dspFd; |
@@ -209,34 +210,34 @@ AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { | |||
209 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) | 210 | if(ioctl( d->handle, SNDCTL_DSP_CHANNELS, &d->channels )==-1) |
210 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); | 211 | perror("ioctl(\"SNDCTL_DSP_CHANNELS\")"); |
211 | } | 212 | } |
212 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; | 213 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; |
213 | 214 | ||
214 | d->bufferSize = sound_fragment_bytes; | 215 | d->bufferSize = sound_fragment_bytes; |
215 | d->unwrittenBuffer = new char[d->bufferSize]; | 216 | d->unwrittenBuffer = new char[d->bufferSize]; |
216 | d->unwritten = 0; | 217 | d->unwritten = 0; |
217 | d->can_GETOSPACE = TRUE; // until we find otherwise | 218 | d->can_GETOSPACE = TRUE; // until we find otherwise |
218 | 219 | ||
219 | //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); | 220 | //if ( chs != d->channels ) qDebug( "Wanted %d, got %d channels", chs, d->channels ); |
220 | //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); | 221 | //if ( f != d->frequency ) qDebug( "wanted %dHz, got %dHz", f, d->frequency ); |
221 | //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); | 222 | //if ( capabilities & DSP_CAP_BATCH ) qDebug( "Sound card has local buffer" ); |
222 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); | 223 | //if ( capabilities & DSP_CAP_REALTIME )qDebug( "Sound card has realtime sync" ); |
223 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); | 224 | //if ( capabilities & DSP_CAP_TRIGGER ) qDebug( "Sound card has precise trigger" ); |
224 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); | 225 | //if ( capabilities & DSP_CAP_MMAP ) qDebug( "Sound card can mmap" ); |
225 | 226 | ||
226 | } | 227 | } |
227 | 228 | ||
228 | 229 | ||
229 | AudioDevice::~AudioDevice() { | 230 | AudioDevice::~AudioDevice() { |
230 | // qDebug("destryo audiodevice"); | 231 | // qDebug("destryo audiodevice"); |
231 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; | 232 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; |
232 | 233 | ||
233 | # ifndef KEEP_DEVICE_OPEN | 234 | # ifndef KEEP_DEVICE_OPEN |
234 | close( d->handle ); // Now it should be safe to shut the handle | 235 | close( d->handle ); // Now it should be safe to shut the handle |
235 | # endif | 236 | # endif |
236 | delete d->unwrittenBuffer; | 237 | delete d->unwrittenBuffer; |
237 | delete d; | 238 | delete d; |
238 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; | 239 | // QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << FALSE; |
239 | 240 | ||
240 | } | 241 | } |
241 | 242 | ||
242 | 243 | ||