Each row on Playback, Output Devices and Input Devices gets a level bar under its slider. A meter is a small capture pw_stream on WirePlumber's pw_core with the properties pipewire-pulse gives pavucontrol's peak streams (stream.monitor, target.object, stream.capture.sink for sinks); its process callback folds samples into a peak that a 40 ms GUI timer reads, maps with the slider's cubic curve and decays smoothly. - Only the visible tab is metered; output/stream meters are passive. - stream.monitor nodes (ours and pavucontrol's) are hidden from the tabs. - moonmix-probe gains `meter <id>`; the smoke test now plays noise and checks the stream and sink meters see it. - Screenshot mode holds the meters still before capturing, since a constantly redrawing window never yields a frame under broadway. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
146 lines
2.9 KiB
Plaintext
146 lines
2.9 KiB
Plaintext
// Generated using `moon info`, DON'T EDIT IT
|
|
package "geordi/moonmix/model"
|
|
|
|
import {
|
|
"moonbitlang/core/debug",
|
|
}
|
|
|
|
// Values
|
|
pub const MAX_PERCENT : Double = 150.0
|
|
|
|
pub const METER_DECAY : Double = 0.04
|
|
|
|
pub const NORM_PERCENT : Double = 100.0
|
|
|
|
pub fn clamp_percent(Double) -> Double
|
|
|
|
pub fn compare_text(String, String) -> Int32
|
|
|
|
pub fn diff_rows(Array[Row], Array[Row]) -> Diff
|
|
|
|
pub fn display_title(Node) -> String
|
|
|
|
pub fn format_db(Double) -> String
|
|
|
|
pub fn format_percent(Double) -> String
|
|
|
|
pub fn format_volume(Array[Double]) -> String
|
|
|
|
pub fn linear_to_db(Double) -> Double?
|
|
|
|
pub fn linear_to_percent(Double) -> Double
|
|
|
|
pub fn linked_percent(Array[Double]) -> Double
|
|
|
|
pub fn meter_level(Double) -> Double
|
|
|
|
pub fn meter_step(Double, Double) -> Double
|
|
|
|
pub fn percent_to_linear(Double) -> Double
|
|
|
|
pub fn rows(State, Tab) -> Array[Row]
|
|
|
|
pub fn scale_linked(Array[Double], Double) -> Array[Double]
|
|
|
|
pub fn should_apply_remote(Int64, Int64, window_us? : Int64) -> Bool
|
|
|
|
// Errors
|
|
|
|
// Types and methods
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct DeviceChoice {
|
|
id : Int32
|
|
name : String
|
|
label : String
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct Diff {
|
|
removed : Array[Int32]
|
|
added : Array[Int32]
|
|
updated : Array[Int32]
|
|
}
|
|
|
|
#derive(@debug.Debug)
|
|
pub(all) enum Event {
|
|
Upsert(Node)
|
|
Remove(Int32)
|
|
Links(Array[Link])
|
|
Defaults(sink~ : Int32, source~ : Int32)
|
|
Reset
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct Link {
|
|
output_node : Int32
|
|
input_node : Int32
|
|
}
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct Node {
|
|
id : Int32
|
|
name : String
|
|
description : String
|
|
media_class : String
|
|
app_name : String
|
|
media_name : String
|
|
icon_name : String
|
|
volumes : Array[Double]
|
|
mute : Bool
|
|
}
|
|
pub fn Node::kind(Self) -> NodeKind
|
|
pub fn Node::new(Int32, String, name? : String, description? : String, app_name? : String, media_name? : String, icon_name? : String, volumes? : Array[Double], mute? : Bool) -> Self
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum NodeKind {
|
|
Sink
|
|
Source
|
|
PlaybackStream
|
|
RecordStream
|
|
Other
|
|
}
|
|
pub fn NodeKind::from_media_class(String) -> Self
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) struct Row {
|
|
id : Int32
|
|
title : String
|
|
subtitle : String
|
|
icon_name : String
|
|
volumes : Array[Double]
|
|
percent : Double
|
|
volume_text : String
|
|
mute : Bool
|
|
has_volume : Bool
|
|
is_default : Bool
|
|
choices : Array[DeviceChoice]
|
|
current_choice : Int32
|
|
}
|
|
|
|
pub(all) struct State {
|
|
nodes : Map[Int32, Node]
|
|
mut links : Array[Link]
|
|
mut default_sink : Int32
|
|
mut default_source : Int32
|
|
}
|
|
pub fn State::apply(Self, Event) -> Bool
|
|
pub fn State::new() -> Self
|
|
pub fn State::nodes_of(Self, NodeKind) -> Array[Node]
|
|
pub fn State::stream_device(Self, Int32) -> Int32?
|
|
|
|
#derive(Eq, @debug.Debug)
|
|
pub(all) enum Tab {
|
|
Playback
|
|
Recording
|
|
OutputDevices
|
|
InputDevices
|
|
}
|
|
pub fn Tab::all() -> Array[Self]
|
|
pub fn Tab::empty_text(Self) -> String
|
|
pub fn Tab::label(Self) -> String
|
|
pub fn Tab::node_kind(Self) -> NodeKind
|
|
|
|
// Type aliases
|
|
|
|
// Traits
|