diff --git a/src/vban_cli/comp.py b/src/vban_cli/comp.py new file mode 100644 index 0000000..f73a75f --- /dev/null +++ b/src/vban_cli/comp.py @@ -0,0 +1,67 @@ +from typing import Annotated + +from cyclopts import App, Argument, Parameter + +from .context import Context +from .help import CustomHelpFormatter + +app = App(name='comp', help_formatter=CustomHelpFormatter()) + + +@app.meta.default +def launcher( + *tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)], + index: Annotated[int, Argument()] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Control the compressor parameters.""" + additional_kwargs = {} + command, bound, _ = app.parse_args(tokens) + if index is not None: + additional_kwargs['index'] = index + if ctx is not None: + additional_kwargs['ctx'] = ctx + + return command(*bound.args, **bound.kwargs, **additional_kwargs) + + +@app.command(name='knob') +def knob( + new_knob: Annotated[float, Argument()] = None, + *, + index: Annotated[int, Parameter(show=False)] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Get or set the knob of the specified compressor. + + Parameters + ---------- + new_knob : int, optional + If provided, sets the knob to this value. If not provided, the current knob is printed. + """ + if new_knob is None: + # See https://github.com/onyx-and-iris/vban-cli?tab=readme-ov-file#implementation-notes - 2. + # console.out.print(ctx.client.strip[index].comp.knob) + return + ctx.client.strip[index].comp.knob = new_knob + + +@app.command(name='input-gain') +def input_gain( + new_gain: Annotated[float, Argument()] = None, + *, + index: Annotated[int, Parameter(show=False)] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Get or set the input gain of the specified compressor. + + Parameters + ---------- + new_gain : float, optional + If provided, sets the input gain to this value. If not provided, the current input gain is printed. + """ + if new_gain is None: + # See https://github.com/onyx-and-iris/vban-cli?tab=readme-ov-file#implementation-notes - 2. + # console.out.print(ctx.client.strip[index].comp.gainin) + return + ctx.client.strip[index].comp.gainin = new_gain diff --git a/src/vban_cli/denoiser.py b/src/vban_cli/denoiser.py new file mode 100644 index 0000000..06b38bf --- /dev/null +++ b/src/vban_cli/denoiser.py @@ -0,0 +1,46 @@ +from typing import Annotated + +from cyclopts import App, Argument, Parameter + +from .context import Context +from .help import CustomHelpFormatter + +app = App(name='denoiser', help_formatter=CustomHelpFormatter()) + + +@app.meta.default +def launcher( + *tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)], + index: Annotated[int, Argument()] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Control the denoiser parameters.""" + additional_kwargs = {} + command, bound, _ = app.parse_args(tokens) + if index is not None: + additional_kwargs['index'] = index + if ctx is not None: + additional_kwargs['ctx'] = ctx + + return command(*bound.args, **bound.kwargs, **additional_kwargs) + + +@app.command(name='knob') +def knob( + new_knob: Annotated[float, Argument()] = None, + *, + index: Annotated[int, Parameter(show=False)] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Get or set the knob of the specified denoiser. + + Parameters + ---------- + new_knob : int, optional + If provided, sets the knob to this value. If not provided, the current knob is printed. + """ + if new_knob is None: + # See https://github.com/onyx-and-iris/vban-cli?tab=readme-ov-file#implementation-notes - 2. + # console.out.print(ctx.client.strip[index].denoiser.knob) + return + ctx.client.strip[index].denoiser.knob = new_knob diff --git a/src/vban_cli/gate.py b/src/vban_cli/gate.py new file mode 100644 index 0000000..2149eaa --- /dev/null +++ b/src/vban_cli/gate.py @@ -0,0 +1,67 @@ +from typing import Annotated + +from cyclopts import App, Argument, Parameter + +from .context import Context +from .help import CustomHelpFormatter + +app = App(name='gate', help_formatter=CustomHelpFormatter()) + + +@app.meta.default +def launcher( + *tokens: Annotated[str, Parameter(show=False, allow_leading_hyphen=True)], + index: Annotated[int, Argument()] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Control the compressor parameters.""" + additional_kwargs = {} + command, bound, _ = app.parse_args(tokens) + if index is not None: + additional_kwargs['index'] = index + if ctx is not None: + additional_kwargs['ctx'] = ctx + + return command(*bound.args, **bound.kwargs, **additional_kwargs) + + +@app.command(name='knob') +def knob( + new_knob: Annotated[float, Argument()] = None, + *, + index: Annotated[int, Parameter(show=False)] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Get or set the knob of the specified gate. + + Parameters + ---------- + new_knob : int, optional + If provided, sets the knob to this value. If not provided, the current knob is printed. + """ + if new_knob is None: + # See https://github.com/onyx-and-iris/vban-cli?tab=readme-ov-file#implementation-notes - 2. + # console.out.print(ctx.client.strip[index].gate.knob) + return + ctx.client.strip[index].gate.knob = new_knob + + +@app.command(name='threshold') +def threshold( + new_threshold: Annotated[float, Argument()] = None, + *, + index: Annotated[int, Parameter(show=False)] = None, + ctx: Annotated[Context, Parameter(show=False)] = None, +): + """Get or set the threshold of the specified gate. + + Parameters + ---------- + new_threshold : float, optional + If provided, sets the threshold to this value. If not provided, the current threshold is printed. + """ + if new_threshold is None: + # See https://github.com/onyx-and-iris/vban-cli?tab=readme-ov-file#implementation-notes - 2. + # console.out.print(ctx.client.strip[index].gate.threshold) + return + ctx.client.strip[index].gate.threshold = new_threshold diff --git a/src/vban_cli/strip.py b/src/vban_cli/strip.py index 469512a..1dabb3e 100644 --- a/src/vban_cli/strip.py +++ b/src/vban_cli/strip.py @@ -2,12 +2,15 @@ from typing import Annotated, Optional from cyclopts import App, Argument, Parameter -from . import console, eq +from . import comp, console, denoiser, eq, gate from .context import Context from .help import CustomHelpFormatter app = App(name='strip', help_formatter=CustomHelpFormatter()) app.command(eq.app.meta, name='eq') +app.command(comp.app.meta, name='comp') +app.command(gate.app.meta, name='gate') +app.command(denoiser.app.meta, name='denoiser') @app.meta.default