Skip to content

Commit

Permalink
Merge pull request #71 from PedalPi/issue-67-connection
Browse files Browse the repository at this point in the history
Issues #67 and #38
  • Loading branch information
SrMouraSilva committed Oct 19, 2017
2 parents 24483bb + fd03832 commit 8b66d21
Show file tree
Hide file tree
Showing 31 changed files with 433 additions and 285 deletions.
47 changes: 27 additions & 20 deletions CHANGES
Original file line number Diff line number Diff line change
@@ -1,35 +1,42 @@
Version 0.6.0 -- released ?
Version 0.6.0 -- released 10/?/17
**********************************
- Add makefile. Now is possible run tests and generate docs easly (`make help`);
- Improve :class:`SystemInput` and :class:`SystemOutputs` documentation;
- `Issue #57`_ Implementing midi support;
- Now :class:`Effect` list yours `midi_inputs` and `midi_outputs`;
- :class:`SystemEffect` now supports `midi_inputs` and `midi_outputs`;
- :class:`Lv2Effect` now supports `midi_inputs` and `midi_outputs`;
- Created :class:`MidiPort`, :class:`MidiInput`, :class:`MidiOutput`;
- Created :class:`SystemMidiInput`, :class:`SystemMidiOutput`;
- Created :class:`Lv2MidiInput`, :class:`Lv2MidiOutput`;
- :class:`SystemEffectBuilder` now creates :class:`SystemEffect` with your midi outputs and midi inputs;
- Improve :class:`.SystemInput` and :class:`.SystemOutputs` documentation;
- `Issue #57`_ - Implementing midi support:
- Now :class:`.Effect` list yours `midi_inputs` and `midi_outputs`;
- :class:`.SystemEffect` now supports `midi_inputs` and `midi_outputs`;
- :class:`.Lv2Effect` now supports `midi_inputs` and `midi_outputs`;
- Created :class:`.MidiPort`, :class:`.MidiInput`, :class:`.MidiOutput`;
- Created :class:`.SystemMidiInput`, :class:`.SystemMidiOutput`;
- Created :class:`.Lv2MidiInput`, :class:`.Lv2MidiOutput`;
- :class:`.SystemEffectBuilder` now creates :class:`.SystemEffect` with your midi outputs and midi inputs;
- Fix autosaver_test creation folder. Now is more easily configure test workspace;
- Refactored :class:`Input`, :class:`Output`: Created :class:`Port` for remove duplicated code;
- Refactored :class:`SystemInput`, :class:`SystemOutput`: Created :class:`SystemPortMixing` for remove duplicated code;
- Refactored :class:`Lv2Input`, :class:`Lv2Output`: Created :class:`Lv2PortMixing` for remove duplicated code;
- :class:`JackClient` - Add attributes: `audio_inputs`, `audio_outputs`, `midi_inputs`, `midi_outputs`.

- Refactored :class:`.Input`, :class:`.Output`: Created :class:`.Port` for remove duplicated code;
- Refactored :class:`.SystemInput`, :class:`.SystemOutput`: Created :class:`.SystemPortMixing` for remove duplicated code;
- Refactored :class:`.Lv2Input`, :class:`.Lv2Output`: Created :class:`.Lv2PortMixing` for remove duplicated code;
- :class:`.JackClient` - Add attributes: `audio_inputs`, `audio_outputs`, `midi_inputs`, `midi_outputs`;
- Break change: Removed :meth:`Output.connect()` and :meth:`Output.disconnect()` :class:`.Output` methods.
Use instead :meth:`~pluginsmanager.model.pedalboard.Pedalboard.connect()`, :meth:`~pluginsmanager.model.pedalboard.Pedalboard.disconnect()` :class:`.Pedalboard` methods;
- `Issue #67`_ - Created :meth:`~pluginsmanager.model.pedalboard.Pedalboard.connect()`, :meth:`~pluginsmanager.model.pedalboard.Pedalboard.disconnect()` :class:`.Pedalboard` methods;
- Fixed Changelog: Now is possible see it in the documentation;
- `Issue #38`_ - Raise erros then add sys_effect in any Pedalboard.

.. _Issue #38: https://github.com/PedalPi/PluginsManager/issues/38
.. _Issue #57: https://github.com/PedalPi/PluginsManager/issues/57
.. _Issue #67: https://github.com/PedalPi/PluginsManager/issues/67

Version 0.5.1 -- released 08/16/17
**********************************
- `Issue #52`_ - :class:`Autosaver` - Change connection with :class:`SystemInput` and :class:`SystemOutput` causes error;
- `Issue #53`_ - :class:`Autosaver` - Remove effect with connections breaks.
- `Issue #52`_ - :class:`.Autosaver` - Change connection with :class:`.SystemInput` and :class:`.SystemOutput` causes error;
- `Issue #53`_ - :class:`.Autosaver` - Remove effect with connections breaks.
Disable connections removed notification when a effect with connections has removed;
- :class:`Autosaver` - Add :attr:`.Observable.real_list` attribute for access the list of :class:`ObservableList`;
- `Issue #54`_ - :class:`Mod-host` - Fix `feedback_socket optional`_ problem.
- :class:`.Autosaver` - Add :attr:`.Observable.real_list` attribute for access the list of :class:`.ObservableList`;
- `Issue #54`_ - :class:`.Mod-host` - Fix `feedback_socket optional`_ problem.

.. _Issue #52: https://github.com/PedalPi/PluginsManager/issues/52
.. _Issue #53: https://github.com/PedalPi/PluginsManager/issues/53
.. _Issue #54: https://github.com/PedalPi/PluginsManager/issues/54
.. _default feedback_socket disabled: https://github.com/moddevices/mod-host/commit/31b1d04deb91c88420e1e0dd0cc4fad523f55712
.. _feedback_socket optional: https://github.com/moddevices/mod-host/commit/31b1d04deb91c88420e1e0dd0cc4fad523f55712

Version 0.5.0 -- released 05/29/17
**********************************
Expand Down
4 changes: 0 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,6 @@ library can be accessed in the `Observer section <observer.html>`__.

.. _Carla: https://github.com/falkTX/Carla

Changelog
---------

..include:: ../../CHANGES

Maintenance
-----------
Expand Down
4 changes: 4 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Changelog
=========

.. include:: ../../CHANGES
8 changes: 8 additions & 0 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
.. include:: ../../README.rst

Changelog
---------

.. toctree::
:maxdepth: 2

changelog

API
---

Expand Down
57 changes: 43 additions & 14 deletions docs/source/model.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,10 @@ This page contains the model classes.
graph [rankdir=BT];
node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

Lv2Effect->Lv2Plugin[
dir="backward", arrowhead="diamond", arrowtail="normal"
];
Lv2Effect->Effect;
SystemEffect->Effect;
AudioPort->Port;

Input->Port;
Output->Port;
Input->AudioPort;
Output->AudioPort;

MidiPort->Port;
MidiInput->MidiPort;
Expand All @@ -66,7 +62,23 @@ This page contains the model classes.
SystemMidiInput->MidiInput;
SystemMidiOutput->MidiOutput;

}

.. graphviz::

digraph classes {
graph [rankdir=BT];
node [shape=rect, style=filled, color="#298029", fontname=Sans, fontcolor="#ffffff", fontsize=10];

Lv2Effect->Lv2Plugin[
dir="backward", arrowhead="diamond", arrowtail="normal"
];
Lv2Effect->Effect;
SystemEffect->Effect;

Lv2Param->Param;

MidiConnection->Connection;
}

.. graphviz::
Expand Down Expand Up @@ -103,6 +115,14 @@ Bank
:special-members:
:exclude-members: __weakref__

Pedalboard
----------

.. autoclass:: pluginsmanager.model.pedalboard.Pedalboard
:members:
:special-members:
:exclude-members: __weakref__

Connection
----------

Expand All @@ -111,6 +131,14 @@ Connection
:special-members:
:exclude-members: __weakref__

MidiConnection
--------------

.. autoclass:: pluginsmanager.model.midi_connection.MidiConnection
:members:
:special-members:
:exclude-members: __weakref__

Effect
------

Expand All @@ -127,6 +155,14 @@ Port
:special-members:
:exclude-members: __weakref__

AudioPort
---------

.. autoclass:: pluginsmanager.model.audio_port.AudioPort
:members:
:special-members:
:exclude-members: __weakref__

Input
-----

Expand Down Expand Up @@ -176,10 +212,3 @@ Param
:special-members:
:exclude-members: __weakref__

Pedalboard
----------

.. autoclass:: pluginsmanager.model.pedalboard.Pedalboard
:members:
:special-members:
:exclude-members: __weakref__
2 changes: 1 addition & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test-details: test

help:
@echo " clean"
@echo " Clean the files"
@echo " Clean files"
@echo " docs"
@echo " Make the docs"
@echo " docs-see"
Expand Down
31 changes: 31 additions & 0 deletions pluginsmanager/model/audio_port.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Copyright 2017 SrMouraSilva
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from abc import ABCMeta

from pluginsmanager.model.port import Port


class AudioPort(Port, metaclass=ABCMeta):
"""
Port is a parent abstraction for audio inputs and audio outputs
"""

@property
def connection_class(self):
"""
:return Connection: Class used for connections in this port
"""
from pluginsmanager.model.connection import Connection
return Connection
48 changes: 35 additions & 13 deletions pluginsmanager/model/connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
# limitations under the License.


from pluginsmanager.model.audio_port import AudioPort


class ConnectionError(Exception):
def __init__(self, message):
super(ConnectionError, self).__init__(message)
Expand All @@ -21,9 +24,10 @@ def __init__(self, message):

class Connection(object):
"""
:class:`pluginsmanager.model.connection.Connection` represents a connection between two
distinct effects by your ports (effect :class:`.Output` with effect :class:`.Input`)::
:class:`~pluginsmanager.model.connection.Connection` represents a connection between two
distinct effects by your :class:`.AudioPort` (effect :class:`.Output` with effect :class:`.Input`)::
>>> from pluginsmanager.model.pedalboard import Pedalboard
>>> californication = Pedalboard('Californication')
>>> californication.append(driver)
>>> californication.append(reverb)
Expand All @@ -42,21 +46,38 @@ class Connection(object):
Another way to use implicitly connections::
>>> guitar_output.connect(driver_input)
>>> driver_output.connect(reverb_input)
>>> reverb_output.connect(amp_input)
>>> californication.connect(guitar_output, driver_input)
>>> californication.connect(driver_output, reverb_input)
>>> californication.connect(reverb_output, amp_input)
:param Output effect_output: Output port that will be connected with input port
:param Input effect_input: Input port that will be connected with output port
:param Output output_port: Audio output port that will be connected with audio input port
:param Input input_port: Audio input port that will be connected with audio output port
"""

def __init__(self, effect_output, effect_input):
if effect_output.effect == effect_input.effect\
and not effect_output.effect.is_possible_connect_itself:
raise ConnectionError('Effect of output and effect of input are equals')
def __init__(self, output_port, input_port):
if not self._valid_instance(output_port)\
or not self._valid_instance(input_port):
raise ConnectionError("'{}' only accepts ports that inherits {}".format(self.__class__.__name__, self.ports_class.__name__))

if output_port.effect == input_port.effect\
and not output_port.effect.is_possible_connect_itself:
effect_name = str(input_port.effect)
raise ConnectionError("The output {} and input {} are from the same effect {}. "
"This effect doesn't accept connections between itself instance."
.format(effect_name, str(output_port), str(input_port)))

self._output = output_port
self._input = input_port

self._output = effect_output
self._input = effect_input
def _valid_instance(self, port):
return isinstance(port, self.ports_class)

@property
def ports_class(self):
"""
:return class: Port class that this connection only accepts
"""
return AudioPort

@property
def output(self):
Expand Down Expand Up @@ -101,4 +122,5 @@ def __dict__(self):
return {
'output': self.output.json,
'input': self.input.json,
'type': 'audio'
}
2 changes: 1 addition & 1 deletion pluginsmanager/model/effect.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ 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:`pluginsmanager.mod_host.connection.Connection`::
a list of :class:`.Input` and a list of :class:`~pluginsmanager.model.connection.Connection`::
>>> reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb')
>>> pedalboard.append(reverb)
Expand Down
7 changes: 4 additions & 3 deletions pluginsmanager/model/input.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@

from abc import ABCMeta

from pluginsmanager.model.port import Port
from pluginsmanager.model.audio_port import AudioPort


class Input(Port, metaclass=ABCMeta):
class Input(AudioPort, metaclass=ABCMeta):
"""
Input is the medium in which the audio will go into effect to be processed.
Expand All @@ -43,7 +43,8 @@ class Input(Port, metaclass=ABCMeta):
>>> my_awesome_effect.inputs[symbol] == effect_input
True
For connections between effects, view :class:`pluginsmanager.model.connection.Connection`.
For connections between effects, see :meth:`~pluginsmanager.model.pedalboard.Pedalboard.connect()`
and :meth:`~pluginsmanager.model.pedalboard.Pedalboard.disconnect()` :class:`.Pedalboard` class methods.
:param Effect effect: Effect of input
"""
Expand Down
53 changes: 53 additions & 0 deletions pluginsmanager/model/midi_connection.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Copyright 2017 SrMouraSilva
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from pluginsmanager.model.connection import Connection
from pluginsmanager.model.midi_port import MidiPort


class MidiConnection(Connection):
"""
:class:`.MidiConnection` represents a connection between two
distinct effects by your :class:`.MidiPort` (effect :class:`.MidiOutput` with effect :class:`.MidiInput`)::
>>> californication = Pedalboard('Californication')
>>> californication.append(driver)
>>> californication.append(reverb)
>>> output_port = cctonode1.midi_outputs[0]
>>> input_port = cctonode2.midi_inputs[0]
>>> californication.connections.append(MidiConnection(output_port, input_port))
Another way to use implicitly connections::
>>> californication.connect(output_port, input_port)
:param MidiOutput output_port: MidiOutput port that will be connected with midi input port
:param MidiInput input_port: MidiInput port that will be connected with midi output port
"""

@property
def ports_class(self):
"""
:return class: Port class that this connection only accepts
"""
return MidiPort

@property
def __dict__(self):
dictionary = super(MidiConnection, self).__dict__
dictionary['type'] = 'midi'

return dictionary

0 comments on commit 8b66d21

Please sign in to comment.