Skip to content

Commit

Permalink
#3 - Update doc: BanksManager, Effect, Pedalboard, observable_list
Browse files Browse the repository at this point in the history
  • Loading branch information
SrMouraSilva committed Nov 29, 2016
1 parent 6375545 commit be233de
Show file tree
Hide file tree
Showing 7 changed files with 109 additions and 15 deletions.
12 changes: 6 additions & 6 deletions Readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ Connecting *mode two*:

.. code-block:: python
pedalboard.connect(Connection(reverb.outputs[0], fuzz.inputs[0]))
pedalboard.connect(Connection(reverb.outputs[1], fuzz.inputs[0]))
pedalboard.connect(Connection(fuzz.outputs[0], reverb2.inputs[0]))
pedalboard.connect(Connection(reverb.outputs[0], reverb2.inputs[0]))
pedalboard.connections.append(Connection(reverb.outputs[0], fuzz.inputs[0]))
pedalboard.connections.append(Connection(reverb.outputs[1], fuzz.inputs[0]))
pedalboard.connections.append(Connection(fuzz.outputs[0], reverb2.inputs[0]))
pedalboard.connections.append(Connection(reverb.outputs[0], reverb2.inputs[0]))
pedalboard.connect(reverb2.outputs[0].connect(sys_effect.inputs[0]))
pedalboard.connect(reverb2.outputs[0].connect(sys_effect.inputs[1]))
pedalboard.connections.append(reverb2.outputs[0].connect(sys_effect.inputs[0]))
pedalboard.connections.append(reverb2.outputs[0].connect(sys_effect.inputs[1]))
Set effect status (enable/disable bypass) and param value

Expand Down
24 changes: 23 additions & 1 deletion pluginsmanager/banks_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,16 @@

class BanksManager(object):
"""
:param list[Bank] banks:
BanksManager manager the banks. In these is possible add banks,
obtains the banks and register observers for will be notified when
occurs changes (like added new pedalboard, rename bank, set effect
param value or state)
For use details, view Readme.rst example documentation.
:param list[Bank] banks: Banks that will be added in this. Useful
for loads banks previously loaded, like
banks persisted and recovered.
"""

def __init__(self, banks=None):
Expand All @@ -22,9 +31,22 @@ def __init__(self, banks=None):
self.append(bank)

def register(self, observer):
"""
Register an observer for it be notified when occurs changes.
For more details, see :class:`UpdatesObserver` and :class:`ModHost`.
:param UpdatesObserver observer: Observer that will be notified then occurs changes
"""
self.observer_manager.append(observer)

def append(self, bank):
"""
Append the bank in banks manager. It will be monitored, changes in this
will be notified for the notifiers.
:param Bank bank: Bank that will be added in this
"""
self.banks.append(bank)

def _banks_observer(self, update_type, bank, index):
Expand Down
23 changes: 22 additions & 1 deletion pluginsmanager/model/effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,28 @@ class Effect(metaclass=ABCMeta):
Representation of a audio plugin instance - LV2 plugin encapsulated as a jack client.
Effect contains a `active` status (off=bypass), a list of :class:`Param`,
a list of :class:`Input` and a list of :class:`Connection`
a list of :class:`Input` and a list of :class:`Connection`::
>>> reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
>>> pedalboard.append(reverb)
>>> reverb
<Lv2Effect object as 'Calf Reverb' active at 0x7fd58d874ba8>
>>> reverb.active
True
>>> reverb.toggle
>>> reverb.active
False
>>> reverb.active = True
>>> reverb.active
True
>>> reverb.inputs
(<Lv2Input object as In L at 0x7fd58c583208>, <Lv2Input object as In R at 0x7fd58c587320>)
>>> reverb.outputs
(<Lv2Output object as Out L at 0x7fd58c58a438>, <Lv2Output object as Out R at 0x7fd58c58d550>)
>>> reverb.params
(<Lv2Param object as value=1.5 [0.4000000059604645 - 15.0] at 0x7fd587f77908>, <Lv2Param object as value=5000.0 [2000.0 - 20000.0] at 0x7fd587f7a9e8>, <Lv2Param object as value=2 [0 - 5] at 0x7fd587f7cac8>, <Lv2Param object as value=0.5 [0.0 - 1.0] at 0x7fd587f7eba8>, <Lv2Param object as value=0.25 [0.0 - 2.0] at 0x7fd58c576c88>, <Lv2Param object as value=1.0 [0.0 - 2.0] at 0x7fd58c578d68>, <Lv2Param object as value=0.0 [0.0 - 500.0] at 0x7fd58c57ae80>, <Lv2Param object as value=300.0 [20.0 - 20000.0] at 0x7fd58c57df98>, <Lv2Param object as value=5000.0 [20.0 - 20000.0] at 0x7fd58c5810f0>)
:param Pedalboard pedalboard: Pedalboard where the effect lies.
"""
Expand Down
52 changes: 49 additions & 3 deletions pluginsmanager/model/pedalboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,36 @@

class Pedalboard(object):
"""
Pedalboard is a pedalboard representation: your structure contains
:class:`Effect` and :class:`Connection`.
Pedalboard is a patch representation: your structure contains
:class:`Effect` and :class:`Connection`::
>>> pedalboard = Pedalboard('Rocksmith')
>>> bank.append(pedalboard)
>>> builder = Lv2EffectBuilder()
>>> pedalboard.effects
ObservableList: []
>>> reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
>>> pedalboard.append(reverb)
>>> pedalboard.effects
ObservableList: [<Lv2Effect object as 'Calf Reverb' active at 0x7f60effb09e8>]
>>> fuzz = builder.build('http://guitarix.sourceforge.net/plugins/gx_fuzzfacefm_#_fuzzfacefm_')
>>> pedalboard.effects.append(fuzz)
>>> pedalboard.connections
ObservableList: []
>>> pedalboard.connections.append(Connection(sys_effect.outputs[0], fuzz.inputs[0])) # View SystemEffect for more details
>>> pedalboard.connections.append(Connection(fuzz.outputs[0], reverb.inputs[0]))
>>> # It works too
>>> reverb.outputs[1].connect(sys_effect.inputs[0])
ObservableList: [<Connection object as 'system.capture_1 -> GxFuzzFaceFullerMod.In' at 0x7f60f45f3f60>, <Connection object as 'GxFuzzFaceFullerMod.Out -> Calf Reverb.In L' at 0x7f60f45f57f0>, <Connection object as 'Calf Reverb.Out R -> system.playback_1' at 0x7f60f45dacc0>]
For load the pedalboard for play the songs with it::
>>> mod_host.pedalboard = pedalboard
All changes in the pedalboard will be reproduced in mod-host
:param string name: Pedalboard name
"""
Expand Down Expand Up @@ -91,8 +119,26 @@ def append(self, effect):

@property
def effects(self):
"""
Return the effects presents in the pedalboard
.. note::
Because the effects is an :class:`ObservableList`, it isn't settable.
For replace, del the effects unnecessary and add the necessary
effects
"""
return self._effects

@property
def connections(self):
return self._connections
"""
Return the pedalboard connections list
.. note::
Because the connections is an :class:`ObservableList`, it isn't settable.
For replace, del the connections unnecessary and add the necessary
connections
"""
return self._connections
2 changes: 1 addition & 1 deletion pluginsmanager/model/updates_observer.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def token(self):
"""
:getter: Observer token
:setter: Set the token observer. A good place to do this is
in the constructor
in the constructor
:type: string
"""
return self._token
Expand Down
8 changes: 7 additions & 1 deletion pluginsmanager/util/observable_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,16 @@ def __init__(self, lista=None):

def __str__(self):
"""
See ``__str__`` :class:`list`
See ``__repr__`` :class:`list`
"""
return repr(self._list)

def __repr__(self):
"""
See ``__repr__`` :class:`list`
"""
return "ObservableList: " + repr(self._list)

def append(self, item):
"""
See ``append`` :class:`list` method
Expand Down
3 changes: 1 addition & 2 deletions pluginsmanager/util/persistence_decoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def read(self, json):
if json['technology'] == 'lv2':
return self.read_lv2(json)

raise PersistenceDecoderError('Unkown effect technology: ' + json['technology'])
raise PersistenceDecoderError('Unknown effect technology: ' + json['technology'])

def read_lv2(self, json):
effect = self.builder.build(json['plugin'])
Expand Down Expand Up @@ -116,7 +116,6 @@ def read_input(self, json):
return effect.inputs[index]

def read_system_output(self, json):
print(json['symbol'])
return self.system_effect.outputs[json['symbol']]

def read_system_input(self, json):
Expand Down

0 comments on commit be233de

Please sign in to comment.