🎨 Make JSON keys lowercase
This commit is contained in:
22
api.go
22
api.go
@ -59,10 +59,10 @@ func handleGetPort(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreatePortRequest struct {
|
type CreatePortRequest struct {
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Backend string
|
Backend string `json:"backend"`
|
||||||
Channels uint8
|
Channels uint8 `json:"channels"`
|
||||||
Type string
|
Type string `json:"type"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleCreatePort(c *gin.Context) {
|
func handleCreatePort(c *gin.Context) {
|
||||||
@ -159,9 +159,9 @@ func handleGetState(c *gin.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SetPortRequest struct {
|
type SetPortRequest struct {
|
||||||
Mute *bool
|
Mute *bool `json:"mute"`
|
||||||
Volume *float32
|
Volume *float32 `json:"volume"`
|
||||||
Balance *float32
|
Balance *float32 `json:"balance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSetState(c *gin.Context) {
|
func handleSetState(c *gin.Context) {
|
||||||
@ -203,7 +203,7 @@ func setState(id string, body SetPortRequest) (gin.H, gin.H) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type CreateRouteRequest struct {
|
type CreateRouteRequest struct {
|
||||||
To string
|
To string `json:"to"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleCreateRoute(c *gin.Context) {
|
func handleCreateRoute(c *gin.Context) {
|
||||||
@ -240,9 +240,9 @@ func createRoute(id string, body CreateRouteRequest) gin.H {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SetRouteRequest struct {
|
type SetRouteRequest struct {
|
||||||
Mute *bool
|
Mute *bool `json:"mute"`
|
||||||
Volume *float32
|
Volume *float32 `json:"volume"`
|
||||||
Balance *float32
|
Balance *float32 `json:"balance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func handleSetRoute(c *gin.Context) {
|
func handleSetRoute(c *gin.Context) {
|
||||||
|
34
routing.go
34
routing.go
@ -7,35 +7,35 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type PortState struct {
|
type PortState struct {
|
||||||
Mute bool
|
Mute bool `json:"mute"`
|
||||||
Volume float32
|
Volume float32 `json:"volume"`
|
||||||
Balance float32
|
Balance float32 `json:"balance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PortProperties struct {
|
type PortProperties struct {
|
||||||
Backend string
|
Backend string `json:"backend"`
|
||||||
Channels uint8
|
Channels uint8 `json:"channels"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type PortRoute struct {
|
type PortRoute struct {
|
||||||
ToUUID string
|
ToUUID string `json:"toUUID"`
|
||||||
Mute bool
|
Mute bool `json:"mute"`
|
||||||
Volume float32
|
Volume float32 `json:"volume"`
|
||||||
Balance float32
|
Balance float32 `json:"balance"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Port struct {
|
type Port struct {
|
||||||
UUID string
|
UUID string `json:"UUID"`
|
||||||
Name string
|
Name string `json:"name"`
|
||||||
Properties PortProperties
|
Properties PortProperties `json:"properties"`
|
||||||
State PortState
|
State PortState `json:"state"`
|
||||||
Route []PortRoute
|
Route []PortRoute `json:"route"`
|
||||||
object []*jack.Port
|
object []*jack.Port
|
||||||
}
|
}
|
||||||
|
|
||||||
var portConfig struct {
|
var portConfig struct {
|
||||||
Input []Port
|
Input []Port `json:"input"`
|
||||||
Output []Port
|
Output []Port `json:"output"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var portsInited bool = false
|
var portsInited bool = false
|
||||||
@ -124,7 +124,7 @@ func addToBuffer(src *[]jack.AudioSample, dst *[]jack.AudioSample, volume float3
|
|||||||
}
|
}
|
||||||
|
|
||||||
func multiplyBuffer(dst *[]jack.AudioSample, factor float32) {
|
func multiplyBuffer(dst *[]jack.AudioSample, factor float32) {
|
||||||
for i, _ := range *dst {
|
for i := range *dst {
|
||||||
(*dst)[i] *= jack.AudioSample(factor)
|
(*dst)[i] *= jack.AudioSample(factor)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user