gainlayer router implemented

reorganise package structure and update imports.

patch bump
This commit is contained in:
2026-04-05 22:42:32 +01:00
parent b7b35c796a
commit 3e65a2afea
12 changed files with 53 additions and 8 deletions

View File

@@ -0,0 +1,5 @@
"""module for strip-related endpoints, including the strip equalizer."""
from .strip import router
__all__ = ['router']

View File

@@ -0,0 +1,27 @@
"""module for strip compressor related endpoints."""
from fastapi import APIRouter, Depends
from vmr_http.dependencies import get_voicemeeter_client
from vmr_http.models.strip import StripCompParams
router = APIRouter()
@router.patch('')
@router.put('')
async def update_strip_comp_params(index: int, params: StripCompParams, voicemeeter=Depends(get_voicemeeter_client)):
"""Update one or more compressor parameters for the specified strip index."""
strip_comp = voicemeeter.strip[index].comp
updated = {}
for key, value in params.model_dump(exclude_unset=True).items():
setattr(strip_comp, key, value)
updated[key] = getattr(strip_comp, key)
return updated
@router.get('/knob')
async def get_strip_comp_knob(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current compressor knob value for the specified strip index."""
strip_comp = voicemeeter.strip[index].comp
return {'knob': strip_comp.knob}

View File

@@ -0,0 +1,32 @@
"""module for strip denoiser related endpoints."""
from fastapi import APIRouter, Depends
from vmr_http.dependencies import get_voicemeeter_client
from vmr_http.models.strip import StripDenoiserParams
router = APIRouter()
@router.patch('')
@router.put('')
async def update_strip_denoiser_params(
index: int, params: StripDenoiserParams, voicemeeter=Depends(get_voicemeeter_client)
):
"""Update one or more denoiser parameters for the specified strip index."""
strip_denoiser = voicemeeter.strip[index].denoiser
updated = {}
for key, value in params.model_dump(exclude_unset=True).items():
setattr(strip_denoiser, key, value)
updated[key] = getattr(strip_denoiser, key)
return updated
@router.get('/knob')
async def get_strip_denoiser_knob(
index: int,
voicemeeter=Depends(get_voicemeeter_client),
):
"""Get the denoiser knob value for the specified strip index."""
strip_denoiser = voicemeeter.strip[index].denoiser
return {'knob': strip_denoiser.knob}

View File

@@ -0,0 +1,27 @@
"""module for strip gain layer related endpoints."""
from fastapi import APIRouter, Body, Depends
from vmr_http.dependencies import get_voicemeeter_client
router = APIRouter()
@router.patch('')
@router.put('')
async def update_strip_comp_params(
index: int,
gainlayer_index: int,
level: float = Body(..., ge=-60.0, le=12.0, embed=True),
voicemeeter=Depends(get_voicemeeter_client),
):
"""Update one or more compressor parameters for the specified strip index."""
gainlayer = voicemeeter.strip[index].gainlayer[gainlayer_index]
gainlayer.gain = level
return {'gain_layer': {'level': gainlayer.gain}}
@router.get('/level')
async def get_strip_gain_layer_level(index: int, gainlayer_index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current gain layer level for the specified strip index."""
return {'gain_layer': {'level': voicemeeter.strip[index].gainlayer[gainlayer_index].gain}}

View File

@@ -0,0 +1,27 @@
"""module for strip gate related endpoints."""
from fastapi import APIRouter, Depends
from vmr_http.dependencies import get_voicemeeter_client
from vmr_http.models.strip import StripGateParams
router = APIRouter()
@router.patch('')
@router.put('')
async def update_strip_gate_params(index: int, params: StripGateParams, voicemeeter=Depends(get_voicemeeter_client)):
"""Update one or more gate parameters for the specified strip index."""
strip_gate = voicemeeter.strip[index].gate
updated = {}
for key, value in params.model_dump(exclude_unset=True).items():
setattr(strip_gate, key, value)
updated[key] = getattr(strip_gate, key)
return updated
@router.get('/knob')
async def get_strip_gate_knob(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current gate knob value for the specified strip index."""
strip_gate = voicemeeter.strip[index].gate
return {'knob': strip_gate.knob}

View File

@@ -0,0 +1,100 @@
"""module for strip-related endpoints."""
from fastapi import APIRouter, Depends
from vmr_http.dependencies import get_voicemeeter_client
from vmr_http.models.strip import StripParams
from vmr_http.web import eq
from . import comp, denoiser, gainlayer, gate
router = APIRouter()
router.include_router(gainlayer.router, prefix='/gainlayer/{gainlayer_index}', tags=['strip gainlayer'])
router.include_router(comp.router, prefix='/comp', tags=['strip comp'])
router.include_router(gate.router, prefix='/gate', tags=['strip gate'])
router.include_router(denoiser.router, prefix='/denoiser', tags=['strip denoiser'])
router.include_router(eq.create_router(eq_kind='strip'), prefix='/eq', tags=['strip eq'])
@router.patch('', tags=['strip'])
@router.put('', tags=['strip'])
async def update_strip_params(index: int, params: StripParams, voicemeeter=Depends(get_voicemeeter_client)):
"""Update one or more parameters for the specified strip index."""
strip = voicemeeter.strip[index]
updated = {}
for key, value in params.model_dump(exclude_unset=True).items():
setattr(strip, key, value)
updated[key] = getattr(strip, key)
return updated
@router.get('/gain', tags=['strip'])
async def get_gain(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current gain value for the specified strip index."""
return {'gain': voicemeeter.strip[index].gain}
@router.get('/mute', tags=['strip'])
async def get_mute(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current mute status for the specified strip index."""
return {'mute': voicemeeter.strip[index].mute}
@router.get('/mono', tags=['strip'])
async def get_mono(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current mono status for the specified strip index."""
return {'mono': voicemeeter.strip[index].mono}
@router.get('/solo', tags=['strip'])
async def get_solo(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current solo status for the specified strip index."""
return {'solo': voicemeeter.strip[index].solo}
@router.get('/A1', tags=['strip'])
async def get_A1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current A1 output status for the specified strip index."""
return {'A1': voicemeeter.strip[index].A1}
@router.get('/A2', tags=['strip'])
async def get_A2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current A2 output status for the specified strip index."""
return {'A2': voicemeeter.strip[index].A2}
@router.get('/A3', tags=['strip'])
async def get_A3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current A3 output status for the specified strip index."""
return {'A3': voicemeeter.strip[index].A3}
@router.get('/A4', tags=['strip'])
async def get_A4(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current A4 output status for the specified strip index."""
return {'A4': voicemeeter.strip[index].A4}
@router.get('/A5', tags=['strip'])
async def get_A5(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current A5 output status for the specified strip index."""
return {'A5': voicemeeter.strip[index].A5}
@router.get('/B1', tags=['strip'])
async def get_B1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current B1 output status for the specified strip index."""
return {'B1': voicemeeter.strip[index].B1}
@router.get('/B2', tags=['strip'])
async def get_B2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current B2 output status for the specified strip index."""
return {'B2': voicemeeter.strip[index].B2}
@router.get('/B3', tags=['strip'])
async def get_B3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
"""Get the current B3 output status for the specified strip index."""
return {'B3': voicemeeter.strip[index].B3}