summaryrefslogtreecommitdiff
path: root/libopie2
authorwimpie <wimpie>2005-01-04 01:31:53 (UTC)
committer wimpie <wimpie>2005-01-04 01:31:53 (UTC)
commit42638ffd708a5236ad9a1f06a40b9d8b7919277c (patch) (side-by-side diff)
tree687d61c6e2d5ddd20dff42cf6e1b18afbe81633f /libopie2
parent0f3d74b472817e6b4f9d80adc122281b84629c1f (diff)
downloadopie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.zip
opie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.tar.gz
opie-42638ffd708a5236ad9a1f06a40b9d8b7919277c.tar.bz2
CONTROL file :changed VERSION string
Diffstat (limited to 'libopie2') (more/less context) (show 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 @@
Package: libopiemm2
Files: lib/libopiemm2.so.*
Priority: optional
Section: opie/system
Maintainer: Opie Team <opie@handhelds.org>
Architecture: arm
-Version: 1.8.2-$SUB_VERSION.2
+Version: $QPE_VERSION$EXTRAVERSION
Depends: libqpe1, libopiecore2 (1.8.2)
Provides: libopiemm2
Description: 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
@@ -129,194 +129,192 @@ OSoundCard::OSoundCard( QObject* parent, const char* name )
init();
}
OSoundCard::~OSoundCard()
{
}
void OSoundCard::init()
{
#ifdef QT_QWS_DEVFS
_audio = new OAudioInterface( this, "/dev/sound/dsp" );
_mixer = new OMixerInterface( this, "/dev/sound/mixer" );
#else
_audio = new OAudioInterface( this, "/dev/dsp" );
_mixer = new OMixerInterface( this, "/dev/mixer" );
#endif
}
/*======================================================================================
* OAudioInterface
*======================================================================================*/
OAudioInterface::OAudioInterface( QObject* parent, const char* name )
:QObject( parent, name ), _sfd(0)
{
odebug << "OAudioInterface::OAudioInterface()" << oendl;
init();
}
OAudioInterface::~OAudioInterface()
{
}
void OAudioInterface::init()
{
}
/*======================================================================================
* OMixerInterface
*======================================================================================*/
OMixerInterface::OMixerInterface( QObject* parent, const char* name )
:QObject( parent, name )
{
odebug << "OMixerInterface::OMixerInterface()" << oendl;
init();
}
OMixerInterface::~OMixerInterface()
{
}
void OMixerInterface::init()
{
// open the device
_fd = ::open( name(), O_RDWR );
if ( _fd == -1 )
{
owarn << "OMixerInterface::init(): Can't open mixer." << oendl;
return;
}
// construct the device capabilities
int devmask = 0;
if ( ioctl( _fd, SOUND_MIXER_READ_DEVMASK, &devmask ) != -1 )
{
if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "PlayVolume", SOUND_MIXER_VOLUME );
if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "PlayBass", SOUND_MIXER_BASS );
if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "PlayTreble", SOUND_MIXER_TREBLE );
if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "PlaySynth", SOUND_MIXER_SYNTH );
if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "PlayPCM", SOUND_MIXER_PCM );
if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "PlaySpeaker", SOUND_MIXER_SPEAKER );
if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "PlayLine", SOUND_MIXER_LINE );
if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "PlayMic", SOUND_MIXER_MIC );
if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "PlayCD", SOUND_MIXER_CD );
if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "PlayInputMix", SOUND_MIXER_IMIX );
if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "PlayAltPCM", SOUND_MIXER_ALTPCM );
if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "PlayRecord", SOUND_MIXER_RECLEV );
if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "PlayInputGain", SOUND_MIXER_IGAIN );
if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "PlayOutputGain", SOUND_MIXER_OGAIN );
//odebug << "devmask available and constructed." << oendl;
}
devmask = 0;
if ( ioctl( _fd, SOUND_MIXER_READ_RECMASK, &devmask ) != -1 )
{
if ( devmask & ( 1 << SOUND_MIXER_VOLUME ) ) _channels.insert( "RecVolume", SOUND_MIXER_VOLUME );
if ( devmask & ( 1 << SOUND_MIXER_BASS ) ) _channels.insert( "RecBass", SOUND_MIXER_BASS );
if ( devmask & ( 1 << SOUND_MIXER_TREBLE ) ) _channels.insert( "RecTreble", SOUND_MIXER_TREBLE );
if ( devmask & ( 1 << SOUND_MIXER_SYNTH ) ) _channels.insert( "RecSynth", SOUND_MIXER_SYNTH );
if ( devmask & ( 1 << SOUND_MIXER_PCM ) ) _channels.insert( "RecPCM", SOUND_MIXER_PCM );
if ( devmask & ( 1 << SOUND_MIXER_SPEAKER ) ) _channels.insert( "RecSpeaker", SOUND_MIXER_SPEAKER );
if ( devmask & ( 1 << SOUND_MIXER_LINE ) ) _channels.insert( "RecLine", SOUND_MIXER_LINE );
if ( devmask & ( 1 << SOUND_MIXER_MIC ) ) _channels.insert( "RecMic", SOUND_MIXER_MIC );
if ( devmask & ( 1 << SOUND_MIXER_CD ) ) _channels.insert( "RecCD", SOUND_MIXER_CD );
if ( devmask & ( 1 << SOUND_MIXER_IMIX ) ) _channels.insert( "RecInputMix", SOUND_MIXER_IMIX );
if ( devmask & ( 1 << SOUND_MIXER_ALTPCM ) ) _channels.insert( "RecAltPCM", SOUND_MIXER_ALTPCM );
if ( devmask & ( 1 << SOUND_MIXER_RECLEV ) ) _channels.insert( "RecRecord", SOUND_MIXER_RECLEV );
if ( devmask & ( 1 << SOUND_MIXER_IGAIN ) ) _channels.insert( "RecInputGain", SOUND_MIXER_IGAIN );
if ( devmask & ( 1 << SOUND_MIXER_OGAIN ) ) _channels.insert( "RecOutputGain", SOUND_MIXER_OGAIN );
//odebug << "recmask available and constructed." << oendl;
}
/* ChannelIterator it;
for ( it = _channels.begin(); it != _channels.end(); ++it )
{
odebug << "Channel " << it.key() << " available (bit " << it.data() << ")" << oendl;
odebug << " +--- Volume: " << volume( it.key() ) & 0xff << " | " << volume( it.key() ) >> 8 << "" << oendl;
}
*/
}
QStringList OMixerInterface::allChannels() const
{
ChannelIterator it = _channels.begin();
QStringList channels;
while ( it != _channels.end() )
{
channels += it.key();
it++;
}
return channels;
}
QStringList OMixerInterface::recChannels() const
{
owarn << "NYI" << oendl;
return QStringList();
}
QStringList OMixerInterface::playChannels() const
{
owarn << "NYI" << oendl;
return QStringList();
}
bool OMixerInterface::hasChannel( const QString& channel )
{
return _channels.contains( channel );
}
void OMixerInterface::setVolume( const QString& channel, int left, int right )
{
int volume = left;
volume |= ( right == -1 ) ? left << 8 : right << 8;
if ( _channels.contains( channel ) )
{
int result = ioctl( _fd, MIXER_WRITE( _channels[channel] ), &volume );
if ( result == -1 )
{
owarn << "Can't set volume: " << strerror( errno ) << oendl;
}
else
{
if ( result & 0xff != left )
{
owarn << "Device adjusted volume from " << left << " to " << (result & 0xff) << oendl;
}
}
}
}
int OMixerInterface::volume( const QString& channel ) const
{
int volume;
if ( _channels.contains( channel ) )
{
if ( ioctl( _fd, MIXER_READ( _channels[channel] ), &volume ) == -1 )
{
owarn << "Can't get volume: " << strerror( errno ) << oendl;
}
else return volume;
}
return -1;
}
-
-
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
@@ -41,193 +41,192 @@ namespace MM {
class OAudioInterface;
class OMixerInterface;
class OSoundCard;
/*======================================================================================
* OSoundSystem
*======================================================================================*/
/**
* @brief A container class for all audio interfaces
*
* This class provides access to all available audio/midi/sequencer interfaces of your computer.
*
* @author Michael 'Mickey' Lauer <mickey@tm.informatik.uni-frankfurt.de>
*/
class OSoundSystem : public QObject
{
Q_OBJECT
public:
typedef QDict<OSoundCard> CardMap;
typedef QDictIterator<OSoundCard> CardIterator;
public:
/**
* @returns the number of available interfaces
*/
int count() const;
/**
* @returns a pointer to the (one and only) @ref ONetwork instance.
*/
static OSoundSystem* instance();
/**
* @returns an iterator usable for iterating through all network interfaces.
*/
CardIterator iterator() const;
/**
* @returns a pointer to the @ref OAudioInterface object for the specified @a interface or 0, if not found
* @see OAudioInterface
*/
OSoundCard* card( const QString& interface ) const;
/**
* @internal Rebuild the internal interface database
* @note Sometimes it might be useful to call this from client code,
* e.g. after issuing a cardctl insert
*/
void synchronize();
protected:
OSoundSystem();
private:
static OSoundSystem* _instance;
CardMap _interfaces;
class Private;
Private *d;
};
/*======================================================================================
* OSoundCard
*======================================================================================*/
class OSoundCard : public QObject
{
Q_OBJECT
public:
/**
* Constructor. Normally you don't create @ref OSoundCard objects yourself,
* but access them via @ref OSoundSystem::card().
*/
OSoundCard( QObject* parent, const char* name );
/**
* Destructor.
*/
virtual ~OSoundCard();
bool hasMixer() const { return _audio; };
bool hasAudio() const { return _mixer; };
OAudioInterface* audio() const { return _audio; };
OMixerInterface* mixer() const { return _mixer; };
protected:
OAudioInterface* _audio;
OMixerInterface* _mixer;
private:
void init();
private:
class Private;
Private *d;
};
/*======================================================================================
* OAudioInterface
*======================================================================================*/
class OAudioInterface : public QObject
{
Q_OBJECT
public:
/**
* Constructor. Normally you don't create @ref OAudioInterface objects yourself,
* but access them via the @ref OSoundCard interface.
*/
OAudioInterface( QObject* parent, const char* name );
/**
* Destructor.
*/
virtual ~OAudioInterface();
protected:
const int _sfd;
private:
void init();
private:
class Private;
Private *d;
};
/*======================================================================================
* OMixerInterface
*======================================================================================*/
class OMixerInterface : public QObject
{
Q_OBJECT
public:
typedef QMap<QString,int>::ConstIterator ChannelIterator;
/**
* Constructor. Normally you don't create @ref OMixerInterface objects yourself,
* but access them via the @ref OSoundCard interface.
*/
OMixerInterface( QObject* parent, const char* name );
/**
* Destructor.
*/
virtual ~OMixerInterface();
/**
* @returns all available channels.
*/
QStringList allChannels() const;
/**
* @returns recordable channels.
*/
QStringList recChannels() const;
/**
* @returns playable channels.
*/
QStringList playChannels() const;
/**
* @returns true, if @a channel exists.
*/
bool hasChannel( const QString& channel );
/**
* Set the @a left and @a right volumes for @a channel.
* If no value for right is given, the value for left is taken for that.
*/
void setVolume( const QString& channel, int left, int right = -1 );
/**
* @returns the volume of @a channel or -1, if the channel doesn't exist.
* @note You might want to use @ref hasChannel() to check if a channel exists.
*/
int volume( const QString& channel ) const;
protected:
int _fd;
QMap<QString, int> _channels;
private:
void init();
private:
class Private;
Private *d;
};
}
}
#endif // OSOUNDSYSTEM_H
-