X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=Mixer.py;h=8fed5f592dd15acaa89c993cef6a05c66f94b221;hb=HEAD;hp=264184dc098b980990618a5a575489075439ce75;hpb=811a95d9a6a797149cdfc6a8ad9c6b2a779a87bc;p=audiocontrol.git diff --git a/Mixer.py b/Mixer.py index 264184d..8fed5f5 100644 --- a/Mixer.py +++ b/Mixer.py @@ -52,19 +52,32 @@ class Mixer(Views.View): # channel_count self._channels = int(data[0]) self._volume = [ None ] * self._channels + premutes = None + if self._muteState is not None: + premutes = self._muteState self._muteState = [ self.ACTIVE ] * self._channels + if premutes: + for i in range(len(self._muteState)): + if i < len(premutes): + self._muteState[i] = premutes[i] while len(self._channelNames) < self._channels: self._channelNames.append("Channel %d" % (len(self._channelNames)+1)) self._redraw() for i in range(self._channels): - self._get(i+1) + self._set(i+1, 0.0) return [] def mute(self, channel): - if self._muteState[channel-1] == self.ACTIVE: + if self._channels is None: + if self._muteState is None: + self._muteState = [] + while(len(self._muteState) < channel) : self._muteState.append( self.ACTIVE ) self._muteState[channel-1] = self.PENDING - self._get(channel) + else: + if self._muteState[channel-1] == self.ACTIVE: + self._muteState[channel-1] = self.PENDING + self._get(channel) def unmute(self, channel): if self._muteState[channel-1] != self.ACTIVE: @@ -128,18 +141,18 @@ class Mixer(Views.View): def __call__(self, value): self._mixer.set(self._channel, value) - def assignController(self, controller, title, channel, min=-12.0, max=6.0): + def assignController(self, controller, title, channel, min=-12.0, max=6.0, stops = [ 0.0 ]): controller.assign(title, self.ParamSetter(self, channel), self.ParamGetter(self, channel), Events.Event(self._context, channel), - min, max, [ 0.0 ]) + min, max, stops) class AssignController(Actions.Action): - def __init__(self, name, mixer, controller, title, channel, min=-12.0, max=6.0): + def __init__(self, name, mixer, controller, title, channel, min=-12.0, max=6.0, stops = [ 0.0 ]): Actions.Action.__init__(self, name) self._mixer = mixer self._controller = controller @@ -147,13 +160,15 @@ class AssignController(Actions.Action): self._channel = channel self._min = min self._max = max + self._stops = stops def __call__(self, binding): self._mixer.assignController(self._controller, self._title, self._channel, self._min, - self._max) + self._max, + self._stops) class MuteChannel(Actions.Action):