mirror of
https://github.com/onyx-and-iris/vmr-http.git
synced 2026-04-06 18:09:11 +00:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d20fb52d4b | |||
| 6ef9be7a61 | |||
| 16cfb420cf | |||
| 2ebf926b22 | |||
| cd80c7b763 |
28
README.md
28
README.md
@@ -14,15 +14,15 @@ pip install vmr-http
|
|||||||
## Run
|
## Run
|
||||||
|
|
||||||
```console
|
```console
|
||||||
uvicorn vmr_http.app:app
|
uvicorn vmr_http:app
|
||||||
```
|
```
|
||||||
|
|
||||||
## Use
|
## Use
|
||||||
|
|
||||||
*Set multiple Strip parameters at once*
|
*Set multiple Strip 0 parameters at once*
|
||||||
|
|
||||||
```console
|
```console
|
||||||
curl -X 'PUT' \
|
curl -X 'PATCH' \
|
||||||
'http://127.0.0.1:8000/strip/0' \
|
'http://127.0.0.1:8000/strip/0' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
@@ -38,19 +38,19 @@ curl -X 'PUT' \
|
|||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
*Set Strip mute*
|
*Set Strip 1 mute*
|
||||||
|
|
||||||
```console
|
```console
|
||||||
curl -X 'PUT' \
|
curl -X 'PATCH' \
|
||||||
'http://127.0.0.1:8000/strip/1/mute' \
|
'http://127.0.0.1:8000/strip/1' \
|
||||||
-H 'accept: application/json' \
|
-H 'accept: application/json' \
|
||||||
-H 'Content-Type: application/json' \
|
-H 'Content-Type: application/json' \
|
||||||
-d '{
|
-d '{
|
||||||
"mute": true
|
"mute": true,
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
*Get Bus gain*
|
*Get Bus 3 gain*
|
||||||
|
|
||||||
```console
|
```console
|
||||||
curl -X 'GET' \
|
curl -X 'GET' \
|
||||||
@@ -58,11 +58,19 @@ curl -X 'GET' \
|
|||||||
-H 'accept: application/json'
|
-H 'accept: application/json'
|
||||||
```
|
```
|
||||||
|
|
||||||
*Get Bus Mode*
|
*Get Bus 4 Mode*
|
||||||
|
|
||||||
```console
|
```console
|
||||||
curl -X 'GET' \
|
curl -X 'GET' \
|
||||||
'http://127.0.0.1:8000/bus/mode/4/mode' \
|
'http://127.0.0.1:8000/bus/4/mode' \
|
||||||
|
-H 'accept: application/json'
|
||||||
|
```
|
||||||
|
|
||||||
|
*Healthcheck*
|
||||||
|
|
||||||
|
```console
|
||||||
|
curl -X 'GET' \
|
||||||
|
'http://127.0.0.1:8000/health' \
|
||||||
-H 'accept: application/json'
|
-H 'accept: application/json'
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "vmr-http"
|
name = "vmr-http"
|
||||||
version = "0.2.0"
|
version = "0.3.1"
|
||||||
description = "HTTP API for controlling Voicemeeter"
|
description = "HTTP API for controlling Voicemeeter"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||||
requires-python = ">=3.10"
|
requires-python = ">=3.10"
|
||||||
dependencies = [
|
dependencies = ["fastapi>=0.135.3", "uvicorn>=0.43.0", "voicemeeter-api>=2.7.2"]
|
||||||
"fastapi>=0.135.3",
|
|
||||||
"uvicorn>=0.43.0",
|
|
||||||
"voicemeeter-api>=2.7.2",
|
|
||||||
]
|
|
||||||
classifiers = [
|
classifiers = [
|
||||||
"Development Status :: 4 - Beta",
|
"Development Status :: 4 - Beta",
|
||||||
"Programming Language :: Python",
|
"Programming Language :: Python",
|
||||||
@@ -26,14 +22,10 @@ requires = ["uv_build>=0.11.3,<0.12.0"]
|
|||||||
build-backend = "uv_build"
|
build-backend = "uv_build"
|
||||||
|
|
||||||
[dependency-groups]
|
[dependency-groups]
|
||||||
dev = [
|
dev = ["fastapi[standard]>=0.135.3", "poethepoet>=0.43.0", "ruff>=0.15.9"]
|
||||||
"fastapi[standard]>=0.135.3",
|
|
||||||
"poethepoet>=0.43.0",
|
|
||||||
"ruff>=0.15.9",
|
|
||||||
]
|
|
||||||
|
|
||||||
[tool.fastapi]
|
[tool.fastapi]
|
||||||
entrypoint = "vmr_http.app:app"
|
entrypoint = "vmr_http:app"
|
||||||
|
|
||||||
[tool.uv.sources]
|
[tool.uv.sources]
|
||||||
voicemeeter-api = { path = "../voicemeeter-api-python", editable = true }
|
voicemeeter-api = { path = "../voicemeeter-api-python", editable = true }
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
"""Voicemeeter HTTP API."""
|
||||||
|
|
||||||
|
from .app import app
|
||||||
|
|
||||||
|
__all__ = ['app']
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ app.include_router(bus.router, prefix='/bus')
|
|||||||
def health_check(voicemeeter=Depends(get_voicemeeter_client)):
|
def health_check(voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Health check endpoint to verify the service is running."""
|
"""Health check endpoint to verify the service is running."""
|
||||||
try:
|
try:
|
||||||
version = voicemeeter.version # Check if we can communicate with Voicemeeter
|
version = voicemeeter.version
|
||||||
type_ = voicemeeter.type
|
type_ = voicemeeter.type
|
||||||
except CAPIError as e:
|
except CAPIError as e:
|
||||||
raise HTTPException(status_code=503, detail=f'Voicemeeter API error: {str(e)}')
|
raise HTTPException(status_code=503, detail=f'Voicemeeter API error: {str(e)}')
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for bus-related endpoints."""
|
"""module for bus-related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
from vmr_http.models.bus import BusParams
|
from vmr_http.models.bus import BusParams
|
||||||
@@ -8,17 +8,19 @@ from vmr_http.models.bus import BusParams
|
|||||||
from . import busmode
|
from . import busmode
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
router.include_router(busmode.router, prefix='/mode', tags=['bus mode'])
|
router.include_router(busmode.router, tags=['bus mode'])
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch('/{index}', tags=['bus'])
|
||||||
@router.put('/{index}', tags=['bus'])
|
@router.put('/{index}', tags=['bus'])
|
||||||
async def set_bus_params(index: int, request: BusParams, voicemeeter=Depends(get_voicemeeter_client)):
|
async def update_bus_params(index: int, params: BusParams, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Set multiple parameters of a bus at once."""
|
"""Update one or more parameters for the specified bus index."""
|
||||||
bus = voicemeeter.bus[index]
|
bus = voicemeeter.bus[index]
|
||||||
for key, value in request.model_dump(exclude_unset=True).items():
|
updated = {}
|
||||||
|
for key, value in params.model_dump(exclude_unset=True).items():
|
||||||
setattr(bus, key, value)
|
setattr(bus, key, value)
|
||||||
|
updated[key] = getattr(bus, key)
|
||||||
return {key: getattr(bus, key) for key in request.model_dump(exclude_unset=True)}
|
return updated
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/gain', tags=['bus'])
|
@router.get('/{index}/gain', tags=['bus'])
|
||||||
@@ -27,29 +29,7 @@ async def get_gain(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
|||||||
return {'gain': voicemeeter.bus[index].gain}
|
return {'gain': voicemeeter.bus[index].gain}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/gain', tags=['bus'])
|
|
||||||
async def set_gain(
|
|
||||||
index: int,
|
|
||||||
gain: float = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the gain value for the specified bus index."""
|
|
||||||
voicemeeter.bus[index].gain = gain
|
|
||||||
return {'gain': voicemeeter.bus[index].gain}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/mute', tags=['bus'])
|
@router.get('/{index}/mute', tags=['bus'])
|
||||||
async def get_mute(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_mute(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current mute status for the specified bus index."""
|
"""Get the current mute status for the specified bus index."""
|
||||||
return {'mute': voicemeeter.bus[index].mute}
|
return {'mute': voicemeeter.bus[index].mute}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/mute', tags=['bus'])
|
|
||||||
async def set_mute(
|
|
||||||
index: int,
|
|
||||||
mute: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the mute status for the specified bus index."""
|
|
||||||
voicemeeter.bus[index].mute = mute
|
|
||||||
return {'mute': voicemeeter.bus[index].mute}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for bus mode related endpoints."""
|
"""module for bus mode related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends, HTTPException
|
from fastapi import APIRouter, Depends, HTTPException
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
|
|
||||||
@@ -23,23 +23,19 @@ _readable_busmodes = {
|
|||||||
_reversed_busmodes = {v: k for k, v in _readable_busmodes.items()}
|
_reversed_busmodes = {v: k for k, v in _readable_busmodes.items()}
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}')
|
@router.patch('/{index}/mode')
|
||||||
async def get_bus_mode(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
@router.put('/{index}/mode')
|
||||||
"""Get the current bus mode for the specified bus index."""
|
async def update_bus_mode(index: int, mode: str, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
return {'mode': _readable_busmodes.get(voicemeeter.bus[index].mode.get(), 'Unknown')}
|
"""Update the bus mode for the specified bus index."""
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}')
|
|
||||||
async def set_bus_mode(
|
|
||||||
index: int,
|
|
||||||
mode: str = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the bus mode for the specified bus index."""
|
|
||||||
if mode not in _reversed_busmodes:
|
if mode not in _reversed_busmodes:
|
||||||
raise HTTPException(
|
raise HTTPException(
|
||||||
status_code=400, detail=f'Invalid mode. Valid modes are: {", ".join(_reversed_busmodes.keys())}'
|
status_code=400, detail=f'Invalid mode. Valid modes are: {", ".join(_reversed_busmodes.keys())}'
|
||||||
)
|
)
|
||||||
|
|
||||||
setattr(voicemeeter.bus[index].mode, _reversed_busmodes[mode], True)
|
setattr(voicemeeter.bus[index].mode, _reversed_busmodes[mode], True)
|
||||||
return {'mode': _readable_busmodes[_reversed_busmodes[mode]]}
|
return {'mode': _readable_busmodes[_reversed_busmodes[mode]]}
|
||||||
|
|
||||||
|
|
||||||
|
@router.get('/{index}/mode')
|
||||||
|
async def get_bus_mode(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
|
"""Get the current bus mode for the specified bus index."""
|
||||||
|
return {'mode': _readable_busmodes.get(voicemeeter.bus[index].mode.get(), 'Unknown')}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for strip-related endpoints."""
|
"""module for strip-related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
from vmr_http.models.strip import StripParams
|
from vmr_http.models.strip import StripParams
|
||||||
@@ -13,14 +13,16 @@ router.include_router(stripgate.router, prefix='/gate', tags=['strip gate'])
|
|||||||
router.include_router(stripdenoiser.router, prefix='/denoiser', tags=['strip denoiser'])
|
router.include_router(stripdenoiser.router, prefix='/denoiser', tags=['strip denoiser'])
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch('/{index}', tags=['strip'])
|
||||||
@router.put('/{index}', tags=['strip'])
|
@router.put('/{index}', tags=['strip'])
|
||||||
async def set_strip_params(index: int, request: StripParams, voicemeeter=Depends(get_voicemeeter_client)):
|
async def update_strip_params(index: int, params: StripParams, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Set the parameters for the specified strip index."""
|
"""Update one or more parameters for the specified strip index."""
|
||||||
strip = voicemeeter.strip[index]
|
strip = voicemeeter.strip[index]
|
||||||
for key, value in request.model_dump(exclude_unset=True).items():
|
updated = {}
|
||||||
|
for key, value in params.model_dump(exclude_unset=True).items():
|
||||||
setattr(strip, key, value)
|
setattr(strip, key, value)
|
||||||
|
updated[key] = getattr(strip, key)
|
||||||
return {key: getattr(strip, key) for key in request.model_dump(exclude_unset=True)}
|
return updated
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/gain', tags=['strip'])
|
@router.get('/{index}/gain', tags=['strip'])
|
||||||
@@ -29,199 +31,67 @@ async def get_gain(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
|||||||
return {'gain': voicemeeter.strip[index].gain}
|
return {'gain': voicemeeter.strip[index].gain}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/gain', tags=['strip'])
|
|
||||||
async def set_gain(
|
|
||||||
index: int,
|
|
||||||
gain: float = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the gain value for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].gain = gain
|
|
||||||
return {'gain': voicemeeter.strip[index].gain}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/mute', tags=['strip'])
|
@router.get('/{index}/mute', tags=['strip'])
|
||||||
async def get_mute(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_mute(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current mute status for the specified strip index."""
|
"""Get the current mute status for the specified strip index."""
|
||||||
return {'mute': voicemeeter.strip[index].mute}
|
return {'mute': voicemeeter.strip[index].mute}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/mute', tags=['strip'])
|
|
||||||
async def set_mute(
|
|
||||||
index: int,
|
|
||||||
mute: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the mute status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].mute = mute
|
|
||||||
return {'mute': voicemeeter.strip[index].mute}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/mono', tags=['strip'])
|
@router.get('/{index}/mono', tags=['strip'])
|
||||||
async def get_mono(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_mono(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current mono status for the specified strip index."""
|
"""Get the current mono status for the specified strip index."""
|
||||||
return {'mono': voicemeeter.strip[index].mono}
|
return {'mono': voicemeeter.strip[index].mono}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/mono', tags=['strip'])
|
|
||||||
async def set_mono(
|
|
||||||
index: int,
|
|
||||||
mono: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the mono status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].mono = mono
|
|
||||||
return {'mono': voicemeeter.strip[index].mono}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/solo', tags=['strip'])
|
@router.get('/{index}/solo', tags=['strip'])
|
||||||
async def get_solo(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_solo(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current solo status for the specified strip index."""
|
"""Get the current solo status for the specified strip index."""
|
||||||
return {'solo': voicemeeter.strip[index].solo}
|
return {'solo': voicemeeter.strip[index].solo}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/solo', tags=['strip'])
|
|
||||||
async def set_solo(
|
|
||||||
index: int,
|
|
||||||
solo: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the solo status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].solo = solo
|
|
||||||
return {'solo': voicemeeter.strip[index].solo}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/A1', tags=['strip'])
|
@router.get('/{index}/A1', tags=['strip'])
|
||||||
async def get_A1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_A1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current A1 output status for the specified strip index."""
|
"""Get the current A1 output status for the specified strip index."""
|
||||||
return {'A1': voicemeeter.strip[index].A1}
|
return {'A1': voicemeeter.strip[index].A1}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/A1', tags=['strip'])
|
|
||||||
async def set_A1(
|
|
||||||
index: int,
|
|
||||||
A1: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the A1 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].A1 = A1
|
|
||||||
return {'A1': voicemeeter.strip[index].A1}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/A2', tags=['strip'])
|
@router.get('/{index}/A2', tags=['strip'])
|
||||||
async def get_A2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_A2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current A2 output status for the specified strip index."""
|
"""Get the current A2 output status for the specified strip index."""
|
||||||
return {'A2': voicemeeter.strip[index].A2}
|
return {'A2': voicemeeter.strip[index].A2}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/A2', tags=['strip'])
|
|
||||||
async def set_A2(
|
|
||||||
index: int,
|
|
||||||
A2: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the A2 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].A2 = A2
|
|
||||||
return {'A2': voicemeeter.strip[index].A2}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/A3', tags=['strip'])
|
@router.get('/{index}/A3', tags=['strip'])
|
||||||
async def get_A3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_A3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current A3 output status for the specified strip index."""
|
"""Get the current A3 output status for the specified strip index."""
|
||||||
return {'A3': voicemeeter.strip[index].A3}
|
return {'A3': voicemeeter.strip[index].A3}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/A3', tags=['strip'])
|
|
||||||
async def set_A3(
|
|
||||||
index: int,
|
|
||||||
A3: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the A3 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].A3 = A3
|
|
||||||
return {'A3': voicemeeter.strip[index].A3}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/A4', tags=['strip'])
|
@router.get('/{index}/A4', tags=['strip'])
|
||||||
async def get_A4(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_A4(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current A4 output status for the specified strip index."""
|
"""Get the current A4 output status for the specified strip index."""
|
||||||
return {'A4': voicemeeter.strip[index].A4}
|
return {'A4': voicemeeter.strip[index].A4}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/A4', tags=['strip'])
|
|
||||||
async def set_A4(
|
|
||||||
index: int,
|
|
||||||
A4: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the A4 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].A4 = A4
|
|
||||||
return {'A4': voicemeeter.strip[index].A4}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/A5', tags=['strip'])
|
@router.get('/{index}/A5', tags=['strip'])
|
||||||
async def get_A5(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_A5(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current A5 output status for the specified strip index."""
|
"""Get the current A5 output status for the specified strip index."""
|
||||||
return {'A5': voicemeeter.strip[index].A5}
|
return {'A5': voicemeeter.strip[index].A5}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/A5', tags=['strip'])
|
|
||||||
async def set_A5(
|
|
||||||
index: int,
|
|
||||||
A5: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the A5 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].A5 = A5
|
|
||||||
return {'A5': voicemeeter.strip[index].A5}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/B1', tags=['strip'])
|
@router.get('/{index}/B1', tags=['strip'])
|
||||||
async def get_B1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_B1(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current B1 output status for the specified strip index."""
|
"""Get the current B1 output status for the specified strip index."""
|
||||||
return {'B1': voicemeeter.strip[index].B1}
|
return {'B1': voicemeeter.strip[index].B1}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/B1', tags=['strip'])
|
|
||||||
async def set_B1(
|
|
||||||
index: int,
|
|
||||||
B1: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the B1 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].B1 = B1
|
|
||||||
return {'B1': voicemeeter.strip[index].B1}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/B2', tags=['strip'])
|
@router.get('/{index}/B2', tags=['strip'])
|
||||||
async def get_B2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_B2(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current B2 output status for the specified strip index."""
|
"""Get the current B2 output status for the specified strip index."""
|
||||||
return {'B2': voicemeeter.strip[index].B2}
|
return {'B2': voicemeeter.strip[index].B2}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/B2', tags=['strip'])
|
|
||||||
async def set_B2(
|
|
||||||
index: int,
|
|
||||||
B2: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the B2 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].B2 = B2
|
|
||||||
return {'B2': voicemeeter.strip[index].B2}
|
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/B3', tags=['strip'])
|
@router.get('/{index}/B3', tags=['strip'])
|
||||||
async def get_B3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
async def get_B3(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Get the current B3 output status for the specified strip index."""
|
"""Get the current B3 output status for the specified strip index."""
|
||||||
return {'B3': voicemeeter.strip[index].B3}
|
return {'B3': voicemeeter.strip[index].B3}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/B3', tags=['strip'])
|
|
||||||
async def set_B3(
|
|
||||||
index: int,
|
|
||||||
B3: bool = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the B3 output status for the specified strip index."""
|
|
||||||
voicemeeter.strip[index].B3 = B3
|
|
||||||
return {'B3': voicemeeter.strip[index].B3}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for strip compressor related endpoints."""
|
"""module for strip compressor related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
from vmr_http.models.strip import StripCompParams
|
from vmr_http.models.strip import StripCompParams
|
||||||
@@ -8,14 +8,16 @@ from vmr_http.models.strip import StripCompParams
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch('/{index}/comp')
|
||||||
@router.put('/{index}/comp')
|
@router.put('/{index}/comp')
|
||||||
async def set_strip_comp_params(index: int, request: StripCompParams, voicemeeter=Depends(get_voicemeeter_client)):
|
async def update_strip_comp_params(index: int, params: StripCompParams, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Set the compressor parameters for the specified strip index."""
|
"""Update one or more compressor parameters for the specified strip index."""
|
||||||
strip_comp = voicemeeter.strip[index].comp
|
strip_comp = voicemeeter.strip[index].comp
|
||||||
for key, value in request.model_dump(exclude_unset=True).items():
|
updated = {}
|
||||||
|
for key, value in params.model_dump(exclude_unset=True).items():
|
||||||
setattr(strip_comp, key, value)
|
setattr(strip_comp, key, value)
|
||||||
|
updated[key] = getattr(strip_comp, key)
|
||||||
return {key: getattr(strip_comp, key) for key in request.model_dump(exclude_unset=True)}
|
return updated
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/comp/knob')
|
@router.get('/{index}/comp/knob')
|
||||||
@@ -23,15 +25,3 @@ async def get_strip_comp_knob(index: int, voicemeeter=Depends(get_voicemeeter_cl
|
|||||||
"""Get the current compressor knob value for the specified strip index."""
|
"""Get the current compressor knob value for the specified strip index."""
|
||||||
strip_comp = voicemeeter.strip[index].comp
|
strip_comp = voicemeeter.strip[index].comp
|
||||||
return {'knob': strip_comp.knob}
|
return {'knob': strip_comp.knob}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/comp/knob')
|
|
||||||
async def set_strip_comp_knob(
|
|
||||||
index: int,
|
|
||||||
knob: float = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the compressor knob value for the specified strip index."""
|
|
||||||
strip_comp = voicemeeter.strip[index].comp
|
|
||||||
strip_comp.knob = knob
|
|
||||||
return {'knob': strip_comp.knob}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for strip denoiser related endpoints."""
|
"""module for strip denoiser related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
from vmr_http.models.strip import StripDenoiserParams
|
from vmr_http.models.strip import StripDenoiserParams
|
||||||
@@ -8,18 +8,18 @@ from vmr_http.models.strip import StripDenoiserParams
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch('/{index}/denoiser')
|
||||||
@router.put('/{index}/denoiser')
|
@router.put('/{index}/denoiser')
|
||||||
async def set_strip_denoiser_params(
|
async def update_strip_denoiser_params(
|
||||||
index: int,
|
index: int, params: StripDenoiserParams, voicemeeter=Depends(get_voicemeeter_client)
|
||||||
request: StripDenoiserParams,
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
):
|
||||||
"""Set the denoiser parameters for the specified strip index."""
|
"""Update one or more denoiser parameters for the specified strip index."""
|
||||||
strip_denoiser = voicemeeter.strip[index].denoiser
|
strip_denoiser = voicemeeter.strip[index].denoiser
|
||||||
for key, value in request.model_dump(exclude_unset=True).items():
|
updated = {}
|
||||||
|
for key, value in params.model_dump(exclude_unset=True).items():
|
||||||
setattr(strip_denoiser, key, value)
|
setattr(strip_denoiser, key, value)
|
||||||
|
updated[key] = getattr(strip_denoiser, key)
|
||||||
return {key: getattr(strip_denoiser, key) for key in request.model_dump(exclude_unset=True)}
|
return updated
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/denoiser/knob')
|
@router.get('/{index}/denoiser/knob')
|
||||||
@@ -30,15 +30,3 @@ async def get_strip_denoiser_knob(
|
|||||||
"""Get the denoiser knob value for the specified strip index."""
|
"""Get the denoiser knob value for the specified strip index."""
|
||||||
strip_denoiser = voicemeeter.strip[index].denoiser
|
strip_denoiser = voicemeeter.strip[index].denoiser
|
||||||
return {'knob': strip_denoiser.knob}
|
return {'knob': strip_denoiser.knob}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/denoiser/knob')
|
|
||||||
async def set_strip_denoiser_knob(
|
|
||||||
index: int,
|
|
||||||
knob: float = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the denoiser knob value for the specified strip index."""
|
|
||||||
strip_denoiser = voicemeeter.strip[index].denoiser
|
|
||||||
strip_denoiser.knob = knob
|
|
||||||
return {'knob': strip_denoiser.knob}
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
"""module for strip gate related endpoints."""
|
"""module for strip gate related endpoints."""
|
||||||
|
|
||||||
from fastapi import APIRouter, Body, Depends
|
from fastapi import APIRouter, Depends
|
||||||
|
|
||||||
from vmr_http.dependencies import get_voicemeeter_client
|
from vmr_http.dependencies import get_voicemeeter_client
|
||||||
from vmr_http.models.strip import StripGateParams
|
from vmr_http.models.strip import StripGateParams
|
||||||
@@ -8,14 +8,16 @@ from vmr_http.models.strip import StripGateParams
|
|||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
|
|
||||||
|
|
||||||
|
@router.patch('/{index}/gate')
|
||||||
@router.put('/{index}/gate')
|
@router.put('/{index}/gate')
|
||||||
async def set_strip_gate_params(index: int, request: StripGateParams, voicemeeter=Depends(get_voicemeeter_client)):
|
async def update_strip_gate_params(index: int, params: StripGateParams, voicemeeter=Depends(get_voicemeeter_client)):
|
||||||
"""Set the gate parameters for the specified strip index."""
|
"""Update one or more gate parameters for the specified strip index."""
|
||||||
strip_gate = voicemeeter.strip[index].gate
|
strip_gate = voicemeeter.strip[index].gate
|
||||||
for key, value in request.model_dump(exclude_unset=True).items():
|
updated = {}
|
||||||
|
for key, value in params.model_dump(exclude_unset=True).items():
|
||||||
setattr(strip_gate, key, value)
|
setattr(strip_gate, key, value)
|
||||||
|
updated[key] = getattr(strip_gate, key)
|
||||||
return {key: getattr(strip_gate, key) for key in request.model_dump(exclude_unset=True)}
|
return updated
|
||||||
|
|
||||||
|
|
||||||
@router.get('/{index}/gate/knob')
|
@router.get('/{index}/gate/knob')
|
||||||
@@ -23,15 +25,3 @@ async def get_strip_gate_knob(index: int, voicemeeter=Depends(get_voicemeeter_cl
|
|||||||
"""Get the current gate knob value for the specified strip index."""
|
"""Get the current gate knob value for the specified strip index."""
|
||||||
strip_gate = voicemeeter.strip[index].gate
|
strip_gate = voicemeeter.strip[index].gate
|
||||||
return {'knob': strip_gate.knob}
|
return {'knob': strip_gate.knob}
|
||||||
|
|
||||||
|
|
||||||
@router.put('/{index}/gate/knob')
|
|
||||||
async def set_strip_gate_knob(
|
|
||||||
index: int,
|
|
||||||
knob: float = Body(..., embed=True),
|
|
||||||
voicemeeter=Depends(get_voicemeeter_client),
|
|
||||||
):
|
|
||||||
"""Set the gate knob value for the specified strip index."""
|
|
||||||
strip_gate = voicemeeter.strip[index].gate
|
|
||||||
strip_gate.knob = knob
|
|
||||||
return {'knob': strip_gate.knob}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user