mirror of
https://github.com/onyx-and-iris/vmr-http.git
synced 2026-04-07 02:13:31 +00:00
gainlayer router implemented
reorganise package structure and update imports. patch bump
This commit is contained in:
5
src/vmr_http/web/strip/__init__.py
Normal file
5
src/vmr_http/web/strip/__init__.py
Normal file
@@ -0,0 +1,5 @@
|
||||
"""module for strip-related endpoints, including the strip equalizer."""
|
||||
|
||||
from .strip import router
|
||||
|
||||
__all__ = ['router']
|
||||
27
src/vmr_http/web/strip/comp.py
Normal file
27
src/vmr_http/web/strip/comp.py
Normal 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}
|
||||
32
src/vmr_http/web/strip/denoiser.py
Normal file
32
src/vmr_http/web/strip/denoiser.py
Normal 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}
|
||||
27
src/vmr_http/web/strip/gainlayer.py
Normal file
27
src/vmr_http/web/strip/gainlayer.py
Normal 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}}
|
||||
27
src/vmr_http/web/strip/gate.py
Normal file
27
src/vmr_http/web/strip/gate.py
Normal 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}
|
||||
100
src/vmr_http/web/strip/strip.py
Normal file
100
src/vmr_http/web/strip/strip.py
Normal 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}
|
||||
Reference in New Issue
Block a user