summaryrefslogtreecommitdiff
path: root/core
authorllornkcor <llornkcor>2002-06-17 23:09:38 (UTC)
committer llornkcor <llornkcor>2002-06-17 23:09:38 (UTC)
commit554f88d0e8839bd6112fa42139a967712552e519 (patch) (unidiff)
treed90788c9247f35ee10a1cdd8df0408b1df2a7e57 /core
parent28400a31238af793fe235a0c8d13131eb823037d (diff)
downloadopie-554f88d0e8839bd6112fa42139a967712552e519.zip
opie-554f88d0e8839bd6112fa42139a967712552e519.tar.gz
opie-554f88d0e8839bd6112fa42139a967712552e519.tar.bz2
fixed volume fix
Diffstat (limited to 'core') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/audiodevice.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/core/multimedia/opieplayer/audiodevice.cpp b/core/multimedia/opieplayer/audiodevice.cpp
index 4c5f12d..faadd72 100644
--- a/core/multimedia/opieplayer/audiodevice.cpp
+++ b/core/multimedia/opieplayer/audiodevice.cpp
@@ -149,51 +149,51 @@ void AudioDevice::setVolume( unsigned int leftVolume, unsigned int rightVolume,
149// formatData.wBitsPerSample = 16; 149// formatData.wBitsPerSample = 16;
150// waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL); 150// waveOutOpen(&handle, WAVE_MAPPER, &formatData, 0L, 0L, CALLBACK_NULL);
151// unsigned int volume = (rightVolume << 16) | leftVolume; 151// unsigned int volume = (rightVolume << 16) | leftVolume;
152// if ( waveOutSetVolume( handle, volume ) ) 152// if ( waveOutSetVolume( handle, volume ) )
153// // qDebug( "set volume of audio device failed" ); 153// // qDebug( "set volume of audio device failed" );
154// waveOutClose( handle ); 154// waveOutClose( handle );
155// #else 155// #else
156 // Volume can be from 0 to 100 which is 101 distinct values 156 // Volume can be from 0 to 100 which is 101 distinct values
157 unsigned int rV = (rightVolume * 101) >> 16; 157 unsigned int rV = (rightVolume * 101) >> 16;
158 158
159# if 0 159# if 0
160 unsigned int lV = (leftVolume * 101) >> 16; 160 unsigned int lV = (leftVolume * 101) >> 16;
161 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF); 161 unsigned int volume = ((rV << 8) & 0xFF00) | (lV & 0x00FF);
162 int mixerHandle = 0; 162 int mixerHandle = 0;
163 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) { 163 if ( ( mixerHandle = open( "/dev/mixer", O_RDWR ) ) >= 0 ) {
164 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1) 164 if(ioctl( mixerHandle, MIXER_WRITE(0), &volume ) ==-1)
165 perror("ioctl(\"MIXER_WRITE\")"); 165 perror("ioctl(\"MIXER_WRITE\")");
166 close( mixerHandle ); 166 close( mixerHandle );
167 } else 167 } else
168 perror("open(\"/dev/mixer\")"); 168 perror("open(\"/dev/mixer\")");
169 169
170# else 170# else
171 // This is the way this has to be done now I guess, doesn't allow for 171 // This is the way this has to be done now I guess, doesn't allow for
172 // independant right and left channel setting, or setting for different outputs 172 // independant right and left channel setting, or setting for different outputs
173 Config cfg("Sound"); 173 Config cfg("qpe"); // qtopia is "Sound"
174 cfg.setGroup("System"); 174 cfg.setGroup("Volume"); // qtopia is "Settings"
175 cfg.writeEntry("Volume",(int)rV); 175 cfg.writeEntry("VolumePercent",(int)rV); //qtopia is Volume
176# endif 176# endif
177 177
178//#endif 178//#endif
179// qDebug( "setting volume to: 0x%x", volume ); 179// qDebug( "setting volume to: 0x%x", volume );
180#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP) 180#if ( defined Q_WS_QWS || defined(_WS_QWS_) ) && !defined(QT_NO_COP)
181 // Send notification that the volume has changed 181 // Send notification that the volume has changed
182 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted; 182 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << muted;
183#endif 183#endif
184} 184}
185 185
186 186
187 187
188 188
189AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) { 189AudioDevice::AudioDevice( unsigned int f, unsigned int chs, unsigned int bps ) {
190 qDebug("creating new audio device"); 190 qDebug("creating new audio device");
191 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE; 191 QCopEnvelope( "QPE/System", "volumeChange(bool)" ) << TRUE;
192 d = new AudioDevicePrivate; 192 d = new AudioDevicePrivate;
193 d->frequency = f; 193 d->frequency = f;
194 d->channels = chs; 194 d->channels = chs;
195 d->bytesPerSample = bps; 195 d->bytesPerSample = bps;
196 qDebug("%d",bps); 196 qDebug("%d",bps);
197 int format=0; 197 int format=0;
198 if( bps == 8) format = AFMT_U8; 198 if( bps == 8) format = AFMT_U8;
199 else if( bps <= 0) format = AFMT_S16_LE; 199 else if( bps <= 0) format = AFMT_S16_LE;