-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Fix sys_effect. Improve banksmanager tests * Update Readme
- Loading branch information
1 parent
749de55
commit 2462037
Showing
11 changed files
with
192 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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,51 @@ | ||
from pluginsmanager.banks_manager import BanksManager | ||
from pluginsmanager.mod_host.mod_host import ModHost | ||
|
||
from pluginsmanager.model.bank import Bank | ||
from pluginsmanager.model.pedalboard import Pedalboard | ||
from pluginsmanager.model.connection import Connection | ||
|
||
from pluginsmanager.model.lv2.lv2_effect_builder import Lv2EffectBuilder | ||
|
||
from pluginsmanager.model.system.system_effect import SystemEffect | ||
|
||
|
||
if __name__ == '__main__': | ||
manager = BanksManager() | ||
|
||
bank = Bank('Bank 1') | ||
manager.append(bank) | ||
|
||
|
||
mod_host = ModHost('raspberrypi.local') | ||
mod_host.connect() | ||
manager.register(mod_host) | ||
|
||
|
||
pedalboard = Pedalboard('Rocksmith') | ||
bank.append(pedalboard) | ||
|
||
mod_host.pedalboard = pedalboard | ||
|
||
builder = Lv2EffectBuilder() | ||
|
||
reverb = builder.build('http://calf.sourceforge.net/plugins/Reverb') | ||
fuzz = builder.build('http://guitarix.sourceforge.net/plugins/gx_fuzz_#fuzz_') | ||
reverb2 = builder.build('http://calf.sourceforge.net/plugins/Reverb') | ||
|
||
pedalboard.append(reverb) | ||
pedalboard.append(fuzz) | ||
pedalboard.append(reverb2) | ||
|
||
sys_effect = SystemEffect('system', ['capture_1'], ['playback_1', 'playback_2']) | ||
|
||
pedalboard.connections.append(Connection(sys_effect.outputs[0], reverb.inputs[0])) | ||
|
||
reverb.outputs[0].connect(fuzz.inputs[0]) | ||
reverb.outputs[1].connect(fuzz.inputs[0]) | ||
fuzz.outputs[0].connect(reverb2.inputs[0]) | ||
reverb.outputs[0].connect(reverb2.inputs[0]) | ||
|
||
# Causes error | ||
reverb2.outputs[0].connect(sys_effect.inputs[0]) | ||
reverb2.outputs[0].connect(sys_effect.inputs[1]) |
This file contains 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 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,52 @@ | ||
import unittest | ||
from unittest.mock import MagicMock | ||
|
||
from pluginsmanager.banks_manager import BanksManager | ||
from pluginsmanager.model.bank import Bank | ||
from pluginsmanager.model.update_type import UpdateType | ||
from pluginsmanager.model.updates_observer import UpdatesObserver | ||
|
||
|
||
class Observer(UpdatesObserver): | ||
|
||
def on_bank_updated(self, bank, update_type, **kwargs): | ||
pass | ||
|
||
def on_pedalboard_updated(self, pedalboard, update_type, **kwargs): | ||
pass | ||
|
||
def on_effect_updated(self, effect, update_type, **kwargs): | ||
pass | ||
|
||
def on_effect_status_toggled(self, effect): | ||
pass | ||
|
||
def on_param_value_changed(self, param): | ||
pass | ||
|
||
def on_connection_updated(self, connection, update_type): | ||
pass | ||
|
||
|
||
class UpdatesObserverTest(unittest.TestCase): | ||
|
||
def test_notify(self): | ||
observer1 = Observer() | ||
observer1.on_bank_updated = MagicMock() | ||
observer2 = Observer() | ||
observer2.on_bank_updated = MagicMock() | ||
observer3 = Observer() | ||
observer3.on_bank_updated = MagicMock() | ||
|
||
manager = BanksManager() | ||
manager.register(observer1) | ||
manager.register(observer2) | ||
manager.register(observer3) | ||
|
||
bank = Bank('Bank 1') | ||
with observer1: | ||
manager.banks.append(bank) | ||
|
||
observer1.on_bank_updated.assert_not_called() | ||
observer2.on_bank_updated.assert_called_with(bank, UpdateType.CREATED, index=0, origin=manager) | ||
observer3.on_bank_updated.assert_called_with(bank, UpdateType.CREATED, index=0, origin=manager) |