summaryrefslogtreecommitdiffstats
path: root/kmix/kmix.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'kmix/kmix.cpp')
-rw-r--r--kmix/kmix.cpp172
1 files changed, 147 insertions, 25 deletions
diff --git a/kmix/kmix.cpp b/kmix/kmix.cpp
index 5bee4585..69630f61 100644
--- a/kmix/kmix.cpp
+++ b/kmix/kmix.cpp
@@ -61,7 +61,7 @@
* Constructs a mixer window (KMix main window)
*/
KMixWindow::KMixWindow()
- : TDEMainWindow(0, 0, 0, 0), m_showTicks( true ),
+ : DCOPObject("kmix"), TDEMainWindow(0, 0, 0, 0), m_showTicks( true ),
m_dockWidget( 0L )
{
m_visibilityUpdateAllowed = true;
@@ -121,11 +121,11 @@ KMixWindow::initActions()
m_globalAccel = new TDEGlobalAccel(this, "KMix");
m_globalAccel->insert( "Increase volume", i18n( "Increase Volume of Master Channel"), TQString(),
- TDEShortcut(TQString("XF86AudioRaiseVolume")), TDEShortcut(TQString("XF86AudioRaiseVolume")), TQT_TQOBJECT(this), TQT_SLOT( increaseVolume() ) );
+ TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotIncreaseVolume() ) );
m_globalAccel->insert( "Decrease volume", i18n( "Decrease Volume of Master Channel"), TQString(),
- TDEShortcut(TQString("XF86AudioLowerVolume")), TDEShortcut(TQString("XF86AudioLowerVolume")), TQT_TQOBJECT(this), TQT_SLOT( decreaseVolume() ) );
+ TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotDecreaseVolume() ) );
m_globalAccel->insert( "Toggle mute", i18n( "Toggle Mute of Master Channel"), TQString(),
- TDEShortcut(TQString("XF86AudioMute")), TDEShortcut(TQString("XF86AudioMute")), TQT_TQOBJECT(this), TQT_SLOT( toggleMuted() ) );
+ TDEShortcut(), TDEShortcut(), TQT_TQOBJECT(this), TQT_SLOT( slotToggleMuted() ) );
m_globalAccel->readSettings();
m_globalAccel->updateConnections();
@@ -619,40 +619,162 @@ KMixWindow::configureGlobalShortcuts()
m_globalAccel->updateConnections();
}
-void
-KMixWindow::toggleMuted()
+// KMixIface DCOP interface methods
+void KMixWindow::setVolume(int percentage)
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ mixerMaster->setMasterVolume(percentage);
+ }
+}
+
+void KMixWindow::increaseVolume(int percentage)
{
- Mixer* mixerMaster = Mixer::masterCard();
- if ( mixerMaster != 0 ) {
- MixDevice* md = mixerMaster->masterDevice();
- if ( md != 0 && md->hasMute() ) {
- mixerMaster->toggleMute(md->num());
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ mixerMaster->increaseVolume(md->num(), percentage);
}
}
}
-void
-KMixWindow::increaseVolume()
+void KMixWindow::decreaseVolume(int percentage)
{
- Mixer* mixerMaster = Mixer::masterCard();
- if ( mixerMaster != 0 ) {
- MixDevice* md = mixerMaster->masterDevice();
- if ( md != 0 ) {
- mixerMaster->increaseVolume(md->num());
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ mixerMaster->decreaseVolume(md->num(), percentage);
}
}
}
-void
-KMixWindow::decreaseVolume()
+int KMixWindow::volume()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ return mixerMaster->masterVolume();
+ }
+ return -1;
+}
+
+void KMixWindow::setAbsoluteVolume(long absoluteVolume)
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ return mixerMaster->setAbsoluteVolume(md->num(), absoluteVolume);
+ }
+ }
+}
+
+long KMixWindow::absoluteVolume()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ return mixerMaster->absoluteVolume(md->num());
+ }
+ }
+ return -1L;
+}
+
+long KMixWindow::absoluteVolumeMin()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ return mixerMaster->absoluteVolumeMin(md->num());
+ }
+ }
+ return -1L;
+}
+
+long KMixWindow::absoluteVolumeMax()
{
- Mixer* mixerMaster = Mixer::masterCard();
- if ( mixerMaster != 0 ) {
- MixDevice* md = mixerMaster->masterDevice();
- if ( md != 0 ) {
- mixerMaster->decreaseVolume(md->num());
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ MixDevice *md = mixerMaster->masterDevice();
+ if (md)
+ {
+ return mixerMaster->absoluteVolumeMax(md->num());
}
}
+ return -1L;
+}
+
+void KMixWindow::setMute(bool on)
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ mixerMaster->setMasterMute(on);
+ }
+}
+
+void KMixWindow::toggleMute()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ mixerMaster->toggleMasterMute();
+ }
+}
+
+bool KMixWindow::mute()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ return mixerMaster->masterMute();
+ }
+ return true;
+}
+
+TQString KMixWindow::mixerName()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ return mixerMaster->mixerName();
+ }
+ return TQString::null;
+}
+
+int KMixWindow::deviceIndex()
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ return mixerMaster->masterDeviceIndex();
+ }
+ return -1;
+}
+
+void KMixWindow::setBalance(int balance)
+{
+ Mixer *mixerMaster = Mixer::masterCard();
+ if (mixerMaster)
+ {
+ mixerMaster->setBalance(balance);
+ }
}
#include "kmix.moc"