mirror of
https://github.com/onyx-and-iris/vban-cli.git
synced 2026-03-03 05:29:11 +00:00
implement eq subcommand group + on subcommand
attach it to parent command group strip. we can't do the same for bus because VBAN doesn't yet define a packet structure defining those parameters.
This commit is contained in:
parent
1e76c2afd9
commit
837d63d789
@ -7,6 +7,9 @@ from .context import Context
|
|||||||
from .help import CustomHelpFormatter
|
from .help import CustomHelpFormatter
|
||||||
|
|
||||||
app = App(name='bus', help_formatter=CustomHelpFormatter())
|
app = App(name='bus', help_formatter=CustomHelpFormatter())
|
||||||
|
# The VBAN protocl does not yet define a packet structure for these bus parameters.
|
||||||
|
# Hopefully that will come in the form of a 'VBAN_VMPARAMBUS_PACKET'.
|
||||||
|
# app.command(eq.app.meta, name='eq')
|
||||||
|
|
||||||
|
|
||||||
@app.meta.default
|
@app.meta.default
|
||||||
|
|||||||
53
src/vmr_cli/eq.py
Normal file
53
src/vmr_cli/eq.py
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
from typing import Annotated
|
||||||
|
|
||||||
|
from cyclopts import App, Argument, Parameter
|
||||||
|
|
||||||
|
from .context import Context
|
||||||
|
from .help import CustomHelpFormatter
|
||||||
|
|
||||||
|
app = App(name='eq', help_formatter=CustomHelpFormatter())
|
||||||
|
|
||||||
|
|
||||||
|
@app.meta.default
|
||||||
|
def launcher(
|
||||||
|
band: Annotated[int, Argument()] = None,
|
||||||
|
*tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)],
|
||||||
|
index: Annotated[int, Argument()] = None,
|
||||||
|
ctx: Annotated[Context, Parameter(show=False)] = None,
|
||||||
|
):
|
||||||
|
"""Control the EQ parameters.
|
||||||
|
|
||||||
|
Only channel 0 is supported, as the VBAN protocol only exposes parameters for this channel.
|
||||||
|
"""
|
||||||
|
additional_kwargs = {}
|
||||||
|
command, bound, _ = app.parse_args(tokens)
|
||||||
|
if index is not None:
|
||||||
|
additional_kwargs['index'] = index
|
||||||
|
if band is not None:
|
||||||
|
additional_kwargs['band'] = band
|
||||||
|
if ctx is not None:
|
||||||
|
additional_kwargs['ctx'] = ctx
|
||||||
|
|
||||||
|
return command(*bound.args, **bound.kwargs, **additional_kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
@app.command(name='on')
|
||||||
|
def on(
|
||||||
|
new_state: Annotated[bool, Argument()] = None,
|
||||||
|
*,
|
||||||
|
index: Annotated[int, Parameter(show=False)] = None,
|
||||||
|
band: Annotated[int, Parameter(show=False)] = None,
|
||||||
|
ctx: Annotated[Context, Parameter(show=False)] = None,
|
||||||
|
):
|
||||||
|
"""Get or set the on state of the specified EQ band.
|
||||||
|
|
||||||
|
Parameters
|
||||||
|
----------
|
||||||
|
new_state : bool
|
||||||
|
If provided, sets the on state to this value. If not provided, the current on state is printed.
|
||||||
|
"""
|
||||||
|
if new_state is None:
|
||||||
|
# This doesn't work because the VBAN protocol doesn't send an initial NBS1 packet.
|
||||||
|
# console.out.print(ctx.client.strip[index].eq.channel[0].cell[band].on)
|
||||||
|
return
|
||||||
|
ctx.client.strip[index].eq.channel[0].cell[band].on = new_state
|
||||||
@ -2,11 +2,12 @@ from typing import Annotated, Optional
|
|||||||
|
|
||||||
from cyclopts import App, Argument, Parameter
|
from cyclopts import App, Argument, Parameter
|
||||||
|
|
||||||
from . import console
|
from . import console, eq
|
||||||
from .context import Context
|
from .context import Context
|
||||||
from .help import CustomHelpFormatter
|
from .help import CustomHelpFormatter
|
||||||
|
|
||||||
app = App(name='strip', help_formatter=CustomHelpFormatter())
|
app = App(name='strip', help_formatter=CustomHelpFormatter())
|
||||||
|
app.command(eq.app.meta, name='eq')
|
||||||
|
|
||||||
|
|
||||||
@app.meta.default
|
@app.meta.default
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user