Version: v4.6.0 Latest Latest

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

Go to latest
Published: Aug 31, 2021 License: GPL-2.0 Imports: 18 Imported by: 0




View Source
const (
	Normal    = iota // Display current time
	Countdown = iota // Display countdown timer only
	Countup   = iota // Count time up
	Off       = iota // (Mostly) blank screen
	Paused    = iota // Paused countdown timer(s)
	LTC       = iota // LTC display
	Media     = iota // Playing media counter
	Slave     = iota // Displaying slaved output

Clock engine state constants

View Source
const (
	PrimaryCounter   = 0 // Main counter that replaces the ToD display on the round clock when active
	SecondaryCounter = 1 // Secondary counter that is displayed in the tally message space on the round clock

Misc constants

View Source
const Version = "4.0.0"

Version is the current clock engine version


This section is empty.


This section is empty.


type Client

type Client struct {
	// contains filtered or unexported fields

Client A clock osc client

func (*Client) SendDisplay

func (client *Client) SendDisplay(message DisplayMessage) error

SendDisplay Send a /clock/display message

func (*Client) SendStart

func (client *Client) SendStart(message CountdownMessage) error

SendStart Send a /clock/countdown/start message

func (*Client) String

func (client *Client) String() string

Print the connection info of a Client

type ClientOptions

type ClientOptions struct {
	Connect string `long:"clock-client-connect" description:"Address to send clock osc messages to" default:""` // Address to connect to with OSC

ClientOptions common options for client instances

func (ClientOptions) MakeClient

func (options ClientOptions) MakeClient() (*Client, error)

MakeClient Create a clock OSC client

type Clock

type Clock struct {
	Text        string     // Normal clock representation HH:MM:SS(:FF)
	Hours       int        // Hours on the clock
	Minutes     int        // Minutes on the clock
	Seconds     int        // Seconds on the clock
	Frames      int        // Frames, only on LTC
	Label       string     // Label text
	Icon        string     // Icon for the clock type
	Compact     string     // 4 character condensed output
	Expired     bool       // true if asscociated timer is expired
	Mode        int        // Display type
	Paused      bool       // Is the clock/timer paused?
	Progress    float64    // Progress of the total timer 0-1
	Hidden      bool       // The timer should not be rendered if true
	TextColor   color.RGBA // Color for text
	BGColor     color.RGBA // Background color
	HideHours   bool       // Should the hour field of the time be displayed for this clock.
	HideSeconds bool       // Should seconds be shown for this clock
	SignalColor color.RGBA

Clock contains the state of a single component clock / timer

type ColorMessage

type ColorMessage struct {
	// contains filtered or unexported fields

ColorMessage holds text and background colors with alpha

func (*ColorMessage) ToRGBA

func (message *ColorMessage) ToRGBA() []color.RGBA

ToRGBA converts the message contents to a slice of color.RGBA

func (*ColorMessage) UnmarshalOSC

func (message *ColorMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC creates a colormessage from OSC message

type CountdownMessage

type CountdownMessage struct {
	Seconds int32

CountdownMessage is for /clock/countdown/start

func (CountdownMessage) MarshalOSC

func (message CountdownMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a CountdownMessage to osc.Message

func (*CountdownMessage) UnmarshalOSC

func (message *CountdownMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to CountdownMessage

type Counter

type Counter struct {
	// contains filtered or unexported fields

Counter abstracts a generic counter counting up or down

func (*Counter) Diff

func (counter *Counter) Diff(t time.Time) time.Duration

Diff gives a time difference to current time that can be used to format clock output strings

func (*Counter) Modify

func (counter *Counter) Modify(delta time.Duration)

Modify alters the counter target on a running counter

func (*Counter) Output

func (counter *Counter) Output(t time.Time) *CounterOutput

Output generates the static output of the counter for use in clock displays

func (*Counter) Pause

func (counter *Counter) Pause()

Pause pauses a running counter

func (*Counter) ResetMedia

func (counter *Counter) ResetMedia()

ResetMedia removes the media state from a counter

func (*Counter) ResetSlave

func (counter *Counter) ResetSlave()

ResetSlave removes slave state from external source

func (*Counter) Resume

func (counter *Counter) Resume()

Resume resumes a paused counter

func (*Counter) SetMedia

func (counter *Counter) SetMedia(hours, minutes, seconds, frames int32, remaining time.Duration, progress float64, paused bool, looping bool)

SetMedia sets the counter state from a playing media file

func (*Counter) SetSlave

func (counter *Counter) SetSlave(hours, minutes, seconds int, hideHours bool, icon string)

SetSlave sets the counter state as a slave from external source

func (*Counter) Start

func (counter *Counter) Start(countdown bool, timer time.Duration)

Start begins counting time up or down

func (*Counter) Stop

func (counter *Counter) Stop()

Stop stops and deactivates the counter

func (*Counter) Target

func (counter *Counter) Target(target time.Time)

Target sets the target date and time for a counter

type CounterOutput

type CounterOutput struct {
	Active      bool          // True if the counter is active
	Media       bool          // True if counter represents a playing media file
	Countdown   bool          // True if counting down, false if counting up
	Paused      bool          // True if counter has been paused
	Looping     bool          // True if the playing media is looping in the player
	Expired     bool          // Has the countdown timer expired?
	Hours       int           // Hour part of the timer
	Minutes     int           // Minutes of the timer, 0-60
	Seconds     int           // Seconds of the timer, 0-60
	Text        string        // HH:MM:SS string representation
	Icon        string        // Single unicode glyph to use as an icon for the timer
	Compact     string        // Compact 4-character output
	Progress    float64       // Percentage of total time elapsed of the countdown, 0-1
	Diff        time.Duration // raw difference
	HideHours   bool
	SignalColor color.RGBA

CounterOutput the data structure returned by Counter.Output() and contains the static state of the counter at that time

type DisplayMessage

type DisplayMessage struct {
	ColorRed   float32
	ColorGreen float32
	ColorBlue  float32
	Text       string

DisplayMessage is for /clock/display

func (DisplayMessage) MarshalOSC

func (message DisplayMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a DisplayMessage to osc.Message

func (*DisplayMessage) UnmarshalOSC

func (message *DisplayMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to DisplayMessage

type Engine

type Engine struct {
	Counters []*Counter // Timer counters
	// contains filtered or unexported fields

Engine contains the state machine for clock-8001

func MakeEngine

func MakeEngine(options *EngineOptions) (*Engine, error)

MakeEngine creates a clock engine

func (*Engine) DisplaySeconds

func (engine *Engine) DisplaySeconds() bool

DisplaySeconds returns true if the clock should display seconds

func (*Engine) LtcActive

func (engine *Engine) LtcActive() bool

LtcActive returns true if the clock is displaying LTC timecode

func (*Engine) ModifyCounter

func (engine *Engine) ModifyCounter(counter int, delta time.Duration)

ModifyCounter adds or removes time from a counter

func (*Engine) Pause

func (engine *Engine) Pause()

Pause pauses all timers

func (*Engine) PauseCounter

func (engine *Engine) PauseCounter(counter int)

PauseCounter pauses a given counter

func (*Engine) Resume

func (engine *Engine) Resume()

Resume resumes all timers

func (*Engine) ResumeCounter

func (engine *Engine) ResumeCounter(counter int)

ResumeCounter resumes a paused counter

func (*Engine) SetSourceColors

func (engine *Engine) SetSourceColors(source int, text, bg color.RGBA)

SetSourceColors sets the source output colors

func (*Engine) SetTitleColors

func (engine *Engine) SetTitleColors(text, bg color.RGBA)

SetTitleColors sets the source title colors

func (*Engine) StartCounter

func (engine *Engine) StartCounter(counter int, countdown bool, timer time.Duration)

StartCounter starts a counter

func (*Engine) State

func (engine *Engine) State() *State

State creates a snapshot of the clock state for display on clock faces

func (*Engine) StopCounter

func (engine *Engine) StopCounter(counter int)

StopCounter stops a given counter

func (*Engine) TargetCounter

func (engine *Engine) TargetCounter(counter int, target string, countdown bool)

TargetCounter sets the target time and date for a counter

type EngineOptions

type EngineOptions struct {
	Flash              int    `long:"flash" description:"Flashing interval when countdown reached zero (ms), 0 disables" default:"500"`
	ListenAddr         string `long:"osc-listen" description:"Address to listen for incoming osc messages" default:""`
	Timeout            int    `short:"d" long:"timeout" description:"Timeout for OSC message updates in milliseconds" default:"1000"`
	Connect            string `short:"o" long:"osc-dest" description:"Address to send OSC feedback to" default:""`
	DisableOSC         bool   `long:"disable-osc" description:"Disable OSC control and feedback"`
	DisableFeedback    bool   `long:"disable-feedback" description:"Disable OSC feedback"`
	DisableLTC         bool   `long:"disable-ltc" description:"Disable LTC display mode"`
	LTCSeconds         bool   `long:"ltc-seconds" description:"Show seconds on the ring in LTC mode"`
	UDPTime            string `long:"udp-time" description:"Stagetimer2 UDP protocol support" choice:"off" choice:"send" choice:"receive" default:"receive"`
	UDPTimer1          int    `long:"udp-timer-1" description:"Timer to send as UDP timer 1 (port 36700)" default:"1"`
	UDPTimer2          int    `long:"udp-timer-2" description:"Timer to send as UDP timer 2 (port 36701)" default:"2"`
	LTCFollow          bool   `` /* 130-byte string literal not displayed */
	Format12h          bool   `long:"format-12h" description:"Use 12 hour format for time-of-day display"`
	Mitti              int    `long:"mitti" description:"Counter number for Mitti OSC feedback" default:"8"`
	Millumin           int    `long:"millumin" description:"Counter number for Millumin OSC feedback" default:"9"`
	Ignore             string `` /* 137-byte string literal not displayed */
	ShowInfo           int    `long:"info-timer" description:"Show clock status for x seconds on startup" default:"30"`
	OvertimeCountMode  string `` /* 147-byte string literal not displayed */
	OvertimeVisibility string `` /* 156-byte string literal not displayed */

	AutoSignals            bool   `long:"auto-signals" description:"Automatic signal colors based on timer state"`
	SignalStart            bool   `long:"signal-start" description:"Set signal color on timer start"`
	SignalColorStart       string `long:"signal-color-start" description:"Signal colors for timers above thresholds" default:"#00FF00"`
	SignalColorWarning     string `long:"signal-color-warning" description:"Signal colors for timers between thresholds" default:"#FFFF00"`
	SignalColorEnd         string `long:"signal-color-end" description:"Signal colors for timers bellow thresholds" default:"#FF0000"`
	SignalThresholdWarning int    `long:"signal-threshold-warning" description:"Threshold for medium color transition (seconds)" default:"180"`
	SignalThresholdEnd     int    `long:"signal-threshold-end" description:"Threshold for medium color transition (seconds)" default:"60"`
	SignalHardware         int    `long:"signal-hw-group" description:"Hardware signal group number" default:"1"`

	Source1 *SourceOptions `group:"1st clock display source" namespace:"source1"`
	Source2 *SourceOptions `group:"2nd clock display source" namespace:"source2"`
	Source3 *SourceOptions `group:"3rd clock display source" namespace:"source3"`
	Source4 *SourceOptions `group:"4th clock display source" namespace:"source4"`

EngineOptions contains all common options for clock.Engines

type MediaMessage

type MediaMessage struct {
	// contains filtered or unexported fields

MediaMessage contains data from media players

func (MediaMessage) MarshalOSC

func (message MediaMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a MediaMessage to osc.Message

func (*MediaMessage) UnmarshalOSC

func (message *MediaMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to MediaMessage

type Message

type Message struct {
	Type               string
	Counter            int
	Countdown          bool
	Data               string
	CountdownMessage   *CountdownMessage
	DisplayMessage     *DisplayMessage
	MediaMessage       *MediaMessage
	DisplayTextMessage *displayTextMessage
	Colors             []color.RGBA

Message is a generic clock message for decoded osc data

type Server

type Server struct {
	Debug bool
	// contains filtered or unexported fields

Server is a clock osc server and listens for incoming osc messages

func MakeServer

func MakeServer(oscServer *osc.Server, uuid string) *Server

MakeServer creates a clock.Server instance from osc.Server instance

func (*Server) Listen

func (server *Server) Listen() chan Message

Listen adds a new listener for the decoded incoming osc messages

type SourceOptions

type SourceOptions struct {
	Text          string `long:"text" description:"Title text for the time source"`
	Counter       int    `long:"counter" description:"Counter number to associate with this source, leave empty to disable it as a suorce" default:"0"`
	LTC           bool   `long:"ltc" description:"Enable LTC as a source"`
	Timer         bool   `long:"timer" description:"Enable timer counter as a source"`
	Tod           bool   `long:"tod" description:"Enable time-of-day as a source"`
	TimeZone      string `long:"timezone" description:"Time zone to use for ToD display" default:"Europe/Helsinki"`
	Hidden        bool   `long:"hidden" description:"Hide this time source"`
	OvertimeColor string `long:"overtime-color" description:"Background color for overtime countdowns, in HTML format #FFFFFF" default:"#FF0000"`

SourceOptions contains all options for clock display sources.

type State

type State struct {
	Initialized         bool        // Does the clock have valid time or has it received an osc command?
	Clocks              []*Clock    // All configured clocks / timers
	Tally               string      // Tally message text
	TallyColor          *color.RGBA // Tally message color
	TallyBG             *color.RGBA // Tally message background color
	Flash               bool        // Flash cycle state
	Background          int         // User selected background number
	Info                string      // Clock information, version, ip-address etc. Should be displayed if not empty
	TitleColor          color.RGBA  // Color for the clock title text
	TitleBGColor        color.RGBA  // Background color for clock title text
	ScreenFlash         bool        // Set to true if the screen should be flashed white
	HardwareSignalColor color.RGBA

State is a snapshot of the clock representation on the time State() was called

type TextMessage

type TextMessage struct {
	Text string

TextMessage is for text only messages like /clock/dual/text

func (TextMessage) MarshalOSC

func (message TextMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a TextMessage to osc.Message

func (*TextMessage) UnmarshalOSC

func (message *TextMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to TextMessage

type TimeMessage

type TimeMessage struct {
	Time string

TimeMessage is for /clock/settime and /clock/ltc

func (TimeMessage) MarshalOSC

func (message TimeMessage) MarshalOSC(addr string) *osc.Message

MarshalOSC converts a TimeMessage to osc.Message

func (*TimeMessage) UnmarshalOSC

func (message *TimeMessage) UnmarshalOSC(msg *osc.Message) error

UnmarshalOSC converts a osc.Message to TimeMessage

Jump to

Keyboard shortcuts

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