ui

package
v0.0.0-...-3fe1002 Latest Latest
Warning

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

Go to latest
Published: Apr 13, 2026 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownsampleFrame

func DownsampleFrame(frame *image.RGBA, config PreviewConfig) [][]color.RGBA

DownsampleFrame takes a full-resolution RGB frame and downsamples it to preview size Each terminal cell represents a rectangular region of the source image Averages all pixels in each region for smooth, high-quality downsampling

func RenderPreview

func RenderPreview(preview [][]color.RGBA) string

RenderPreview converts an RGB preview grid to a string representation using ANSI 24-bit true color escape codes for beautiful colored rendering

Types

type AnalysisComplete

type AnalysisComplete struct {
	PeakMagnitude float64
	RMSLevel      float64
	DynamicRange  float64
	Duration      time.Duration
	OptimalScale  float64
	AnalysisTime  time.Duration
}

AnalysisComplete signals completion of Pass 1 with audio profile data

type AnalysisProgress

type AnalysisProgress struct {
	Frame       int
	TotalFrames int
	CurrentRMS  float64
	CurrentPeak float64
	BarHeights  []float64
	Duration    time.Duration
}

AnalysisProgress represents progress updates from Pass 1 audio analysis

type AudioProfile

type AudioProfile struct {
	Duration     time.Duration
	PeakLevel    float64 // in dB
	RMSLevel     float64 // in dB
	DynamicRange float64 // in dB
	OptimalScale float64
	AnalysisTime time.Duration
}

AudioProfile holds the audio analysis results for display

type Model

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

Model implements the unified Bubbletea model for both passes

func NewModel

func NewModel(noPreview bool) *Model

NewModel creates a new unified progress UI model

func (*Model) CompletionSummary

func (m *Model) CompletionSummary() string

CompletionSummary returns the final completion summary for printing after alt screen exits. Returns empty string if encoding is not complete.

func (*Model) Init

func (m *Model) Init() tea.Cmd

Init initializes the model

func (*Model) Update

func (m *Model) Update(msg tea.Msg) (tea.Model, tea.Cmd)

Update handles messages

func (*Model) View

func (m *Model) View() string

View renders the UI

type Phase

type Phase int

Phase represents the current processing phase

const (
	PhaseAnalysis Phase = iota
	PhaseRendering
	PhaseComplete
)

type PreviewConfig

type PreviewConfig struct {
	Width  int // Width in terminal cells
	Height int // Height in terminal cells
}

PreviewConfig holds configuration for the video preview

func DefaultPreviewConfig

func DefaultPreviewConfig() PreviewConfig

DefaultPreviewConfig returns a sensible default preview size Using 72x20 1.8:1 (slightly wider than 16:9 but very close)

type RenderComplete

type RenderComplete struct {
	OutputFile       string
	Duration         time.Duration
	FileSize         int64
	TotalFrames      int
	VisTime          time.Duration // Visualisation: FFT + binning + drawing
	EncodeTime       time.Duration // Video encoding time
	AudioTime        time.Duration // Audio reading + encoding time
	FinalizeTime     time.Duration // Encoder finalization (flush + close)
	TotalTime        time.Duration
	ThumbnailTime    time.Duration
	SamplesProcessed int64
	EncoderName      string // Video encoder used (e.g., "h264_nvenc", "libx264")
}

RenderComplete signals completion of Pass 2

type RenderProgress

type RenderProgress struct {
	Frame       int
	TotalFrames int
	Elapsed     time.Duration
	BarHeights  []float64
	FileSize    int64
	Sensitivity float64
	FrameData   *image.RGBA
	VideoCodec  string
	AudioCodec  string
}

RenderProgress represents progress updates from Pass 2 video rendering

Jump to

Keyboard shortcuts

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