summaryrefslogtreecommitdiff
Unidiff
Diffstat (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
@@ -225,98 +225,96 @@ void OMixerInterface::init()
225 if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "RecVolume", SOUND_MIXER_VOLUME ); 225 if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "RecVolume", SOUND_MIXER_VOLUME );
226 if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "RecBass", SOUND_MIXER_BASS ); 226 if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "RecBass", SOUND_MIXER_BASS );
227 if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "RecTreble", SOUND_MIXER_TREBLE ); 227 if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "RecTreble", SOUND_MIXER_TREBLE );
228 if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "RecSynth", SOUND_MIXER_SYNTH ); 228 if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "RecSynth", SOUND_MIXER_SYNTH );
229 if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "RecPCM", SOUND_MIXER_PCM ); 229 if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "RecPCM", SOUND_MIXER_PCM );
230 if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "RecSpeaker", SOUND_MIXER_SPEAKER ); 230 if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "RecSpeaker", SOUND_MIXER_SPEAKER );
231 if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "RecLine", SOUND_MIXER_LINE ); 231 if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "RecLine", SOUND_MIXER_LINE );
232 if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "RecMic", SOUND_MIXER_MIC ); 232 if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "RecMic", SOUND_MIXER_MIC );
233 if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "RecCD", SOUND_MIXER_CD ); 233 if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "RecCD", SOUND_MIXER_CD );
234 if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "RecInputMix", SOUND_MIXER_IMIX ); 234 if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "RecInputMix", SOUND_MIXER_IMIX );
235 if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "RecAltPCM", SOUND_MIXER_ALTPCM ); 235 if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "RecAltPCM", SOUND_MIXER_ALTPCM );
236 if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV ); 236 if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV );
237 if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN ); 237 if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN );
238 if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN ); 238 if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN );
239 //odebug << "recmask available and constructed." << oendl; 239 //odebug << "recmask available and constructed." << oendl;
240 } 240 }
241 241
242/* ChannelIterator it; 242/* ChannelIterator it;
243 for ( it = _channels.begin(); it != _channels.end(); ++it ) 243 for ( it = _channels.begin(); it != _channels.end(); ++it )
244 { 244 {
245 odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl; 245 odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl;
246 odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl; 246 odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl;
247 } 247 }
248*/ 248*/
249} 249}
250 250
251QStringList OMixerInterface::allChannels() const 251QStringList OMixerInterface::allChannels() const
252{ 252{
253 ChannelIterator it = _channels.begin(); 253 ChannelIterator it = _channels.begin();
254 QStringList channels; 254 QStringList channels;
255 while ( it != _channels.end() ) 255 while ( it != _channels.end() )
256 { 256 {
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
@@ -137,97 +137,96 @@ class OSoundCard : public QObject
137/*====================================================================================== 137/*======================================================================================
138 * OAudioInterface 138 * OAudioInterface
139 *======================================================================================*/ 139 *======================================================================================*/
140 140
141class OAudioInterface : public QObject 141class OAudioInterface : public QObject
142{ 142{
143 Q_OBJECT 143 Q_OBJECT
144 144
145 public: 145 public:
146 /** 146 /**
147 * Constructor. Normally you don't create @ref OAudioInterface objects yourself, 147 * Constructor. Normally you don't create @ref OAudioInterface objects yourself,
148 * but access them via the @ref OSoundCard interface. 148 * but access them via the @ref OSoundCard interface.
149 */ 149 */
150 OAudioInterface( QObject* parent, const char* name ); 150 OAudioInterface( QObject* parent, const char* name );
151 /** 151 /**
152 * Destructor. 152 * Destructor.
153 */ 153 */
154 virtual ~OAudioInterface(); 154 virtual ~OAudioInterface();
155 155
156 protected: 156 protected:
157 const int _sfd; 157 const int _sfd;
158 158
159 private: 159 private:
160 void init(); 160 void init();
161 private: 161 private:
162 class Private; 162 class Private;
163 Private *d; 163 Private *d;
164}; 164};
165 165
166 166
167/*====================================================================================== 167/*======================================================================================
168 * OMixerInterface 168 * OMixerInterface
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