Michael Beal wrote: > Since I'm now reasonably sure the remote control key mappings didn't > adversely affect the GUI as a whole, I'm happy to send up the first > generation of sixmixer.py. (To be renamed later.)
I'll be more than happy to add this to the repository, you just have to upload it as a feature request on the sourceforge tracker. Click the link and you're there: http://sourceforge.net/tracker/?func=add&group_id=46652&atid=446898 Duncan > > Four additional configuration variables need to be added to local_conf.py: > > DEFAULT_PCM_VOL > DEAFULT_SUR_VOL > DEFAULT_CTR_VOL > DEFAULT_LFE_VOL > > I recommend these be set flat first and adjusted to suit your preferences. Sensible defaults for these settings should be in the local_conf.py.example, so would you add a patch from this, very easy from svn: "svn diff local_conf.py.example > sixmixer-conf.patch" Will you also remove the tabs from the source as we use spaces in freevo. Shows up like this: self.lfeVolume = 0 self.NoAdjust = 0 self.setMainVolume(config.MAX_VOLUME) Cheers, Duncan > > ------------------------------------------------------------------------ > It's here! Your new message! > Get new email alerts > <http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/> > with the free Yahoo! Toolbar. < > http://us.rd.yahoo.com/evt=49938/*http://tools.search.yahoo.com/toolbar/features/mail/> > > > > ------------------------------------------------------------------------ > > # -*- coding: iso-8859-1 -*- > # ----------------------------------------------------------------------- > # sixmixer.py - A 6-channel volume control interface for freevo. > # ----------------------------------------------------------------------- > # $Id: sixmixer.py 2007-01-14 01:15:00Z mlbeal $ > # > # Description: > # Six-channel audio control for the Freevo Media Center Environment > # > # This program, as a drop in replacement for the original Freevo mixer, > # provides complete control of all six audio channels, more correctly; > # 4 zones of 2 channels each except for the Center and Bass channels > # which are controlled independently. > # > # Notes: > # By default, sixmixer controls all audio system wide via the ALSA mixer > # program: amixer. I chose amixer due to it's wide ranging use within > # the Linux community. Practically ALL modern Linux distros have some > # method of handling ALSA device access either through OSS => ALSA > # wrappers or the ALSA system itself. > # > # Todo: > # > # ----------------------------------------------------------------------- > # Freevo - A Home Theater PC framework > # Copyright (C) 2002 Krister Lagerstrom, et al. > # Please see the file freevo/Docs/CREDITS for a complete list of authors. > # > # This program is free software; you can redistribute it and/or modify > # it under the terms of the GNU General Public License as published by > # the Free Software Foundation; either version 2 of the License, or > # (at your option) any later version. > # > # This program is distributed in the hope that it will be useful, but > # WITHOUT ANY WARRANTY; without even the implied warranty of MER- > # CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General > # Public License for more details. > # > # You should have received a copy of the GNU General Public License along > # with this program; if not, write to the Free Software Foundation, Inc., > # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA > # > # ----------------------------------------------------------------------- > > > """For manipulating the mixer. > """ > > import os > > import config > import rc > import plugin > from event import * > > > class PluginInterface(plugin.DaemonPlugin): > > def __init__(self): > self.muted = 0 > > # init here > plugin.DaemonPlugin.__init__(self) > self.plugin_name = 'MIXER' > > self.mainVolume = 0 > self.pcmVolume = 0 > self.surVolume = 0 > self.ctrVolume = 0 > self.lfeVolume = 0 > self.NoAdjust = 0 > > self.setMainVolume(config.MAX_VOLUME) > self.setPcmVolume(config.DEFAULT_PCM_VOLUME) > self.setSurVolume(config.DEFAULT_SUR_VOLUME) > self.setCtrVolume(config.DEFAULT_CTR_VOLUME) > self.setLfeVolume(config.DEFAULT_LFE_VOLUME) > > > def eventhandler(self, event = None, menuw=None, arg=None): > """ > eventhandler to handle the VOL events > """ > if event == MIXER_VOLUP: > if self.NoAdjust >= 0: > self.incPcmVolume(event.arg) > self.incSurVolume(event.arg) > self.incCtrVolume(event.arg) > self.incLfeVolume(event.arg) > if self.NoAdjust > 0: > self.NoAdjust = 0 > rc.post_event(Event(OSD_MESSAGE, arg=_('Volume: %s%%') % > self.getPcmVolume())) > return True > > elif event == MIXER_VOLDOWN: > if self.NoAdjust <= 0: > self.decPcmVolume(event.arg) > self.decSurVolume(event.arg) > self.decCtrVolume(event.arg) > self.decLfeVolume(event.arg) > if self.NoAdjust < 0: > self.NoAdjust = 0 > rc.post_event(Event(OSD_MESSAGE, arg=_('Volume: %s%%') % > self.getPcmVolume())) > return True > > elif event == SUR_VOLUP: > self.incSurVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('Surround: %s%%') % > self.getSurVolume())) > return True > > elif event == SUR_VOLDOWN: > self.decSurVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('Surround: %s%%') % > self.getSurVolume())) > return True > > elif event == CTR_VOLUP: > self.incCtrVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('Center: %s%%') % > self.getCtrVolume())) > return True > > elif event == CTR_VOLDOWN: > self.decCtrVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('Center: %s%%') % > self.getCtrVolume())) > return True > > elif event == LFE_VOLUP: > self.incLfeVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('LFE: %s%%') % > self.getLfeVolume())) > return True > > elif event == LFE_VOLDOWN: > self.decLfeVolume(event.arg) > rc.post_event(Event(OSD_MESSAGE, arg=_('LFE: %s%%') % > self.getLfeVolume())) > return True > > elif event == MIXER_MUTE: > if self.getMuted() == 1: > rc.post_event(Event(OSD_MESSAGE, arg=_('Volume: %s%%') % > self.getVolume())) > self.setMuted(0) > else: > rc.post_event(Event(OSD_MESSAGE, arg=_('Mute'))) > self.setMuted(1) > return True > > return False > > > > def _setVolume(self, ctrl_name, volume, mute): > if volume < 0: > volume = 0 > if volume > 100: > volume = 100 > vol = str(volume)+"%" > os.system('amixer -q -c 0 sset %s %s %s' % (ctrl_name, vol, mute)) > > def getMuted(self): > return(self.muted) > > def setMuted(self, mute): > self.muted = mute > if mute == 1: > self._setVolume('PCM', 0, 'mute') > self._setVolume('Surround', 0, 'mute') > self._setVolume('Center', 0, 'mute') > self._setVolume('LFE', 0, 'mute') > else: > self._setVolume('PCM', self.pcmVolume, 'unmute') > self._setVolume('Surround', self.surVolume, 'unmute') > self._setVolume('Center', self.ctrVolume, 'unmute') > self._setVolume('LFE', self.lfeVolume, 'unmute') > > def getVolume(self): > return self.pcmVolume > > def getMainVolume(self): > return(self.mainVolume) > > def setMainVolume(self, volume): > self.mainVolume = volume > self._setVolume('Master', self.mainVolume, 'unmute') > > def incMainVolume(self, step=5): > self.mainVolume += step > if self.mainVolume >= 100: > self.mainVolume = 100 > self.NoAdjust = -1 > self._setVolume('Master', self.mainVolume, 'unmute') > > def decMainVolume(self, step=5): > self.mainVolume -= step > if self.mainVolume <= 0: > self.mainVolume = 0 > self.NoAdjust = 1 > self._setVolume('Master', self.mainVolume, 'unmute') > > def getPcmVolume(self): > return self.pcmVolume > > def setPcmVolume(self, volume): > self.pcmVolume = volume > self._setVolume('PCM', self.pcmVolume, 'unmute') > > def incPcmVolume(self, step=5): > self.pcmVolume += step > if self.pcmVolume >= 100: > self.pcmVolume = 100 > self.NoAdjust = -1 > self._setVolume('PCM', self.pcmVolume, 'unmute') > > def decPcmVolume(self, step=5): > self.pcmVolume -= step > if self.pcmVolume <= 0: > self.pcmVolume = 0 > self.NoAdjust = 1 > self._setVolume('PCM', self.pcmVolume, 'unmute') > > def getSurVolume(self): > return self.surVolume > > def setSurVolume(self, volume): > self.surVolume = volume > self._setVolume('Surround', self.surVolume, 'unmute') > > def incSurVolume(self, step=5): > self.surVolume += step > if self.surVolume >= 100: > self.surVolume = 100 > self.NoAdjust = -1 > self._setVolume('Surround', self.surVolume, 'unmute') > > def decSurVolume(self, step=5): > self.surVolume -= step > if self.surVolume <= 0: > self.surVolume = 0 > self.NoAdjust = 1 > self._setVolume('Surround', self.surVolume, 'unmute') > > def getLfeVolume(self): > return self.lfeVolume > > def setLfeVolume(self, volume): > self.lfeVolume = volume > self._setVolume('LFE', self.lfeVolume, 'unmute') > > def incLfeVolume(self, step=5): > self.lfeVolume += step > if self.lfeVolume >= 100: > self.lfeVolume = 100 > self.NoAdjust = -1 > self._setVolume('LFE', self.lfeVolume, 'unmute') > > def decLfeVolume(self, step=5): > self.lfeVolume -= step > if self.lfeVolume <= 0: > self.lfeVolume = 0 > self.NoAdjust = 1 > self._setVolume('LFE', self.lfeVolume, 'unmute') > > def getCtrVolume(self): > return self.ctrVolume > > def setCtrVolume(self, volume): > self.ctrVolume = volume > self._setVolume('Center', self.ctrVolume, 'unmute') > > def incCtrVolume(self, step=5): > self.ctrVolume += step > if self.ctrVolume >= 100: > self.ctrVolume = 100 > self.NoAdjust = -1 > self._setVolume('Center', self.ctrVolume, 'unmute') > > def decCtrVolume(self, step=5): > self.ctrVolume -= step > if self.ctrVolume <= 0: > self.ctrVolume = 0 > self.NoAdjust = 1 > self._setVolume('Center', self.ctrVolume, 'unmute') > > def reset(self): > self.setMainVolume(config.MAX_VOLUME) > self.setPcmVolume(config.DEFAULT_PCM_VOLUME) > self.setSurVolume(config.DEFAULT_SUR_VOLUME) > self.setCtrVolume(config.DEFAULT_CTR_VOLUME) > self.setLfeVolume(config.DEFAULT_LFE_VOLUME) > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveys - and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > ------------------------------------------------------------------------ > > _______________________________________________ > Freevo-devel mailing list > Freevo-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/freevo-devel ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys - and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel