client

package
v0.0.0-...-7e38a4a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 18, 2025 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// JackTrip server (https://github.com/jacktrip/jacktrip)
	JackTrip ServerType = "JackTrip"

	// Jamulus server (https://github.com/corrados/jamulus)
	Jamulus ServerType = "Jamulus"

	// JackTripJamulus means both JackTrip AND Jamulus server
	JackTripJamulus ServerType = "JackTrip+Jamulus"

	// Offline means both broadcasting + recording are disabled
	Offline BroadcastVisibility = 0

	// BroadcastPublicWOStemWOVideo means broadcasting is enabled for anyone (w/o stems, w/o video)
	BroadcastPublicWOStemWOVideo BroadcastVisibility = 1

	// BroadcastUnlistedWOStemWOVideo means broadcasting is enabled for those with the link (w/o stems, w/o video)
	BroadcastUnlistedWOStemWOVideo BroadcastVisibility = 2

	// PrivateRecordWOStemWOVideo means broadcasting is disabled but recording is enabled (w/o stems, w/o video)
	PrivateRecordWOStemWOVideo BroadcastVisibility = 3

	// BroadcastPublicWStemWOVideo means broadcasting is enabled for anyone (w/ stems, w/o video)
	BroadcastPublicWStemWOVideo BroadcastVisibility = 4

	// BroadcastPublicWOStemWVideo means broadcasting is enabled for anyone (w/o stems, w/ video)
	BroadcastPublicWOStemWVideo BroadcastVisibility = 5

	// BroadcastPublicWStemWVideo means broadcasting is enabled for anyone (w/ stems, w/ video)
	BroadcastPublicWStemWVideo BroadcastVisibility = 6

	// BroadcastUnlistedWStemWOVideo means broadcasting is enabled for those with the link (w/ stems, w/o video)
	BroadcastUnlistedWStemWOVideo BroadcastVisibility = 7

	// BroadcastUnlistedWOStemWVideo means broadcasting is enabled for those with the link (w/o stems, w/ video)
	BroadcastUnlistedWOStemWVideo BroadcastVisibility = 8

	// BroadcastUnlistedWStemWVideo means broadcasting is enabled for those with the link (w/ stems, w/ video)
	BroadcastUnlistedWStemWVideo BroadcastVisibility = 9

	// PrivateRecordWStemWOVideo means broadcasting is disabled but recording is enabled (w/ stems, w/o video)
	PrivateRecordWStemWOVideo BroadcastVisibility = 10

	// PrivateRecordWOStemWVideo means broadcasting is disabled but recording is enabled (w/o stems, w/ video)
	PrivateRecordWOStemWVideo BroadcastVisibility = 11

	// PrivateRecordWStemWVideo means broadcasting is disabled but recording is enabled (w/ stems, w/ video)
	PrivateRecordWStemWVideo BroadcastVisibility = 12
)

Variables

This section is empty.

Functions

func GetAPIHash

func GetAPIHash(apiSecret string) string

GetAPIHash returns hashed value for a given api secret

func IsPrivateRecording

func IsPrivateRecording(vis BroadcastVisibility) bool

IsPrivateRecording checks if private recording is enabled

func IsStemEnabled

func IsStemEnabled(vis BroadcastVisibility) bool

IsStemEnabled checks if stem recordings are enabled

func IsStreamEnabled

func IsStreamEnabled(vis BroadcastVisibility) bool

IsStreamEnabled checks if the HLS stream is enabled

func IsStreamPublic

func IsStreamPublic(vis BroadcastVisibility) bool

IsStreamPublic checks if the HLS stream is public

func IsStreamUnlisted

func IsStreamUnlisted(vis BroadcastVisibility) bool

IsStreamUnlisted checks if the HLS stream is unlisted

func IsVideoEnabled

func IsVideoEnabled(vis BroadcastVisibility) bool

IsVideoEnabled checks if video is enabled

Types

type ALSAConfig

type ALSAConfig struct {
	// If true, apply volume boost for audio capture or input
	CaptureBoost types.BitBool `json:"captureBoost" db:"capture_boost"`

	// If true, audio capture or input will be muted
	CaptureMute types.BitBool `json:"captureMute" db:"capture_mute"`

	// Volume level percent (0-100) for audio capture or input
	CaptureVolume int `json:"captureVolume" db:"capture_volume"`

	// If true, apply volume boost for audio playback or output
	PlaybackBoost types.BitBool `json:"playbackBoost" db:"playback_boost"`

	// If true, audio playback or output will be muted
	PlaybackMute types.BitBool `json:"playbackMute" db:"playback_mute"`

	// Volume level percent (0-100) for audio playback or output
	PlaybackVolume int `json:"playbackVolume" db:"playback_volume"`

	// If true, local monitor output will be muted
	MonitorMute types.BitBool `json:"monitorMute" db:"monitor_mute"`

	// Volume level percent (0-100) for local monitor output
	MonitorVolume int `json:"monitorVolume" db:"monitor_volume"`
}

ALSAConfig defines configuration for a device's ALSA sound card

type AgentCredentials

type AgentCredentials struct {
	// API key prefix
	APIPrefix string `json:"apiPrefix"`

	// API key secret value (used to generate APIHash)
	APISecret string `json:"apiSecret"`
}

AgentCredentials defines authentication credentials for an agent

type BroadcastVisibility

type BroadcastVisibility int

BroadcastVisibility controls the access modes of an audio server broadcast

type DeviceAgentConfig

type DeviceAgentConfig struct {
	DeviceConfig
	ALSAConfig
	ServerConfig

	// frames per period
	Period int `json:"period" db:"period"`

	// size of jitter queue buffer
	QueueBuffer int `json:"queueBuffer" db:"queue_buffer"`

	// strategy to use for the network jitter buffer
	BufferStrategy int `json:"bufferStrategy" db:"buffer_strategy"`

	// authorization token used by jacktrip-agent to access studio servers
	AuthToken string `json:"authToken" db:"auth_token"`
}

DeviceAgentConfig defines active configuration for a device

type DeviceConfig

type DeviceConfig struct {
	// DevicePort is the bindport used by the device
	DevicePort int `json:"devicePort" db:"port"`

	// Reverb level from 0 to 100, only used if compressor is enabled
	Reverb int `json:"reverb" db:"reverb"`

	// If true, a limiter will be applied to input and output volume
	Limiter types.BitBool `json:"limiter" db:"limiter"`

	// If true, a compressor will be applied to device output
	Compressor types.BitBool `json:"compressor" db:"compressor"`

	// If true, multiple USB audio interfaces will be automatically detected and patched accordingly
	EnableUSB types.BitBool `json:"enableUsb" db:"enable_usb"`

	// connection quality
	// 0: low quality Jamulus (low)
	// 1: high quality Jamulus (medium)
	// 2: JackTrip (high)
	Quality int `json:"quality" db:"quality"`

	// Input Channel Count
	// 1: mono
	// 2: stereo
	InputChannels int `json:"inputChannels" db:"input_channels"`

	// Outputs Channel Count
	// 1: mono
	// 2: stereo
	OutputChannels int `json:"outputChannels" db:"output_channels"`
}

DeviceConfig defines configuration for a particular device

type DeviceHeartbeat

type DeviceHeartbeat struct {
	PingStats

	// MAC address for ethernet device (used when running on raspberry pi device)
	MAC string `json:"mac"`

	// Current image version for the device
	Version string `json:"version"`

	// Type of sound device ("snd_rpi_hifiberry_dacplusadcpro")
	Type string `json:"type" db:"type"`
}

DeviceHeartbeat is used to send heartbeat messages from devices

type DeviceHeartbeatWithConfig

type DeviceHeartbeatWithConfig struct {
	PingStats
	DeviceConfig
	ALSAConfig

	// unique identifier for an audio device
	ID string `json:"id" db:"id"`

	// MAC address of the device
	MAC string `json:"mac" db:"mac"`

	// User identifier of the device's owner
	OwnerID string `json:"ownerId" db:"owner_id"`

	// audio server that the device is connected to (may be empty)
	ServerID string `json:"serverId" db:"server_id"`

	// Current image version for the device
	Version string `json:"version" db:"version"`

	// ALSA device name ("sndrpihifiberry")
	ALSAName string `json:"alsaName" db:"alsa_name"`

	// ALSA device type ("snd_rpi_hifiberry_dacplusadcpro")
	Overlay string `json:"overlay" db:"overlay"`

	// Descriptive name for the device
	Name string `json:"name" db:"name"`

	// frames per period
	Period int `json:"period" db:"period"`

	// size of jitter queue buffer
	QueueBuffer int `json:"queueBuffer" db:"queue_buffer"`

	// strategy to use for the network jitter buffer
	BufferStrategy int `json:"bufferStrategy" db:"buffer_strategy"`
}

DeviceHeartbeatWithConfig is used to represent ping statistics with config for an audio device

type PingStats

type PingStats struct {
	// PacketsRecv is the number of packets received.
	PacketsRecv int `json:"pkts_recv" db:"pkts_recv"`

	// PacketsSent is the number of packets sent.
	PacketsSent int `json:"pkts_sent" db:"pkts_sent"`

	// MinRtt is the minimum round-trip time sent via socket ping.
	MinRtt time.Duration `json:"min_rtt" db:"min_rtt"`

	// MaxRtt is the maximum round-trip time sent via socket ping.
	MaxRtt time.Duration `json:"max_rtt" db:"max_rtt"`

	// AvgRtt is the average round-trip time sent via socket ping.
	AvgRtt time.Duration `json:"avg_rtt" db:"avg_rtt"`

	// StdDevRtt is the standard deviation of the round-trip times sent via socket ping.
	StdDevRtt time.Duration `json:"stddev_rtt" db:"stddev_rtt"`

	// LatestRtt is the latest rtt sent via socket ping.
	LatestRtt time.Duration `json:"latest_rtt" db:"latest_rtt"`

	// AudioInputLatency is the latest client-side audio input device latency
	AudioInputLatency time.Duration `json:"audio_input_latency" db:"audio_input_latency"`

	// AudioOutputLatency is the latest client-side audio output device latency
	AudioOutputLatency time.Duration `json:"audio_output_latency" db:"audio_output_latency"`

	// ClientBufferLatency is the latest client-side receiver buffer latency
	ClientBufferLatency time.Duration `json:"client_buffer_latency" db:"client_buffer_latency"`

	// ServerBufferLatency is the latest server-side receiver buffer latency
	ServerBufferLatency time.Duration `json:"server_buffer_latency" db:"server_buffer_latency"`

	// timestamp when the device stats were last updated
	StatsUpdatedAt time.Time `json:"stats_updated_at" db:"stats_updated_at"`

	// HighLatency is a boolean flag that indicates whether a device is using a high latency input / output
	HighLatency bool `json:"high_latency" db:"high_latency"`

	// NetworkOutage is a boolean flag that indicates whether a device is experiencing an unstable network connection
	NetworkOutage bool `json:"network_outage" db:"network_outage"`
}

PingStats defines a ping statistics to an audio server

type ServerAgentConfig

type ServerAgentConfig struct {
	ServerConfig

	// frames per period
	Period int `json:"period" db:"period"`

	// size of jitter queue buffer
	QueueBuffer int `json:"queueBuffer" db:"queue_buffer"`

	// strategy to use for the network jitter buffer
	BufferStrategy int `json:"bufferStrategy" db:"buffer_strategy"`

	// broadcast visibility of the audio server
	Broadcast BroadcastVisibility `json:"broadcast" db:"broadcast"`

	// timestamp when the server will automatically be paused
	ExpiresAt time.Time `json:"expiresAt" db:"expires_at"`

	// Branch of jacktrip/jacktrip-sc repository to use for mixing
	MixBranch string `json:"mixBranch" db:"mix_branch"`

	// SuperCollider (sclang) source code to run for mixing audio
	MixCode string `json:"mixCode" db:"mix_code"`

	// max number of musicians allowed in server
	MaxMusicians int `json:"maxMusicians" db:"max_musicians"`
}

ServerAgentConfig defines active configuration for a server

type ServerConfig

type ServerConfig struct {
	// type of server
	Type ServerType `json:"type" db:"type"`

	// Descriptive name
	Name string `json:"name" db:"name"`

	// hostname of server
	Host string `json:"serverHost" db:"host"`

	// port number server is listening on
	Port int `json:"serverPort" db:"port"`

	// sample rate frequency (48000 or 96000)
	SampleRate int `json:"sampleRate" db:"sample_rate"`

	// true if server is publically accessible
	Public types.BitBool `json:"public" db:"public"`

	// DEPRECATED: should always be true
	Stereo types.BitBool `json:"stereo" db:"stereo"`

	// DEPRECATED: should always be false
	LoopBack types.BitBool `json:"loopback" db:"loopback"`

	// true if enabled
	Enabled types.BitBool `json:"enabled" db:"enabled"`
}

ServerConfig defines configuration for a particular server

type ServerHeartbeat

type ServerHeartbeat struct {
	// Cloud identifier for server (used when running on cloud audio server)
	CloudID string `json:"cloudId"`
}

ServerHeartbeat is used to send heartbeat messages from servers / studios

type ServerType

type ServerType string

ServerType is used to determine the type of an audio server

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL