From 01f3af968395246312e990250f32c091b2e58f73 Mon Sep 17 00:00:00 2001 From: ttaschke Date: Thu, 29 Dec 2022 22:09:58 +0900 Subject: [PATCH 1/4] feat: add Fruity Blood overdrive plugin parser --- docs/reference/plugins.rst | 2 + pyflp/mixer.py | 2 + pyflp/plugin.py | 77 ++++++++++++++++++ .../assets/plugins/fruity-blood-overdrive.fst | Bin 0 -> 195 bytes tests/test_plugin.py | 10 +++ 5 files changed, 91 insertions(+) create mode 100644 tests/assets/plugins/fruity-blood-overdrive.fst diff --git a/docs/reference/plugins.rst b/docs/reference/plugins.rst index 7499c3f..7bc82bf 100644 --- a/docs/reference/plugins.rst +++ b/docs/reference/plugins.rst @@ -18,6 +18,8 @@ Effects .. autoclass:: FruityBalance :members: +.. autoclass:: FruityBloodOverdrive + :members: .. autoclass:: FruityCenter :members: .. autoclass:: FruityFastDist diff --git a/pyflp/mixer.py b/pyflp/mixer.py index 38f8233..3ee0f51 100644 --- a/pyflp/mixer.py +++ b/pyflp/mixer.py @@ -72,6 +72,7 @@ from .exceptions import ModelNotFound, NoModelsFound, PropertyCannotBeSet from .plugin import ( FruityBalance, + FruityBloodOverdrive, FruityCenter, FruityFastDist, FruityNotebook2, @@ -399,6 +400,7 @@ def __repr__(self) -> str: plugin = PluginProp( VSTPlugin, FruityBalance, + FruityBloodOverdrive, FruityCenter, FruityFastDist, FruityNotebook2, diff --git a/pyflp/plugin.py b/pyflp/plugin.py index a5d51a2..b0ca9f8 100644 --- a/pyflp/plugin.py +++ b/pyflp/plugin.py @@ -48,6 +48,7 @@ __all__ = [ "BooBass", "FruityBalance", + "FruityBloodOverdrive", "FruityFastDist", "FruityNotebook2", "FruitySend", @@ -88,6 +89,20 @@ class FruityBalanceEvent(StructEventBase): STRUCT = c.Struct("pan" / c.Int32ul, "volume" / c.Int32ul).compile() +class FruityBloodOverdriveEvent(StructEventBase): + STRUCT = c.Struct( + "plugin_marker" / c.Optional(c.Bytes(4)), # redesigned native plugin marker + "pre_band" / c.Int32ul, + "color" / c.Int32ul, + "pre_amp" / c.Int32ul, + "x100" / c.Flag, + "post_filter" / c.Int32ul, + "post_gain" / c.Int32ul, + "_u1" / c.Bytes(4), + "_u2" / c.Bytes(4), + ).compile() + + class FruityCenterEvent(StructEventBase): STRUCT = c.Struct( "_u1" / c.If(c.this._.len == 8, c.Bytes(4)), @@ -753,6 +768,68 @@ class FruityBalance(_PluginBase[FruityBalanceEvent], _IPlugin, ModelReprMixin): """ +class FruityBloodOverdrive( + _PluginBase[FruityBloodOverdriveEvent], _IPlugin, ModelReprMixin +): + """![]()""" # noqa + + INTERNAL_NAME = "Fruity Blood Overdrive" + + pre_band = _NativePluginProp[int]() + """Linear. + | Type | Value | Representation | + |---------|-------|----------------| + | Min | 0 | 0.0000 | + | Max | 10000 | 1.0000 | + | Default | 0 | 0.0000 | + """ + + color = _NativePluginProp[int]() + """Linear. + | Type | Value | Representation | + |---------|-------|----------------| + | Min | 0 | 0.0000 | + | Max | 10000 | 1.0000 | + | Default | 5000 | 0.5000 | + """ + + pre_amp = _NativePluginProp[int]() + """Linear. + | Type | Value | Representation | + |---------|-------|----------------| + | Min | 0 | 0.0000 | + | Max | 10000 | 1.0000 | + | Default | 0 | 0.0000 | + """ + + x100 = _NativePluginProp[bool]() + """Boolean. + | Type | Value | Representation | + |---------|-------|----------------| + | Off | 0 | Off | + | On | 1 | On | + | Default | 0 | Off | + """ + + post_filter = _NativePluginProp[int]() + """Linear. + | Type | Value | Representation | + |---------|-------|----------------| + | Min | 0 | 0.0000 | + | Max | 10000 | 1.0000 | + | Default | 0 | 0.0000 | + """ + + post_gain = _NativePluginProp[int]() + """Linear. + | Type | Value | Representation | + |---------|-------|----------------| + | Min | 0 | -1.0000 | + | Max | 10000 | 0.0000 | + | Default | 10000 | 0.0000 | + """ + + class FruityCenter(_PluginBase[FruityCenterEvent], _IPlugin, ModelReprMixin): """![](https://bit.ly/3TA9IIv)""" diff --git a/tests/assets/plugins/fruity-blood-overdrive.fst b/tests/assets/plugins/fruity-blood-overdrive.fst new file mode 100644 index 0000000000000000000000000000000000000000..6def34fe249e698fe931f81c084ee8ee0331292c GIT binary patch literal 195 zcmZ?s$w*;iU|=v{U|~pLaPvtiSqtPH=P@$Sv(z)xGcq=|WSFna$-p4PsLFIw&yAso zp_Cz$p@gB5L4m=EA%`I!2vdM;e}*!KRG@4M5NCqf3=CIHfM$UK6O?vjgffsQD Date: Mon, 27 Feb 2023 21:43:47 +0900 Subject: [PATCH 2/4] fix: formatting --- pyflp/plugin.py | 6 ++++++ tests/test_plugin.py | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/pyflp/plugin.py b/pyflp/plugin.py index b0ca9f8..66693e4 100644 --- a/pyflp/plugin.py +++ b/pyflp/plugin.py @@ -777,6 +777,7 @@ class FruityBloodOverdrive( pre_band = _NativePluginProp[int]() """Linear. + | Type | Value | Representation | |---------|-------|----------------| | Min | 0 | 0.0000 | @@ -786,6 +787,7 @@ class FruityBloodOverdrive( color = _NativePluginProp[int]() """Linear. + | Type | Value | Representation | |---------|-------|----------------| | Min | 0 | 0.0000 | @@ -795,6 +797,7 @@ class FruityBloodOverdrive( pre_amp = _NativePluginProp[int]() """Linear. + | Type | Value | Representation | |---------|-------|----------------| | Min | 0 | 0.0000 | @@ -804,6 +807,7 @@ class FruityBloodOverdrive( x100 = _NativePluginProp[bool]() """Boolean. + | Type | Value | Representation | |---------|-------|----------------| | Off | 0 | Off | @@ -813,6 +817,7 @@ class FruityBloodOverdrive( post_filter = _NativePluginProp[int]() """Linear. + | Type | Value | Representation | |---------|-------|----------------| | Min | 0 | 0.0000 | @@ -822,6 +827,7 @@ class FruityBloodOverdrive( post_gain = _NativePluginProp[int]() """Linear. + | Type | Value | Representation | |---------|-------|----------------| | Min | 0 | -1.0000 | diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 64c45ed..479de80 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -33,7 +33,9 @@ def test_fruity_balance(): def test_fruity_blood_overdrive(): - fruity_blood_overdrive = get_plugin("fruity-blood-overdrive.fst", FruityBloodOverdrive) + fruity_blood_overdrive = get_plugin( + "fruity-blood-overdrive.fst", FruityBloodOverdrive + ) assert fruity_blood_overdrive.pre_band == 0 assert fruity_blood_overdrive.color == 5000 assert fruity_blood_overdrive.pre_amp == 0 From 1234acaf9eaeddd779d505ab0299672fdfa6dcfb Mon Sep 17 00:00:00 2001 From: ttaschke Date: Mon, 27 Feb 2023 22:07:12 +0900 Subject: [PATCH 3/4] fix: plugin_marker and x100 parameter parsing --- pyflp/plugin.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pyflp/plugin.py b/pyflp/plugin.py index 66693e4..d28e12f 100644 --- a/pyflp/plugin.py +++ b/pyflp/plugin.py @@ -91,11 +91,11 @@ class FruityBalanceEvent(StructEventBase): class FruityBloodOverdriveEvent(StructEventBase): STRUCT = c.Struct( - "plugin_marker" / c.Optional(c.Bytes(4)), # redesigned native plugin marker + "plugin_marker" / c.If(c.this._.len == 36, c.Bytes(4)), # redesigned native plugin marker "pre_band" / c.Int32ul, "color" / c.Int32ul, "pre_amp" / c.Int32ul, - "x100" / c.Flag, + "x100" / FourByteBool, "post_filter" / c.Int32ul, "post_gain" / c.Int32ul, "_u1" / c.Bytes(4), From f12e0bcb53cbe4c769e36be96225b66ab3d0865f Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Mon, 27 Feb 2023 13:22:00 +0000 Subject: [PATCH 4/4] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- pyflp/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyflp/plugin.py b/pyflp/plugin.py index d28e12f..f353d7f 100644 --- a/pyflp/plugin.py +++ b/pyflp/plugin.py @@ -91,7 +91,8 @@ class FruityBalanceEvent(StructEventBase): class FruityBloodOverdriveEvent(StructEventBase): STRUCT = c.Struct( - "plugin_marker" / c.If(c.this._.len == 36, c.Bytes(4)), # redesigned native plugin marker + "plugin_marker" + / c.If(c.this._.len == 36, c.Bytes(4)), # redesigned native plugin marker "pre_band" / c.Int32ul, "color" / c.Int32ul, "pre_amp" / c.Int32ul,