-
Notifications
You must be signed in to change notification settings - Fork 5
WIP: Patch support #111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
SrMouraSilva
wants to merge
5
commits into
PedalPi:master
Choose a base branch
from
jeallcmn:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
WIP: Patch support #111
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
2e8ffa3
Added support for LV2 Patches
jeallcmn ae23113
Add serialization support for pedalboards with effects with patches
jeallcmn 6776969
Added support for presets
jeallcmn eb3ff2c
WIP
jeallcmn 7d21d37
Merge pull request #1 from jeallcmn/feature/presets
jeallcmn File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| { | ||
| "folders": [ | ||
| { | ||
| "path": "../../../jeanam" | ||
| }, | ||
| { | ||
| "path": ".." | ||
| } | ||
| ], | ||
| "settings": {} | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # 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.patch import Patch | ||
|
|
||
|
|
||
| class Lv2Patch(Patch): | ||
| """ | ||
| Representation of a Lv2 patch. | ||
|
|
||
| For general input use, see :class:`.Patch` class documentation. | ||
|
|
||
| :param Lv2Effect effect: Effect that contains the patchy | ||
| :param str symbol: symbol for the effect | ||
|
|
||
| .. _patch: http://lv2plug.in/ns/ext/patch# | ||
| """ | ||
|
|
||
| def __init__(self, effect, label, uri, default): | ||
| super(Lv2Patch, self).__init__(effect, label, uri, default) | ||
| print(f"Creating patch {label} {uri}") | ||
|
|
||
|
|
||
| @property | ||
| def __dict__(self): | ||
| dictionary = super(Lv2Patch, self).__dict__ | ||
| return dictionary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| # 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.preset import Preset | ||
|
|
||
|
|
||
| class Lv2Preset(Preset): | ||
| """ | ||
| Representation of a Lv2 Preset. | ||
|
|
||
| For general input use, see :class:`.Preset` class documentation. | ||
|
|
||
| :param Lv2Effect effect: Effect that contains the Presety | ||
| :param str symbol: symbol for the effect | ||
|
|
||
| .. _Preset: http://lv2plug.in/ns/ext/Preset# | ||
| """ | ||
|
|
||
| def __init__(self, effect, label, uri): | ||
| super(Lv2Preset, self).__init__(effect, label, uri) | ||
|
|
||
| @property | ||
| def __dict__(self): | ||
| dictionary = super(Lv2Preset, self).__dict__ | ||
| return dictionary |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,130 @@ | ||
| # 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, abstractmethod | ||
|
|
||
| from unittest.mock import MagicMock | ||
|
|
||
|
|
||
| class PatchError(Exception): | ||
|
|
||
| def __init__(self, message): | ||
| super(PatchError, self).__init__(message) | ||
| self.message = message | ||
|
|
||
|
|
||
| class Patch(metaclass=ABCMeta): | ||
| """ | ||
| :class:`.Patch` represents an Audio Plugin Patch:: | ||
|
|
||
| >>> my_awesome_effect | ||
| <Lv2Effect object as 'Amp Model' active at 0x7fd58d874ba8> | ||
| >>> my_awesome_effect.patch | ||
| (<Lv2Patch object as value=model.name) | ||
|
|
||
| >>> param.default | ||
| 1.5 | ||
| >>> param.value = 14 | ||
|
|
||
| >>> symbol = param.symbol | ||
| >>> symbol | ||
| 'model' | ||
| >>> param == my_awesome_effect.patches[symbol] | ||
| True | ||
|
|
||
| :param Effect effect: Effect in which this parameter belongs | ||
| """ | ||
|
|
||
| def __init__(self, effect, label, uri, default): | ||
| self._uri = uri | ||
| self._label = label | ||
| self._effect = effect | ||
| self._default = default | ||
| self._value = default | ||
|
|
||
| self.observer = MagicMock() | ||
|
|
||
| @property | ||
| def effect(self): | ||
| """ | ||
| :return: Effect in which this parameter belongs | ||
| """ | ||
| return self._effect | ||
|
|
||
| @property | ||
| def default(self): | ||
| """ | ||
| Parameter default | ||
|
|
||
| :getter: Current default | ||
| :setter: Set the current default | ||
| """ | ||
| return self._default | ||
|
|
||
| @property | ||
| def uri(self): | ||
| """ | ||
| Parameter uri | ||
|
|
||
| :getter: Current uri | ||
| :setter: Set the current uri | ||
| """ | ||
| return self._uri | ||
|
|
||
| @property | ||
| def label(self): | ||
| return self._label | ||
|
|
||
| @property | ||
| def value(self): | ||
| """ | ||
| Parameter value | ||
|
|
||
| :getter: Current value | ||
| :setter: Set the current value | ||
| """ | ||
| return self._value | ||
|
|
||
| @value.setter | ||
| def value(self, new_value): | ||
| if self._value == new_value: | ||
| return | ||
| self._value = new_value | ||
| self.observer.on_patch_value_changed(self) | ||
|
|
||
| def __repr__(self, *args, **kwargs): | ||
| return "<{} object as uri={}, value={} label={} at 0x{:x}>".format( | ||
| self.__class__.__name__, | ||
| self._uri, | ||
| self._value, | ||
| self._label, | ||
| id(self) | ||
| ) | ||
|
|
||
| @property | ||
| def json(self): | ||
| """ | ||
| Get a json decodable representation of this param | ||
|
|
||
| :return dict: json representation | ||
| """ | ||
| return self.__dict__ | ||
|
|
||
| @property | ||
| def __dict__(self): | ||
| return { | ||
| 'uri': self._uri, | ||
| 'label': self._label, | ||
| 'value': self._value | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This patch is specific for your user
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suppose that you need to create an entry into .gitignore for ignoring *.code-workspace