monteverdi

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Version = "dev"

Functions

func CalcAngle added in v0.5.0

func CalcAngle(ps time.Time) float64

CalcAngle returns the pulse's place along the ring.

func CalcIntensity added in v0.5.0

func CalcIntensity(ep *Ms.Endpoint) float64

CalcIntensity returns an intensity float ps = pulse start NB: endpoint.MU is already RLocked by the caller (GetPulseDataD3)

func CalcRing added in v0.5.0

func CalcRing(ps time.Time) int

CalcRing returns which ring the pulse belongs based on age

func CalcSpeed added in v0.5.0

func CalcSpeed(ps time.Time, config SpeedConfig) float64

CalcSpeed has the following Base speeds for each ring (degrees per 50ms update) Inner ring completes full rotation in ~18 seconds (360° / 2°/frame * 50ms) Middle ring completes full rotation in ~36 seconds Outer ring completes full rotation in ~72 seconds

func InitMIDIOutput added in v0.17.5

func InitMIDIOutput(view *View, outputLocation string) error

InitMIDIOutput sets up a connected MIDI device

func PulsePatternToString added in v0.5.0

func PulsePatternToString(pattern Mt.PulsePattern) string

PulsePatternToString returns a string form of the constant.

func StartHarmonyView added in v0.10.7

func StartHarmonyView(c []Ms.ConfigFile, path string) error

StartHarmonyView is the Terminal UI alongside the Web UI, running on localhost:8090 This is the default view when runTUI from a shell. If there is no TTY, it will not runTUI. The `-headless` flag can be used to runTUI in Web UI only mode, StartHarmonyViewWebOnly The TUI operates with several looping and blocking processes, all handled here.

func StartHarmonyViewWebOnly added in v0.10.7

func StartHarmonyViewWebOnly(c []Ms.ConfigFile, path string) error

StartHarmonyViewWebOnly is the Web UI only, running on localhost:8090 The ticker for the runtime loop is here as a goroutine, the web server blocks. This runs when using the `-headless` flag. Logs appear in the console instead of a file.

Types

type EndpointPoller added in v0.15.0

type EndpointPoller struct {
	QNet     *Ms.QNet
	Index    int          // Index in QNet.Network
	Ticker   *time.Ticker // Frequency
	StopChan chan struct{}
}

EndpointPoller manages per-endpoint polling

type MetricData added in v0.18.1

type MetricData struct {
	Endpoint    string  `json:"endpoint"`
	Metric      string  `json:"metric"`
	CurrentVal  int64   `json:"currentVal"`
	MaxVal      int64   `json:"maxVal"`
	IsAccent    bool    `json:"isAccent"`
	PercentUsed float64 `json:"percentUsed"`
}

type PollSupervisor added in v0.10.8

type PollSupervisor struct {
	View    *View
	Pollers []*EndpointPoller
	WG      sync.WaitGroup
}

PollSupervisor is a wrapper around the View that manages polling goroutines They are strongly coupled, one knows about the other

func (*PollSupervisor) Restart added in v0.10.8

func (ps *PollSupervisor) Restart()

Restart the PollSupervisor

func (*PollSupervisor) Start added in v0.10.8

func (ps *PollSupervisor) Start()

Start the PollSupervisor

func (*PollSupervisor) Stop added in v0.10.8

func (ps *PollSupervisor) Stop()

Stop the PollSupervisor This is idempotent and will run even if stopped

type PulseDataD3 added in v0.5.0

type PulseDataD3 struct {
	Ring      int     `json:"ring"`      // 0=60sec, 1=10min, 2=1hr
	Angle     float64 `json:"angle"`     // 0-360 degrees
	Type      string  `json:"type"`      // PulsePattern Types
	Intensity float64 `json:"intensity"` // 0.0-1.0
	Speed     float64 `json:"speed"`     // degrees per frame
	Metric    string  `json:"metric"`    // Which system metric
	Dimension int     `json:"dimension"` // Dimension for viz placement
	StartTime int64   `json:"startTime"` // StartTime key for the pulse
	Duration  int64   `json:"duration"`  // Pulse Duration
	Endpoint  string  `json:"endpoint"`  // Endpoint ID
}

type RespWriter added in v0.10.3

type RespWriter struct {
	http.ResponseWriter
	Status int
}

RespWriter is used by StatsMiddleware, used for Prometheus

func (*RespWriter) Write added in v0.10.3

func (w *RespWriter) Write(b []byte) (int, error)

Write is a helper for StatsMiddleware, used for Prometheus

func (*RespWriter) WriteHeader added in v0.10.3

func (w *RespWriter) WriteHeader(status int)

WriteHeader is a helper for StatsMiddleware, used for Prometheus

type SpeedConfig added in v0.5.0

type SpeedConfig struct {
	InnerBase  float64 // Ring 0 base speed
	MiddleBase float64 // Ring 1 base speed
	OuterBase  float64 // Ring 2 base speed
	GlobalBase float64 // Configurable global multiplier
}

type SystemInfo added in v0.18.1

type SystemInfo struct {
	OutputType  string `json:"outputType"`
	MIDIPort    string `json:"midiPort,omitempty"`
	MIDIChannel int    `json:"midiChannel"`
	MIDIRoot    int    `json:"midiRoot"`
	MIDIScale   string `json:"midiScale,omitempty"`
	MIDINotes   string `json:"midiNotes,omitempty"`
}

type View

type View struct {
	MU      sync.Mutex        // State locks to read data
	QNet    *Ms.QNet          // Quality Network
	Screen  tcell.Screen      // the screen itself
	Display []string          // rune display sequence
	Stats   *Mo.StatsInternal // Internal status for prometheus

	SelectEP    int              // Selected Endpoint with MouseClick
	ShowEP      bool             // Display Endpoint ID
	SelectMe    string           // Selected Metric with MouseClick
	ShowMe      bool             // Display Metric ID
	ShowPulse   bool             // Display pulse view overlay
	PulseFilter *Mt.PulsePattern // For filtering the display
	Supervisor  *PollSupervisor  // Supervisor for performing QNet polling
	ConfigPath  string           // Path to JSON configuration
	// contains filtered or unexported fields
}

View is updated by whatever is in the QNet

func NewViewWithScreen added in v0.10.6

func NewViewWithScreen(q *Ms.QNet, screen tcell.Screen) (*View, error)

NewViewWithScreen inits the tcell screen that displays HarmonyView. It takes a tcell.screen as an input alongside the current QNet.

func (*View) CalcDurationWidth added in v0.10.3

func (v *View) CalcDurationWidth(duration time.Duration) int

func (*View) CalcSpeedForPulse added in v0.5.0

func (v *View) CalcSpeedForPulse(pe Mt.PulseEvent) float64

CalcSpeedForPulse is a wrapper for CalcSpeed to provide a configuration

func (*View) CalcTimePos added in v0.10.3

func (v *View) CalcTimePos(pulseStartTime time.Time) int

func (*View) CalcTimeseriesY added in v0.10.3

func (v *View) CalcTimeseriesY(endpointIndex, metricIndex, gutter int) int

CalcTimeseriesY figures out where to draw the next Timeseries entry on the graph

func (*View) ConfHandler added in v0.10.9

func (v *View) ConfHandler(w http.ResponseWriter, r *http.Request)

ConfHandler receives the new JSON config, validates, and reloads

func (*View) DrawHarmonyViewMulti added in v0.10.5

func (v *View) DrawHarmonyViewMulti()

DrawHarmonyViewMulti draws the HarmonyView itself with tcell Includes a toggle for View mode (Accent or Pulse)

func (*View) DrawPulseView added in v0.10.7

func (v *View) DrawPulseView()

func (*View) DrawRune added in v0.10.3

func (v *View) DrawRune(x, y, m int)

DrawRune places a single '' on the screen used to draw the accents/second indicator

func (*View) DrawText added in v0.10.3

func (v *View) DrawText(x1, y1, x2, y2 int, text string)

DrawText displays the text string at the given (x1, y1) with box size (x2, y2)

func (*View) DrawTimeseries added in v0.10.3

func (v *View) DrawTimeseries(x, y, i int, m string)

DrawTimeseries displays the current Timeseries data for a metric

func (*View) DrawViewBorder added in v0.10.3

func (v *View) DrawViewBorder(width, height int)

DrawViewBorder displays the outline of the View

func (*View) GetPulseDataD3 added in v0.5.0

func (v *View) GetPulseDataD3() []PulseDataD3

GetPulseDataD3 prepares the websocket data payload

func (*View) GetPulseRune added in v0.10.3

func (v *View) GetPulseRune(pattern Mt.PulsePattern, isAccent bool) (rune, tcell.Style)

func (*View) GetScreenSize added in v0.10.3

func (v *View) GetScreenSize() (int, int)

GetScreenSize provides the terminal size for drawing

func (*View) HandleMouseClick added in v0.10.3

func (v *View) HandleMouseClick(x, y int)

HandleMouseClick shows corresponding data with what was clicked

func (*View) MetricsDataHandler added in v0.10.2

func (v *View) MetricsDataHandler(w http.ResponseWriter, r *http.Request)

MetricsDataHandler returns a JSON blob with the full set of running metrics and systeminfo

func (*View) NewPollSupervisor added in v0.10.8

func (v *View) NewPollSupervisor() *PollSupervisor

NewPollSupervisor creates a new supervisor for all endpoints

func (*View) PluginControlHandler added in v0.19.0

func (v *View) PluginControlHandler(w http.ResponseWriter, r *http.Request)

func (*View) ReloadConfig added in v0.10.8

func (v *View) ReloadConfig(ctx context.Context, c []Ms.ConfigFile)

ReloadConfig performs an automatic restart after filling QNet with the new config

func (*View) RenderPulseViz added in v0.10.7

func (v *View) RenderPulseViz(x, y int, tld []Mt.PulseVizPoint)

func (*View) ResizeScreen added in v0.10.5

func (v *View) ResizeScreen()

ResizeScreen resizes HarmonyView after terminal changes

func (*View) SetupMux added in v0.10.2

func (v *View) SetupMux() *mux.Router

SetupMux handles all data serving: - Prometheus metric endpoint - Websocket specialized for D3.js UI - Version for programmatic use - Metrics Data for UI feedback

func (*View) StatsMiddleware added in v0.10.3

func (v *View) StatsMiddleware(next http.Handler) http.Handler

StatsMiddleware invokes the HTTP Responses above, used for Prometheus

func (*View) UpdateScreen added in v0.10.5

func (v *View) UpdateScreen()

UpdateScreen clears, calls the main drawing function, and displays

func (*View) VersionHandler added in v0.10.2

func (v *View) VersionHandler(w http.ResponseWriter, r *http.Request)

VersionHandler returns the current release version This must be compiled with:

go build -ldflags "-X github.com/maroda/monteverdi/display.Version=$(git describe --tags --always)"

func (*View) WebsocketHandler added in v0.10.2

func (v *View) WebsocketHandler(w http.ResponseWriter, r *http.Request)

Jump to

Keyboard shortcuts

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