client

package
v0.15.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

View Source
const WhisperBenchmarkIndex = 4

WhisperBenchmarkIndex is the current benchmark generation. If the stored index in config is less than this, re-benchmarking is triggered. Increment this when benchmark criteria change (e.g., models, thresholds).

Variables

View Source
var ErrCPUNotSupported = errors.New("CPU does not support required instructions for speech-to-text")

ErrCPUNotSupported is returned when the CPU doesn't support the required instruction sets for speech-to-text. The shipped binary is built with AVX2/FMA/F16C/BMI2 enabled (Haswell-era and later).

View Source
var ErrWindowsARM = errors.New("Windows on ARM is not supported for speech-to-text")

ErrWindowsARM is returned when running on Windows ARM hardware via x86 emulation. The whisper library uses AVX/AVX2 instructions that cannot be emulated on ARM.

Functions

func BroadcastMessage

func BroadcastMessage(hostname, msg, password string, lg *log.Logger)

func ForceWhisperRebenchmark added in v0.14.0

func ForceWhisperRebenchmark(lg *log.Logger, saveCallback func(modelName, deviceID string, benchmarkIndex int, realtimeFactor float64, gpuDisabled bool))

ForceWhisperRebenchmark closes the current model and triggers a fresh benchmark. This should be called when the user wants to re-run the benchmark.

func GetWhisperBenchmarkStatus added in v0.14.0

func GetWhisperBenchmarkStatus() string

GetWhisperBenchmarkStatus returns the current benchmark status message for UI display.

func GetWhisperModelError added in v0.14.1

func GetWhisperModelError() error

GetWhisperModelError returns the model loading error without blocking. Returns nil if benchmarking is still in progress or if no error occurred.

func GetWhisperModelName added in v0.14.0

func GetWhisperModelName() string

GetWhisperModelName returns the name of the currently loaded whisper model. Uses atomic load to avoid blocking the UI thread during whisper inference.

func GetWhisperModelTiers added in v0.14.0

func GetWhisperModelTiers() []string

GetWhisperModelTiers returns the list of available whisper models, from smallest to largest.

func IsSTTAvailable added in v0.14.0

func IsSTTAvailable() bool

IsSTTAvailable returns true if speech-to-text is available or still loading. Returns false only once benchmarking has completed with an error (e.g. unsupported CPU). Non-blocking; safe to call from the UI.

func IsWhisperBenchmarkDone added in v0.14.0

func IsWhisperBenchmarkDone() bool

IsWhisperBenchmarkDone returns true if the whisper model loading/benchmarking has completed.

func IsWhisperBenchmarking added in v0.14.0

func IsWhisperBenchmarking() bool

IsWhisperBenchmarking returns true if we're currently running actual benchmarks (as opposed to just loading a cached model). This is used to determine whether to show the benchmark progress dialog.

func PreloadWhisperModel added in v0.14.0

func PreloadWhisperModel(lg *log.Logger, uploadDone <-chan struct{},
	cachedModelName, cachedDeviceID string, cachedBenchmarkIndex int,
	cachedRealtimeFactor float64, saveCallback func(modelName, deviceID string, benchmarkIndex int, realtimeFactor float64, gpuDisabled bool))

PreloadWhisperModel loads the whisper model in the background so it's ready when PTT is first pressed. This avoids blocking the UI.

If cachedModelName and cachedDeviceID match the current device and the cachedBenchmarkIndex matches the current WhisperBenchmarkIndex, the cached model is loaded directly without benchmarking. Otherwise, a full benchmark is performed.

The saveCallback is called when a model is selected (after benchmarking) to allow saving the selection to config.

If uploadDone is non-nil, the background goroutine blocks on it before doing any cgo work. This gates the model load on a prior run's crash-stderr file finishing upload: a recurring init-time crash inside whisper would otherwise kill us before the report is shipped, stranding it forever.

func ReportWhisperBenchmark added in v0.14.0

func ReportWhisperBenchmark(remoteServer *Server, lg *log.Logger) bool

ReportWhisperBenchmark sends the benchmark results to the remote server if available. This should be called once the connection manager has established a connection to the remote server. Returns true if the report was sent, false if no report available or already reported.

func SelectWhisperModel added in v0.14.0

func SelectWhisperModel(lg *log.Logger, modelName string,
	saveCallback func(modelName, deviceID string, benchmarkIndex int, realtimeFactor float64, gpuDisabled bool))

SelectWhisperModel directly selects a whisper model without benchmarking. This is used when the user manually chooses a model from the settings dropdown.

func TryConnectRemoteServer

func TryConnectRemoteServer(hostname string, lg *log.Logger) chan *serverConnection

func WhisperModelError added in v0.14.0

func WhisperModelError() error

WhisperModelError waits for the whisper model to finish loading and returns any error that occurred. Returns nil if the model loaded successfully. This can be used to check if STT is available and show an error dialog if not.

Types

type AircraftCommandRequest added in v0.14.0

type AircraftCommandRequest struct {
	Callsign     av.ADSBCallsign
	Commands     string
	Multiple     bool
	ClickedTrack bool

	// STT-related fields (zero values for keyboard input)
	WhisperDuration   time.Duration
	AudioDuration     time.Duration
	WhisperTranscript string
	WhisperPrompt     string
	WhisperModel      string
	AircraftContext   map[string]stt.Aircraft
	STTDebugLogs      []string
}

AircraftCommandRequest contains parameters for RunAircraftCommands. For keyboard input, only Callsign, Commands, Multiple, and ClickedTrack need to be set; all STT-related fields can be left as zero values.

type ConnectionManager

type ConnectionManager struct {
	LocalServer  *Server
	RemoteServer *Server
	// contains filtered or unexported fields
}

func MakeServerManager

func MakeServerManager(serverAddress, additionalScenario, additionalVideoMap, additionalScenarioBrief string, disableTTSPtr *bool, lg *log.Logger,
	onNewClient func(*ControlClient), onError func(error)) (*ConnectionManager, util.ErrorLogger, string)

func (*ConnectionManager) ClientIsLocal

func (cm *ConnectionManager) ClientIsLocal() bool

func (*ConnectionManager) ConnectToSim

func (cm *ConnectionManager) ConnectToSim(config server.JoinSimRequest, initials string, srv *Server, lg *log.Logger) error

func (*ConnectionManager) Connected

func (cm *ConnectionManager) Connected() bool

func (*ConnectionManager) ConnectionStartTime

func (cm *ConnectionManager) ConnectionStartTime() time.Time

func (*ConnectionManager) CreateNewSim

func (cm *ConnectionManager) CreateNewSim(config server.NewSimRequest, initials string, srv *Server, lg *log.Logger) error

func (*ConnectionManager) Disconnect

func (cm *ConnectionManager) Disconnect()

func (*ConnectionManager) LoadLocalSim

func (cm *ConnectionManager) LoadLocalSim(s *sim.Sim, initials string, lg *log.Logger) (*ControlClient, error)

func (*ConnectionManager) Update

func (cm *ConnectionManager) Update(p platform.Platform, lg *log.Logger)

func (*ConnectionManager) UpdateRunningSims added in v0.13.3

func (cm *ConnectionManager) UpdateRunningSims() error

type ControlClient

type ControlClient struct {
	LastTranscription     string
	LastCommand           string
	LastWhisperDurationMs int64 // Last whisper transcription time in milliseconds

	SessionStats SessionStats

	// This is all read-only data that we expect other parts of the system
	// to access directly.
	State SimState
	// contains filtered or unexported fields
}

func NewControlClient

func NewControlClient(ss server.SimState, controllerToken string, disableTTSPtr *bool, initials string,
	client *RPCClient, lg *log.Logger) *ControlClient

func (*ControlClient) AcceptHandoff

func (c *ControlClient) AcceptHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) AcceptRedirectedHandoff

func (c *ControlClient) AcceptRedirectedHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) AcknowledgePointOut

func (c *ControlClient) AcknowledgePointOut(acid sim.ACID, callback func(error))

func (*ControlClient) ActivateFlightPlan

func (c *ControlClient) ActivateFlightPlan(callsign av.ADSBCallsign, fpACID sim.ACID, spec sim.FlightPlanSpecifier,
	callback func(error))

func (*ControlClient) AddMETARAirport added in v0.14.6

func (c *ControlClient) AddMETARAirport(airport string)

func (*ControlClient) AirspaceForTCW added in v0.13.3

func (c *ControlClient) AirspaceForTCW(tcw sim.TCW) []av.ControllerAirspaceVolume

func (*ControlClient) AnnotateFlightStrip added in v0.14.1

func (c *ControlClient) AnnotateFlightStrip(acid sim.ACID, annotations [9]string)

func (*ControlClient) AssociateFlightPlan

func (c *ControlClient) AssociateFlightPlan(callsign av.ADSBCallsign, spec sim.FlightPlanSpecifier, callback func(error))

func (*ControlClient) BeginGarble added in v0.14.3

func (c *ControlClient) BeginGarble()

BeginGarble holds pilot transmissions while the user has PTT pressed during ongoing audio playback (garble mode). This prevents queued transmissions from starting playback while the user is still holding PTT trying to interrupt. Pair with EndGarble on PTT release.

func (*ControlClient) CancelHandoff

func (c *ControlClient) CancelHandoff(acid sim.ACID, callback func(error))

func (*ControlClient) ConfigureATPA added in v0.13.3

func (c *ControlClient) ConfigureATPA(op sim.ATPAConfigOp, volumeId string, callback func(output string, err error))

func (*ControlClient) ConfigureAutoHandoff added in v0.15.0

func (c *ControlClient) ConfigureAutoHandoff(op sim.AutoHandoffOp, enable bool, callback func(output string, err error))

func (*ControlClient) ConfigureFDAM added in v0.14.1

func (c *ControlClient) ConfigureFDAM(op sim.FDAMConfigOp, regionId string, callback func(output string, err error))

func (*ControlClient) Connected

func (c *ControlClient) Connected() bool

func (*ControlClient) ConsolidateTCP added in v0.13.3

func (c *ControlClient) ConsolidateTCP(receivingTCW sim.TCW, sendingTCP sim.TCP, consType sim.ConsolidationType, callback func(error))

ConsolidateTCP consolidates the sendingTCP to the receivingTCW's keyboard. sim.ConsolidationFull transfers active tracks; sim.ConsolidationBasic only inactive/future flights.

func (*ControlClient) CreateFlightPlan

func (c *ControlClient) CreateFlightPlan(spec sim.FlightPlanSpecifier, callback func(error))

func (*ControlClient) CreateInterfacilityVFR added in v0.14.3

func (c *ControlClient) CreateInterfacilityVFR(acid sim.ACID, isIntermediate bool, requestedAlt int, callback func(error))

func (*ControlClient) CreateRestrictionArea

func (c *ControlClient) CreateRestrictionArea(ra av.RestrictionArea, callback func(int, error))

func (*ControlClient) DeconsolidateTCP added in v0.13.3

func (c *ControlClient) DeconsolidateTCP(tcp sim.TCP, callback func(error))

DeconsolidateTCP returns a secondary TCP to its default keyboard. If tcp is empty, deconsolidates the default TCP for the TCW (i.e., the TCP one with the same name) back to the user's TCW.

func (*ControlClient) DeleteAllAircraft

func (c *ControlClient) DeleteAllAircraft(callback func(err error))

func (*ControlClient) DeleteFlightPlan

func (c *ControlClient) DeleteFlightPlan(acid sim.ACID, callback func(error))

func (*ControlClient) DeleteRestrictionArea

func (c *ControlClient) DeleteRestrictionArea(idx int, callback func(error))

func (*ControlClient) Disconnect

func (c *ControlClient) Disconnect()

func (*ControlClient) DrainEvents added in v0.14.6

func (c *ControlClient) DrainEvents() []sim.Event

DrainEvents returns and clears the pending events. Called once per frame from the main loop.

func (*ControlClient) EndGarble added in v0.14.3

func (c *ControlClient) EndGarble()

func (*ControlClient) FastForward

func (c *ControlClient) FastForward()

func (*ControlClient) FeedAudioToStreaming added in v0.14.0

func (c *ControlClient) FeedAudioToStreaming(samples []int16)

FeedAudioToStreaming sends audio samples to the streaming transcriber.

func (*ControlClient) FlightPlanDirect added in v0.13.0

func (c *ControlClient) FlightPlanDirect(aircraft sim.ACID, fix string, callback func(err error))

func (*ControlClient) ForceQL

func (c *ControlClient) ForceQL(acid sim.ACID, to sim.ControlPosition, callback func(error))

func (*ControlClient) GetAircraftDisplayState

func (c *ControlClient) GetAircraftDisplayState(callsign av.ADSBCallsign) (sim.AircraftDisplayState, error)

func (*ControlClient) GetAndClearPTTReleaseTime added in v0.14.0

func (c *ControlClient) GetAndClearPTTReleaseTime() time.Time

GetAndClearPTTReleaseTime returns the PTT release time and clears it. Returns zero time if no PTT release is pending.

func (*ControlClient) GetAtmosGrid added in v0.13.0

func (c *ControlClient) GetAtmosGrid(t time.Time, callback func(*wx.AtmosGrid, error))

func (*ControlClient) GetLastCommand added in v0.14.0

func (c *ControlClient) GetLastCommand() string

func (*ControlClient) GetLastTranscription added in v0.14.0

func (c *ControlClient) GetLastTranscription() string

func (*ControlClient) GetLastWhisperDurationMs added in v0.14.0

func (c *ControlClient) GetLastWhisperDurationMs() int64

func (*ControlClient) GetPrecipURL added in v0.13.0

func (c *ControlClient) GetPrecipURL(t sim.Time, callback func(url string, nextTime sim.Time, err error))

func (*ControlClient) GetSerializeSim

func (c *ControlClient) GetSerializeSim() (*sim.Sim, error)

func (*ControlClient) GetSimRate

func (c *ControlClient) GetSimRate() float32

func (*ControlClient) GetUpdates

func (c *ControlClient) GetUpdates(p platform.Platform, onErr func(error))

func (*ControlClient) HandoffTrack

func (c *ControlClient) HandoffTrack(acid sim.ACID, to sim.ControlPosition, callback func(error))

func (*ControlClient) HoldRadioTransmissions

func (c *ControlClient) HoldRadioTransmissions()

func (*ControlClient) InterpolatedSimTime added in v0.14.3

func (c *ControlClient) InterpolatedSimTime() sim.Time

InterpolatedSimTime returns an extrapolated value that models the current Sim's time. (Because the Sim may be running remotely, we have to make some approximations, though they shouldn't cause much trouble since we get an update from the Sim at least once a second...)

func (*ControlClient) LastTTSCallsign

func (c *ControlClient) LastTTSCallsign() av.ADSBCallsign

func (*ControlClient) LaunchAircraft added in v0.15.0

func (c *ControlClient) LaunchAircraft(flight sim.LaunchFlight, callback func(error))

func (*ControlClient) LoadVideoMapLibrary added in v0.14.4

func (c *ControlClient) LoadVideoMapLibrary(filename string) (*av.MapLibrary, error)

LoadVideoMapLibrary returns the video map library for filename. It first tries to load from local resources, verifying against the hash advertised by the server in SimState.VideoMapLibraryHashes; on hash mismatch, missing file, or absent hash it falls back to fetching the full library over RPC.

func (*ControlClient) ModifyFlightPlan

func (c *ControlClient) ModifyFlightPlan(acid sim.ACID, spec sim.FlightPlanSpecifier, callback func(error))

func (*ControlClient) PointOut

func (c *ControlClient) PointOut(acid sim.ACID, to sim.ControlPosition, callback func(error))

func (*ControlClient) PostEvent added in v0.14.6

func (c *ControlClient) PostEvent(e sim.Event)

PostEvent appends an event to the per-client pending events slice. Safe to call from any goroutine (STT runs on its own goroutine, RPC callbacks may also fire concurrently).

func (*ControlClient) PushFlightStrip added in v0.14.1

func (c *ControlClient) PushFlightStrip(acid sim.ACID, toTCP sim.TCP)

func (*ControlClient) RPCClient

func (c *ControlClient) RPCClient() *RPCClient

func (*ControlClient) RadioIsActive

func (c *ControlClient) RadioIsActive() bool

func (*ControlClient) RecallPointOut

func (c *ControlClient) RecallPointOut(acid sim.ACID, callback func(error))

func (*ControlClient) RecycleLaunchAircraft added in v0.15.0

func (c *ControlClient) RecycleLaunchAircraft(flight sim.LaunchFlight, callback func(error))

func (*ControlClient) RedirectHandoff

func (c *ControlClient) RedirectHandoff(acid sim.ACID, to sim.ControlPosition, callback func(error))

func (*ControlClient) RejectPointOut

func (c *ControlClient) RejectPointOut(acid sim.ACID, callback func(error))

func (*ControlClient) ReleaseDeparture

func (c *ControlClient) ReleaseDeparture(callsign av.ADSBCallsign, callback func(error))

func (*ControlClient) ReloadScenarioBrief added in v0.14.4

func (c *ControlClient) ReloadScenarioBrief() error

ReloadScenarioBrief fetches the current on-disk markdown for this client's facility from the server and updates the cached State.ScenarioBrief.

func (*ControlClient) RepositionTrack

func (c *ControlClient) RepositionTrack(acid sim.ACID, callsign av.ADSBCallsign, p math.Point2LL, callback func(error))

func (*ControlClient) RequestContactTransmission added in v0.14.0

func (c *ControlClient) RequestContactTransmission()

RequestContactTransmission requests the next pending contact transmission from the server. The result (if any) will be synthesized locally and enqueued for playback.

func (*ControlClient) RequestFlightFollowing

func (c *ControlClient) RequestFlightFollowing()

func (*ControlClient) RunAircraftCommands

func (c *ControlClient) RunAircraftCommands(req AircraftCommandRequest,
	handleResult func(message string, remainingInput string))

func (*ControlClient) SendGlobalMessage

func (c *ControlClient) SendGlobalMessage(message string)

func (*ControlClient) SendRouteCoordinates added in v0.13.0

func (c *ControlClient) SendRouteCoordinates(aircraft sim.ACID, minutes int, callback func(err error))

func (*ControlClient) SetLastCommand added in v0.14.0

func (c *ControlClient) SetLastCommand(s string)

func (*ControlClient) SetLastTranscription added in v0.14.0

func (c *ControlClient) SetLastTranscription(s string)

Thread-safe access to STT fields

func (*ControlClient) SetLaunchConfig

func (c *ControlClient) SetLaunchConfig(lc sim.LaunchConfig)

func (*ControlClient) SetRemoteServer added in v0.14.0

func (c *ControlClient) SetRemoteServer(remote *RPCClient)

func (*ControlClient) SetSimRate

func (c *ControlClient) SetSimRate(r float32)

func (*ControlClient) SetWaypointCommands added in v0.13.0

func (c *ControlClient) SetWaypointCommands(commands string)

func (*ControlClient) StartStreamingSTT added in v0.14.0

func (c *ControlClient) StartStreamingSTT(lg *log.Logger) error

StartStreamingSTT begins a transcription session. Audio samples can be fed via FeedAudioToStreaming. Call StopStreamingSTT to end the session and process the result.

func (*ControlClient) Status

func (c *ControlClient) Status() string

func (*ControlClient) StopStreamingSTT added in v0.14.0

func (c *ControlClient) StopStreamingSTT(lg *log.Logger)

StopStreamingSTT ends the streaming session and processes the final result. The session is captured synchronously to avoid races, then processing continues asynchronously to avoid blocking the UI.

func (*ControlClient) StringIsSPC

func (c *ControlClient) StringIsSPC(s string) bool

func (*ControlClient) ToggleSimPause

func (c *ControlClient) ToggleSimPause()

func (*ControlClient) TowerListAirports

func (c *ControlClient) TowerListAirports() []string

func (*ControlClient) TriggerEmergency added in v0.13.2

func (c *ControlClient) TriggerEmergency(emergencyName string)

func (*ControlClient) UpdateATISGIText added in v0.14.3

func (c *ControlClient) UpdateATISGIText(line int, auxiliary bool, atis *string, text *string, callback func(error))

func (*ControlClient) UpdateRestrictionArea

func (c *ControlClient) UpdateRestrictionArea(idx int, ra av.RestrictionArea, callback func(error))

type RPCClient

type RPCClient struct {
	*rpc.Client
}

func (*RPCClient) CallWithTimeout added in v0.15.0

func (c *RPCClient) CallWithTimeout(serviceMethod string, args any, reply any) error

type Server

type Server struct {
	*RPCClient

	AvailableWXByFacility map[string][]util.TimeInterval
	// contains filtered or unexported fields
}

This is the client-side representation of a server (perhaps could be better-named...)

func (*Server) Close

func (s *Server) Close() error

func (*Server) GetRunningSims

func (s *Server) GetRunningSims() map[string]*server.RunningSim

func (*Server) GetScenarioCatalogs added in v0.13.3

func (s *Server) GetScenarioCatalogs() map[string]map[string]*server.ScenarioCatalog

type SessionStats

type SessionStats struct {
	Departures    int
	Arrivals      int
	IntraFacility int
	Overflights   int

	SignOnTime time.Time
	Initials   string
	// contains filtered or unexported fields
}

func (*SessionStats) Update

func (s *SessionStats) Update(ss *SimState)

type SimState added in v0.13.3

type SimState struct {
	server.SimState
}

SimState is the client's view of simulation state. It embeds server.SimState, providing access to all its fields and methods.

func (*SimState) BeaconCodeInUse added in v0.13.3

func (ss *SimState) BeaconCodeInUse(sq av.Squawk) bool

func (*SimState) GetAllReleaseDepartures added in v0.13.3

func (ss *SimState) GetAllReleaseDepartures() []sim.ReleaseDeparture

func (*SimState) GetFlightPlanForACID added in v0.13.3

func (ss *SimState) GetFlightPlanForACID(acid sim.ACID) *sim.NASFlightPlan

func (*SimState) GetInitialCenter added in v0.13.3

func (ss *SimState) GetInitialCenter() math.Point2LL

func (*SimState) GetInitialRange added in v0.13.3

func (ss *SimState) GetInitialRange() float32

func (*SimState) GetOurTrackByACID added in v0.13.3

func (ss *SimState) GetOurTrackByACID(acid sim.ACID) (*sim.Track, bool)

func (*SimState) GetOurTrackByCallsign added in v0.13.3

func (ss *SimState) GetOurTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)

func (*SimState) GetRegularReleaseDepartures added in v0.13.3

func (ss *SimState) GetRegularReleaseDepartures() []sim.ReleaseDeparture

func (*SimState) GetSTARSReleaseDepartures added in v0.13.3

func (ss *SimState) GetSTARSReleaseDepartures() []sim.ReleaseDeparture

func (*SimState) GetTrackByACID added in v0.13.3

func (ss *SimState) GetTrackByACID(acid sim.ACID) (*sim.Track, bool)

func (*SimState) GetTrackByCID added in v0.14.6

func (ss *SimState) GetTrackByCID(flid string) (*sim.Track, bool)

func (*SimState) GetTrackByCallsign added in v0.13.3

func (ss *SimState) GetTrackByCallsign(callsign av.ADSBCallsign) (*sim.Track, bool)

func (*SimState) GetTrackBySquawk added in v0.14.6

func (ss *SimState) GetTrackBySquawk(code av.Squawk) (*sim.Track, bool)

func (*SimState) GetUserConsolidation added in v0.13.3

func (ss *SimState) GetUserConsolidation() *sim.TCPConsolidation

GetUserConsolidation returns the consolidation state for the current user's TCW. Returns nil if no consolidation state exists.

func (*SimState) UserControlsPosition added in v0.13.3

func (ss *SimState) UserControlsPosition(pos sim.ControlPosition) bool

UserControlsPosition returns true if the current user controls the given position.

func (*SimState) UserControlsTrack added in v0.13.3

func (ss *SimState) UserControlsTrack(track *sim.Track) bool

UserControlsTrack returns true if the current user controls the given track.

type TransmissionManager added in v0.14.0

type TransmissionManager struct {
	// contains filtered or unexported fields
}

TransmissionManager manages queuing and playback of radio transmissions. It centralizes the logic for playing MP3s in the correct order and handling playback state like holds after transmissions.

func NewTransmissionManager added in v0.14.0

func NewTransmissionManager(lg *log.Logger) *TransmissionManager

NewTransmissionManager creates a new TransmissionManager.

func (*TransmissionManager) EnqueueReadbackPCM added in v0.14.0

func (tm *TransmissionManager) EnqueueReadbackPCM(callsign av.ADSBCallsign, ty av.RadioTransmissionType, pcm []int16)

EnqueueReadbackPCM adds a readback with pre-decoded PCM to the front of the queue (high priority).

func (*TransmissionManager) EnqueueTransmissionPCM added in v0.14.0

func (tm *TransmissionManager) EnqueueTransmissionPCM(callsign av.ADSBCallsign, ty av.RadioTransmissionType, pcm []int16)

EnqueueTransmissionPCM adds a pilot transmission with pre-decoded PCM to the queue.

func (*TransmissionManager) Hold added in v0.14.0

func (tm *TransmissionManager) Hold()

Hold increments the hold counter, preventing playback until Unhold is called. Used during STT recording/processing to prevent speech playback.

func (*TransmissionManager) HoldAfterSilentContact added in v0.14.0

func (tm *TransmissionManager) HoldAfterSilentContact(callsign av.ADSBCallsign)

HoldAfterSilentContact sets a hold period after processing a contact without audio playback (when TTS is disabled). This maintains proper pacing of contacts.

func (*TransmissionManager) HoldAfterTransmission added in v0.14.0

func (tm *TransmissionManager) HoldAfterTransmission()

HoldAfterTransmission sets a hold period, used when the user initiates their own transmission and we should pause pilot transmissions briefly.

func (*TransmissionManager) HoldForRetransmit added in v0.14.3

func (tm *TransmissionManager) HoldForRetransmit()

HoldForRetransmit defers check-ins for 3 seconds after a silent STT failure (empty transcript or no command decoded), giving the controller a chance to retransmit before another aircraft checks in.

func (*TransmissionManager) IsContactRequested added in v0.14.0

func (tm *TransmissionManager) IsContactRequested() bool

IsContactRequested returns true if we're waiting for a contact response.

func (*TransmissionManager) IsPlaying added in v0.14.0

func (tm *TransmissionManager) IsPlaying() bool

IsPlaying returns true if a transmission is currently playing.

func (*TransmissionManager) LastTransmissionCallsign added in v0.14.0

func (tm *TransmissionManager) LastTransmissionCallsign() av.ADSBCallsign

LastTransmissionCallsign returns the callsign of the last played transmission.

func (*TransmissionManager) SetContactRequested added in v0.14.0

func (tm *TransmissionManager) SetContactRequested(requested bool)

SetContactRequested marks that we've sent a contact request and are waiting.

func (*TransmissionManager) ShouldRequestContact added in v0.14.0

func (tm *TransmissionManager) ShouldRequestContact() bool

ShouldRequestContact returns true if the client should request a contact from the server. It checks that we're not playing, not held, queue is empty, and no request is pending.

func (*TransmissionManager) Unhold added in v0.14.0

func (tm *TransmissionManager) Unhold()

Unhold decrements the hold counter. Playback resumes when count reaches zero.

func (*TransmissionManager) Update added in v0.14.0

func (tm *TransmissionManager) Update(p platform.Platform, paused, sttActive bool)

Update manages playback state, called each frame. It handles hold timeouts and initiates playback when appropriate.

Jump to

Keyboard shortcuts

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