summaryrefslogtreecommitdiff
path: root/libopie2/opiemm
Unidiff
Diffstat (limited to 'libopie2/opiemm') (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/libopiemm2.control2
-rw-r--r--libopie2/opiemm/osoundsystem.cpp2
-rw-r--r--libopie2/opiemm/osoundsystem.h1
3 files changed, 1 insertions, 4 deletions
diff --git a/libopie2/opiemm/libopiemm2.control b/libopie2/opiemm/libopiemm2.control
index d0f34a8..0dd2df2 100644
--- a/libopie2/opiemm/libopiemm2.control
+++ b/libopie2/opiemm/libopiemm2.control
@@ -1,10 +1,10 @@
1Package: libopiemm2 1Package: libopiemm2
2Files: lib/libopiemm2.so.* 2Files: lib/libopiemm2.so.*
3Priority: optional 3Priority: optional
4Section: opie/system 4Section: opie/system
5Maintainer: Opie Team <opie@handhelds.org> 5Maintainer: Opie Team <opie@handhelds.org>
6Architecture: arm 6Architecture: arm
7Version: 1.8.2-$SUB_VERSION.2 7Version: $QPE_VERSION$EXTRAVERSION
8Depends: libqpe1, libopiecore2 (1.8.2) 8Depends: libqpe1, libopiecore2 (1.8.2)
9Provides: libopiemm2 9Provides: libopiemm2
10Description: Opie library 2.0 MM 10Description: Opie library 2.0 MM
diff --git a/libopie2/opiemm/osoundsystem.cpp b/libopie2/opiemm/osoundsystem.cpp
index 17e5cb0..13b26e6 100644
--- a/libopie2/opiemm/osoundsystem.cpp
+++ b/libopie2/opiemm/osoundsystem.cpp
@@ -257,66 +257,64 @@ QStringList OMixerInterface::allChannels() const
257 channels += it.key(); 257 channels += it.key();
258 it++; 258 it++;
259 } 259 }
260 return channels; 260 return channels;
261} 261}
262 262
263 263
264QStringList OMixerInterface::recChannels() const 264QStringList OMixerInterface::recChannels() const
265{ 265{
266 owarn << "NYI" << oendl; 266 owarn << "NYI" << oendl;
267 return QStringList(); 267 return QStringList();
268} 268}
269 269
270 270
271QStringList OMixerInterface::playChannels() const 271QStringList OMixerInterface::playChannels() const
272{ 272{
273 owarn << "NYI" << oendl; 273 owarn << "NYI" << oendl;
274 return QStringList(); 274 return QStringList();
275} 275}
276 276
277 277
278bool OMixerInterface::hasChannel( const QString& channel ) 278bool OMixerInterface::hasChannel( const QString& channel )
279{ 279{
280 return _channels.contains( channel ); 280 return _channels.contains( channel );
281} 281}
282 282
283 283
284void OMixerInterface::setVolume( const QString& channel, int left, int right ) 284void OMixerInterface::setVolume( const QString& channel, int left, int right )
285{ 285{
286 int volume = left; 286 int volume = left;
287 volume |= ( right == -1 ) ? left << 8 : right << 8; 287 volume |= ( right == -1 ) ? left << 8 : right << 8;
288 288
289 if ( _channels.contains( channel ) ) 289 if ( _channels.contains( channel ) )
290 { 290 {
291 int result = ioctl( _fd, MIXER_WRITE( _channels[channel] ), &volume ); 291 int result = ioctl( _fd, MIXER_WRITE( _channels[channel] ), &volume );
292 if ( result == -1 ) 292 if ( result == -1 )
293 { 293 {
294 owarn << "Can't set volume: " << strerror( errno ) << oendl; 294 owarn << "Can't set volume: " << strerror( errno ) << oendl;
295 } 295 }
296 else 296 else
297 { 297 {
298 if ( result & 0xff != left ) 298 if ( result & 0xff != left )
299 { 299 {
300 owarn << "Device adjusted volume from " << left << " to " << (result & 0xff) << oendl; 300 owarn << "Device adjusted volume from " << left << " to " << (result & 0xff) << oendl;
301 } 301 }
302 } 302 }
303 } 303 }
304} 304}
305 305
306 306
307int OMixerInterface::volume( const QString& channel ) const 307int OMixerInterface::volume( const QString& channel ) const
308{ 308{
309 int volume; 309 int volume;
310 310
311 if ( _channels.contains( channel ) ) 311 if ( _channels.contains( channel ) )
312 { 312 {
313 if ( ioctl( _fd, MIXER_READ( _channels[channel] ), &volume ) == -1 ) 313 if ( ioctl( _fd, MIXER_READ( _channels[channel] ), &volume ) == -1 )
314 { 314 {
315 owarn << "Can't get volume: " << strerror( errno ) << oendl; 315 owarn << "Can't get volume: " << strerror( errno ) << oendl;
316 } 316 }
317 else return volume; 317 else return volume;
318 } 318 }
319 return -1; 319 return -1;
320} 320}
321
322
diff --git a/libopie2/opiemm/osoundsystem.h b/libopie2/opiemm/osoundsystem.h
index 3c3b622..bd69114 100644
--- a/libopie2/opiemm/osoundsystem.h
+++ b/libopie2/opiemm/osoundsystem.h
@@ -169,65 +169,64 @@ class OAudioInterface : public QObject
169 *======================================================================================*/ 169 *======================================================================================*/
170 170
171class OMixerInterface : public QObject 171class OMixerInterface : public QObject
172{ 172{
173 Q_OBJECT 173 Q_OBJECT
174 174
175 public: 175 public:
176 176
177 typedef QMap<QString,int>::ConstIterator ChannelIterator; 177 typedef QMap<QString,int>::ConstIterator ChannelIterator;
178 178
179 /** 179 /**
180 * Constructor. Normally you don't create @ref OMixerInterface objects yourself, 180 * Constructor. Normally you don't create @ref OMixerInterface objects yourself,
181 * but access them via the @ref OSoundCard interface. 181 * but access them via the @ref OSoundCard interface.
182 */ 182 */
183 OMixerInterface( QObject* parent, const char* name ); 183 OMixerInterface( QObject* parent, const char* name );
184 /** 184 /**
185 * Destructor. 185 * Destructor.
186 */ 186 */
187 virtual ~OMixerInterface(); 187 virtual ~OMixerInterface();
188 188
189 /** 189 /**
190 * @returns all available channels. 190 * @returns all available channels.
191 */ 191 */
192 QStringList allChannels() const; 192 QStringList allChannels() const;
193 /** 193 /**
194 * @returns recordable channels. 194 * @returns recordable channels.
195 */ 195 */
196 QStringList recChannels() const; 196 QStringList recChannels() const;
197 /** 197 /**
198 * @returns playable channels. 198 * @returns playable channels.
199 */ 199 */
200 QStringList playChannels() const; 200 QStringList playChannels() const;
201 201
202 /** 202 /**
203 * @returns true, if @a channel exists. 203 * @returns true, if @a channel exists.
204 */ 204 */
205 bool hasChannel( const QString& channel ); 205 bool hasChannel( const QString& channel );
206 206
207 /** 207 /**
208 * Set the @a left and @a right volumes for @a channel. 208 * Set the @a left and @a right volumes for @a channel.
209 * If no value for right is given, the value for left is taken for that. 209 * If no value for right is given, the value for left is taken for that.
210 */ 210 */
211 void setVolume( const QString& channel, int left, int right = -1 ); 211 void setVolume( const QString& channel, int left, int right = -1 );
212 /** 212 /**
213 * @returns the volume of @a channel or -1, if the channel doesn't exist. 213 * @returns the volume of @a channel or -1, if the channel doesn't exist.
214 * @note You might want to use @ref hasChannel() to check if a channel exists. 214 * @note You might want to use @ref hasChannel() to check if a channel exists.
215 */ 215 */
216 int volume( const QString& channel ) const; 216 int volume( const QString& channel ) const;
217 217
218 protected: 218 protected:
219 int _fd; 219 int _fd;
220 QMap<QString, int> _channels; 220 QMap<QString, int> _channels;
221 221
222 private: 222 private:
223 void init(); 223 void init();
224 private: 224 private:
225 class Private; 225 class Private;
226 Private *d; 226 Private *d;
227}; 227};
228 228
229} 229}
230} 230}
231 231
232#endif // OSOUNDSYSTEM_H 232#endif // OSOUNDSYSTEM_H
233