mirror of
https://github.com/onyx-and-iris/vmr-http.git
synced 2026-04-06 09:59:11 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e849d7739b | |||
| 07bcdd17fb | |||
| 112679450f | |||
| a2acbe1ac2 | |||
| 921cf8796d | |||
| a492006d67 | |||
| 20756f489f | |||
| a19d1f1e1d |
175
API_EXAMPLES.md
Normal file
175
API_EXAMPLES.md
Normal file
@ -0,0 +1,175 @@
|
||||
# API Usage
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- The FastAPI server must be running (default: http://localhost:8000)
|
||||
|
||||
---
|
||||
|
||||
## App Router
|
||||
|
||||
### */health*
|
||||
|
||||
```console
|
||||
curl -X 'GET' \
|
||||
'http://127.0.0.1:8000/health' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Strip Router
|
||||
|
||||
### */strip/{index}*
|
||||
|
||||
> Get single parameter
|
||||
|
||||
```console
|
||||
curl -X 'GET' \
|
||||
'http://127.0.0.1:8000/strip/0/gain' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
> Set single parameter
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/strip/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"mute": true,
|
||||
}'
|
||||
```
|
||||
|
||||
> Set multiple parameters
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/strip/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"gain": -36.8,
|
||||
"mute": true,
|
||||
"mono": false,
|
||||
"solo": true,
|
||||
"A1": true,
|
||||
"A2": false,
|
||||
"A3": true,
|
||||
"B1": false,
|
||||
"B2": true,
|
||||
}'
|
||||
```
|
||||
|
||||
## Strip Gate Router
|
||||
|
||||
### */strip/{index}/gate*
|
||||
|
||||
> Get single parameter
|
||||
|
||||
```console
|
||||
curl -X 'GET' \
|
||||
'http://127.0.0.1:8000/strip/0/gate/knob' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
> Set multiple parameters
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/strip/0/gate' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"threshold": -28.7,
|
||||
"damping": -60,
|
||||
"attack": 2
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## Bus Router
|
||||
|
||||
### */bus/{index}*
|
||||
|
||||
> Get single parameter
|
||||
|
||||
```console
|
||||
curl -X 'GET' \
|
||||
'http://127.0.0.1:8000/bus/0/mono' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
> Set single parameter
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/bus/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"gain": -32.8,
|
||||
}'
|
||||
```
|
||||
|
||||
> Set multiple parameters
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/bus/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"gain": -18.7,
|
||||
"mute": false,
|
||||
"mono": 1
|
||||
}'
|
||||
```
|
||||
|
||||
## Bus EQ Channel Cell Router
|
||||
|
||||
### */bus/{index}/eq/channel/{channel_index}/cell/{cell_index}*
|
||||
|
||||
> Get single parameter
|
||||
|
||||
```console
|
||||
curl -X 'GET' \
|
||||
'http://127.0.0.1:8000/bus/0/eq/channel/0/cell/0/type' \
|
||||
-H 'accept: application/json'
|
||||
```
|
||||
|
||||
> Set single parameter
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/bus/0/eq/channel/0/cell/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"q": 9.5
|
||||
}'
|
||||
```
|
||||
|
||||
> Set multiple parameters
|
||||
|
||||
```console
|
||||
curl -X 'PATCH' \
|
||||
'http://127.0.0.1:8000/bus/0/eq/channel/0/cell/0' \
|
||||
-H 'accept: application/json' \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d '{
|
||||
"on": true,
|
||||
"type": 4,
|
||||
"f": 538.2,
|
||||
"gain": -0.6,
|
||||
"q": 9.5
|
||||
}'
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## More
|
||||
|
||||
For a full list of endpoints and schemas, see the [Swagger UI](http://localhost:8000/docs) or [ReDoc](http://localhost:8000/redoc).
|
||||
@ -19,7 +19,9 @@ uvicorn vmr_http:app
|
||||
|
||||
## Documentation
|
||||
|
||||
FastAPI generates [automatic docs][auto-docs], simply launch the server and then visit:
|
||||
For a few examples see [API_EXAMPLES](./API_EXAMPLES.md).
|
||||
|
||||
For an exhaustive list of the endpoints FastAPI generates [automatic docs][auto-docs], simply launch the server and then visit:
|
||||
|
||||
*Swagger UI*
|
||||
- http://localhost:8000/docs
|
||||
@ -31,6 +33,6 @@ FastAPI generates [automatic docs][auto-docs], simply launch the server and then
|
||||
|
||||
## License
|
||||
|
||||
`vban-cli` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
||||
`vmr-http` is distributed under the terms of the [MIT](https://spdx.org/licenses/MIT.html) license.
|
||||
|
||||
[auto-docs]: https://fastapi.tiangolo.com/features/#automatic-docs
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[project]
|
||||
name = "vmr-http"
|
||||
version = "0.6.0"
|
||||
version = "0.7.1"
|
||||
description = "HTTP API for controlling Voicemeeter"
|
||||
readme = "README.md"
|
||||
authors = [{ name = "onyx-and-iris", email = "code@onyxandiris.online" }]
|
||||
|
||||
@ -8,15 +8,15 @@ from pydantic import BaseModel, Field
|
||||
class EQParams(BaseModel):
|
||||
"""Parameters for an equalizer."""
|
||||
|
||||
on: Optional[bool] = Field(description='Whether the equalizer is enabled or not.')
|
||||
ab: Optional[bool] = Field(description='Whether the equalizer is in mode A/B.')
|
||||
on: Optional[bool] = Field(None, description='Whether the equalizer is enabled or not.')
|
||||
ab: Optional[bool] = Field(None, description='Whether the equalizer is in mode A/B.')
|
||||
|
||||
|
||||
class EQChannelCellParams(BaseModel):
|
||||
"""Parameters for an equalizer channel."""
|
||||
|
||||
on: Optional[bool] = Field(description='Whether the equalizer channel is enabled or not.')
|
||||
type: Optional[int] = Field(ge=0, le=6, description='Type of the equalizer channel.')
|
||||
f: Optional[float] = Field(ge=20.0, le=20000.0, description='Frequency of the equalizer channel.')
|
||||
gain: Optional[float] = Field(ge=-36.0, le=18.0, description='Gain of the equalizer channel.')
|
||||
q: Optional[float] = Field(ge=0.3, le=100.0, description='Q factor of the equalizer channel.')
|
||||
on: Optional[bool] = Field(None, description='Whether the equalizer channel is enabled or not.')
|
||||
type: Optional[int] = Field(None, ge=0, le=6, description='Type of the equalizer channel.')
|
||||
f: Optional[float] = Field(None, ge=20.0, le=20000.0, description='Frequency of the equalizer channel.')
|
||||
gain: Optional[float] = Field(None, ge=-36.0, le=18.0, description='Gain of the equalizer channel.')
|
||||
q: Optional[float] = Field(None, ge=0.3, le=100.0, description='Q factor of the equalizer channel.')
|
||||
|
||||
@ -25,3 +25,59 @@ async def get_strip_comp_knob(index: int, voicemeeter=Depends(get_voicemeeter_cl
|
||||
"""Get the current compressor knob value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'knob': strip_comp.knob}
|
||||
|
||||
|
||||
@router.get('/gainin')
|
||||
async def get_strip_comp_gainin(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor gain in value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'gainin': strip_comp.gainin}
|
||||
|
||||
|
||||
@router.get('/ratio')
|
||||
async def get_strip_comp_ratio(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor ratio value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'ratio': strip_comp.ratio}
|
||||
|
||||
|
||||
@router.get('/threshold')
|
||||
async def get_strip_comp_threshold(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor threshold value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'threshold': strip_comp.threshold}
|
||||
|
||||
|
||||
@router.get('/attack')
|
||||
async def get_strip_comp_attack(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor attack value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'attack': strip_comp.attack}
|
||||
|
||||
|
||||
@router.get('/release')
|
||||
async def get_strip_comp_release(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor release value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'release': strip_comp.release}
|
||||
|
||||
|
||||
@router.get('/knee')
|
||||
async def get_strip_comp_knee(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor knee value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'knee': strip_comp.knee}
|
||||
|
||||
|
||||
@router.get('/gainout')
|
||||
async def get_strip_comp_gainout(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor gain out value for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'gainout': strip_comp.gainout}
|
||||
|
||||
|
||||
@router.get('/makeup')
|
||||
async def get_strip_comp_makeup(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current compressor makeup status for the specified strip index."""
|
||||
strip_comp = voicemeeter.strip[index].comp
|
||||
return {'makeup': strip_comp.makeup}
|
||||
|
||||
@ -25,3 +25,45 @@ async def get_strip_gate_knob(index: int, voicemeeter=Depends(get_voicemeeter_cl
|
||||
"""Get the current gate knob value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'knob': strip_gate.knob}
|
||||
|
||||
|
||||
@router.get('/threshold')
|
||||
async def get_strip_gate_threshold(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate threshold value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'threshold': strip_gate.threshold}
|
||||
|
||||
|
||||
@router.get('/damping')
|
||||
async def get_strip_gate_damping(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate damping value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'damping': strip_gate.damping}
|
||||
|
||||
|
||||
@router.get('/bpsidechain')
|
||||
async def get_strip_gate_bpsidechain(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate sidechain value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'bpsidechain': strip_gate.bpsidechain}
|
||||
|
||||
|
||||
@router.get('/attack')
|
||||
async def get_strip_gate_attack(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate attack value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'attack': strip_gate.attack}
|
||||
|
||||
|
||||
@router.get('/hold')
|
||||
async def get_strip_gate_hold(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate hold value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'hold': strip_gate.hold}
|
||||
|
||||
|
||||
@router.get('/release')
|
||||
async def get_strip_gate_release(index: int, voicemeeter=Depends(get_voicemeeter_client)):
|
||||
"""Get the current gate release value for the specified strip index."""
|
||||
strip_gate = voicemeeter.strip[index].gate
|
||||
return {'release': strip_gate.release}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user