device

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2026 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BeginSyncOutput

func BeginSyncOutput()

BeginSyncOutput enables synchronized output mode (OSC 2026) on terminals that support it.

func CopyToClipboard

func CopyToClipboard(text string)

CopyToClipboard copies text via OSC-52 and falls back to common OS clipboard helpers.

func EndSyncOutput

func EndSyncOutput()

EndSyncOutput disables synchronized output mode.

func GetTermSize

func GetTermSize() (cols, rows int, err error)

GetTermSize queries the current terminal size in character cells using stdout.

func StartCameraStream

func StartCameraStream(ctx context.Context) (<-chan CameraFrame, error)

StartCameraStream starts camera capture using gocam and returns a frame channel. Frames are center-cropped to CIF aspect and resized to 352x288 before being sent to consumers.

func StartMicrophoneStream

func StartMicrophoneStream(ctx context.Context, sampleRate, channels int) (<-chan []int16, error)

StartMicrophoneStream starts capturing microphone PCM samples with the given sample rate and channel count.

Types

type CameraFrame

type CameraFrame = gocam.Frame

CameraFrame is the raw RGB frame type produced by the camera backend.

type Speaker

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

Speaker handles audio playback via malgo.

func StartSpeaker

func StartSpeaker(sampleRate, channels, frameSamples int, speakerIn <-chan []int16, stopCh <-chan struct{}, onStop func()) (*Speaker, error)

StartSpeaker initializes a playback device that consumes PCM frames from speakerIn. stopCh is observed to output silence when the session stops, and onStop is invoked when the underlying device stops unexpectedly.

func (*Speaker) Close

func (s *Speaker) Close()

Close stops playback and releases device resources.

type Terminal

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

Terminal represents a running terminal output device.

func StartTerminal

func StartTerminal(frameIn <-chan *TerminalFrame, stopCh <-chan struct{}, onStop func()) (*Terminal, error)

StartTerminal launches a goroutine that consumes frames from frameIn and renders them until stopCh is closed or the frame channel closes.

func (*Terminal) Done

func (t *Terminal) Done() <-chan struct{}

Done returns a channel that closes when the terminal driver stops.

type TerminalFrame

type TerminalFrame struct {
	Data string
}

TerminalFrame carries a fully prepared ANSI payload that the terminal driver should print verbatim.

Jump to

Keyboard shortcuts

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