Skip to content

Commit

Permalink
feat: Fruity Blood Overdrive (#120)
Browse files Browse the repository at this point in the history
* feat: add Fruity Blood overdrive plugin parser

* fix: formatting

* fix: plugin_marker and x100 parameter parsing

* [pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ttaschke and pre-commit-ci[bot] authored Mar 1, 2023
1 parent bd493c2 commit 71bc48a
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 0 deletions.
2 changes: 2 additions & 0 deletions docs/reference/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Effects

.. autoclass:: FruityBalance
:members:
.. autoclass:: FruityBloodOverdrive
:members:
.. autoclass:: FruityCenter
:members:
.. autoclass:: FruityFastDist
Expand Down
2 changes: 2 additions & 0 deletions pyflp/mixer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
from .exceptions import ModelNotFound, NoModelsFound, PropertyCannotBeSet
from .plugin import (
FruityBalance,
FruityBloodOverdrive,
FruityCenter,
FruityFastDist,
FruityNotebook2,
Expand Down Expand Up @@ -399,6 +400,7 @@ def __repr__(self) -> str:
plugin = PluginProp(
VSTPlugin,
FruityBalance,
FruityBloodOverdrive,
FruityCenter,
FruityFastDist,
FruityNotebook2,
Expand Down
84 changes: 84 additions & 0 deletions pyflp/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
__all__ = [
"BooBass",
"FruityBalance",
"FruityBloodOverdrive",
"FruityFastDist",
"FruityNotebook2",
"FruitySend",
Expand Down Expand Up @@ -88,6 +89,21 @@ class FruityBalanceEvent(StructEventBase):
STRUCT = c.Struct("pan" / c.Int32ul, "volume" / c.Int32ul).compile()


class FruityBloodOverdriveEvent(StructEventBase):
STRUCT = c.Struct(
"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" / FourByteBool,
"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)),
Expand Down Expand Up @@ -753,6 +769,74 @@ 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)"""

Expand Down
Binary file added tests/assets/plugins/fruity-blood-overdrive.fst
Binary file not shown.
12 changes: 12 additions & 0 deletions tests/test_plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from pyflp.plugin import (
AnyPlugin,
FruityBalance,
FruityBloodOverdrive,
FruityCenter,
FruityFastDist,
FruitySend,
Expand All @@ -31,6 +32,17 @@ def test_fruity_balance():
assert fruity_balance.pan == 0


def test_fruity_blood_overdrive():
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
assert fruity_blood_overdrive.x100 == 0
assert fruity_blood_overdrive.post_filter == 0


def test_fruity_center():
fruity_center = get_plugin("fruity-center.fst", FruityCenter)
assert not fruity_center.enabled
Expand Down

0 comments on commit 71bc48a

Please sign in to comment.