Documentation ¶
Overview ¶
Package simpleradio contains a SimpleRadio-Standalone client.
Index ¶
- type Audio
- type Client
- func (c *Client) BotsOnFrequency() int
- func (c *Client) ClientsOnFrequency() int
- func (c *Client) Frequencies() []RadioFrequency
- func (c *Client) HumansOnFrequency() int
- func (c *Client) IsOnFrequency(name string) bool
- func (c *Client) Receive() <-chan Transmission
- func (c *Client) Run(ctx context.Context, wg *sync.WaitGroup) error
- func (c *Client) Send(message types.Message) error
- func (c *Client) SendPing()
- func (c *Client) Transmit(transmission Transmission)
- type RadioFrequency
- type Transmission
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Audio ¶ added in v0.5.0
type Audio []float32
Audio is a sample of audio data in F32LE PCM format.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a SimpleRadio-Standalone Client.
func NewClient ¶
func NewClient(config types.ClientConfiguration) (*Client, error)
NewClient creates a new SimpleRadio-Standalone client.
func (*Client) BotsOnFrequency ¶ added in v0.5.0
BotsOnFrequency returns the number of bot peers on the client's frequencies. A bot peer is any client whose name ends with "[BOT]".
func (*Client) ClientsOnFrequency ¶ added in v0.2.7
ClientsOnFrequency returns the number of peers on the client's frequencies.
func (*Client) Frequencies ¶ added in v0.4.0
func (c *Client) Frequencies() []RadioFrequency
Frequencies returns the frequencies the client is listening on.
func (*Client) HumansOnFrequency ¶ added in v0.5.0
HumansOnFrequency returns the number of human peers on the client's frequencies. A human peer is any client whose name does not end with "[BOT]".
func (*Client) IsOnFrequency ¶
IsOnFrequency checks if the named peer is on any of the client's frequencies.
func (*Client) Receive ¶
func (c *Client) Receive() <-chan Transmission
Receive returns a channel that receives transmissions over the radio. Each transmission is F32LE PCM audio data.
func (*Client) Run ¶
Run starts the SimpleRadio-Standalone client. It should be called exactly once.
func (*Client) SendPing ¶ added in v0.14.0
func (c *Client) SendPing()
SendPing sends a single ping to the SRS server over both TCP and UDP.
func (*Client) Transmit ¶
func (c *Client) Transmit(transmission Transmission)
Transmit enqueues a transmission to send over the radio.
type RadioFrequency ¶ added in v0.3.0
type RadioFrequency struct { Frequency unit.Frequency Modulation types.Modulation }
RadioFrequency selects a frequency and either AM or FM modulation.
func ParseRadioFrequency ¶ added in v0.3.0
func ParseRadioFrequency(s string) (*RadioFrequency, error)
ParseRadioFrequency parses a string into a RadioFrequency. The string should be a positive decimal number optionally followed by either "AM" or "FM". If the modulation is not recognized, it defaults to AM.
func (RadioFrequency) IsSameFrequency ¶ added in v0.3.0
func (f RadioFrequency) IsSameFrequency(other RadioFrequency) bool
IsSameFrequency returns true if the given frequency has the same frequency and modulation as this frequency.
func (RadioFrequency) String ¶ added in v0.3.0
func (f RadioFrequency) String() string
String representation of the RadioFrequency.
type Transmission ¶ added in v0.6.0
type Transmission struct { // TraceID of the transmission. TraceID string // ClientName is the name of the SRS client that transmitted the audio. ClientName string // Audio sample for the transmission. Audio Audio }
Transmission is an envelope containing a trace ID, SRS client name, and audio sample for a transmission.
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Package types contains types used by the SRS client.
|
Package types contains types used by the SRS client. |
Package voice contains the types used by the SRS audio protocol to send and receive audio data over the network.
|
Package voice contains the types used by the SRS audio protocol to send and receive audio data over the network. |