priority

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Nov 23, 2026 License: MIT Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package priority raises the process's scheduling priority for audio.

On Windows, WASAPI shared mode has no out-of-process mixer to absorb a late wakeup: the render thread must refill the endpoint buffer before its next period, so under heavy CPU load a normal-priority thread is preempted and the buffer drains. Linux does not need this because PulseAudio runs the actual mixing in its own real-time-priority server process, so a late feeder only deepens a buffer. This package is the Windows correction: it raises the process to above-normal and asks for a 1 ms timer, so the render thread wakes on time. Elsewhere it is a no-op.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Report

type Report struct {
	// Platform is the detected OS and architecture, GOOS/GOARCH.
	Platform string

	// Priority is a short human description of the scheduling state in force.
	Priority string
}

Report is the scheduling state a Raise leaves behind, for a startup debug line. Platform is always filled; Priority describes what is in effect, whether or not this package changed anything.

func Raise

func Raise() (Report, error)

Raise lifts the process's scheduling priority for playback and reports what it did. It is best-effort: a host that refuses the change still plays, just without the extra margin, so a caller logs the returned Report and the error rather than treating it as fatal. The change is process-wide, which is what reaches the backend's own render thread, and it is left in place for the life of the process.

func (Report) Lines

func (r Report) Lines() []string

Lines returns the report as the one-per-line strings a front end logs.

Jump to

Keyboard shortcuts

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