Documentation ¶
Index ¶
- Constants
- type Client
- type ClientOptions
- type CountMessage
- type CountdownMessage
- type Counter
- func (counter *Counter) Diff(t time.Time) time.Duration
- func (counter *Counter) Modify(delta time.Duration)
- func (counter *Counter) Output(t time.Time) *CounterOutput
- func (counter *Counter) Pause()
- func (counter *Counter) Resume()
- func (counter *Counter) Start(countdown bool, timer time.Duration)
- func (counter *Counter) Stop()
- type CounterOutput
- type DisplayMessage
- type Engine
- func (engine *Engine) DisplaySeconds() bool
- func (engine *Engine) Kill()
- func (engine *Engine) LtcActive() bool
- func (engine *Engine) ModifyCountdown(delta time.Duration)
- func (engine *Engine) ModifyCountdown2(delta time.Duration)
- func (engine *Engine) ModifyCounter(counter int, delta time.Duration)
- func (engine *Engine) ModifyCountup(delta time.Duration)
- func (engine *Engine) Normal()
- func (engine *Engine) Pause()
- func (engine *Engine) Resume()
- func (engine *Engine) StartCountdown(timer time.Duration)
- func (engine *Engine) StartCountdown2(timer time.Duration)
- func (engine *Engine) StartCounter(counter int, countdown bool, timer time.Duration)
- func (engine *Engine) StartCountup()
- func (engine *Engine) StopCountdown()
- func (engine *Engine) StopCountdown2()
- func (engine *Engine) StopCounter(counter int)
- func (engine *Engine) TimeOfDay() bool
- func (engine *Engine) Update()
- type EngineOptions
- type Message
- type Server
- type TextMessage
- type TimeMessage
Constants ¶
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 )
Clock engine state constants
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
const Version = "3.16.3"
Version is the current clock engine version
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client A clock osc client
func (*Client) SendCount ¶
func (client *Client) SendCount(message CountMessage) error
SendCount Send a /clock/count message
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
type ClientOptions ¶
type ClientOptions struct {
Connect string `long:"clock-client-connect" description:"Address to send clock osc messages to" default:"255.255.255.255:1245"` // 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 CountMessage ¶
type CountMessage struct { ColorRed float32 ColorGreen float32 ColorBlue float32 Symbol string Count int32 Unit string }
CountMessage is a legacy message format for /qmsk/clock/count
func (CountMessage) MarshalOSC ¶
func (message CountMessage) MarshalOSC(addr string) *osc.Message
MarshalOSC converts a CountMessage to osc.Message
func (*CountMessage) SetTimeRemaining ¶
func (message *CountMessage) SetTimeRemaining(seconds float32)
SetTimeRemaining sets the remaining time for CountMessage and formats the unit
func (*CountMessage) UnmarshalOSC ¶
func (message *CountMessage) UnmarshalOSC(msg *osc.Message) error
UnmarshalOSC converts a osc.Message to CountMessage
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 ¶ added in v3.16.0
type Counter struct {
// contains filtered or unexported fields
}
Counter abstracts a generic counter counting up or down
func (*Counter) Diff ¶ added in v3.16.0
Diff gives a time difference to current time that can be used to format clock output strings
func (*Counter) Output ¶ added in v3.16.0
func (counter *Counter) Output(t time.Time) *CounterOutput
Output generates the static output of the counter for use in clock displays
func (*Counter) Pause ¶ added in v3.16.0
func (counter *Counter) Pause()
Pause pauses a running counter
func (*Counter) Resume ¶ added in v3.16.0
func (counter *Counter) Resume()
Resume resumes a paused counter
type CounterOutput ¶ added in v3.16.0
type CounterOutput struct { Active bool // True if the counter is active Countdown bool // True if counting down, false if counting up Paused bool // True if counter has been paused 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 Combined string // HH:MM:SS string representation Compact string // Compact 4-character output Progress float64 // Percentage of total time elapsed of the countdown, 0-1 Diff time.Duration // raw difference }
CounterOutput the data structure returned by Counter.Output() and contains the static state of the counter at that time
type DisplayMessage ¶
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 Hours string Minutes string Seconds string Tally string TallyRed uint8 TallyGreen uint8 TallyBlue uint8 Leds int Dots bool DualText string // Dual clock mode text message, 8 characters // 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 ¶
DisplaySeconds returns true if the clock should display seconds
func (*Engine) LtcActive ¶ added in v3.9.0
LtcActive returns true if the clock is displaying LTC timecode
func (*Engine) ModifyCountdown ¶
ModifyCountdown adds or removes time from primary countdown
func (*Engine) ModifyCountdown2 ¶
ModifyCountdown2 adds or removes time from primary countdown
func (*Engine) ModifyCounter ¶ added in v3.16.0
ModifyCounter adds or removes time from a counter
func (*Engine) ModifyCountup ¶ added in v3.16.0
ModifyCountup adds or removes time from countup timer
func (*Engine) Resume ¶
func (engine *Engine) Resume()
Resume resumes both countdowns if they have been paused
func (*Engine) StartCountdown ¶
StartCountdown starts a primary countdown timer
func (*Engine) StartCountdown2 ¶
StartCountdown2 starts a secondary countdown timer
func (*Engine) StartCounter ¶ added in v3.16.0
StartCounter starts a counter
func (*Engine) StartCountup ¶
func (engine *Engine) StartCountup()
StartCountup starts counting time up from this moment
func (*Engine) StopCountdown ¶
func (engine *Engine) StopCountdown()
StopCountdown stops the primary countdown
func (*Engine) StopCountdown2 ¶
func (engine *Engine) StopCountdown2()
StopCountdown2 stops the secondary countdown
func (*Engine) StopCounter ¶ added in v3.16.0
StopCounter stops a given counter
type EngineOptions ¶
type EngineOptions struct { Flash int `long:"flash" description:"Flashing interval when countdown reached zero (ms), 0 disables" default:"500"` Timezone string `short:"t" long:"local-time" description:"Local timezone" default:"Europe/Helsinki"` ListenAddr string `long:"osc-listen" description:"Address to listen for incoming osc messages" default:"0.0.0.0:1245"` 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:"255.255.255.255:1245"` CountdownRed uint8 `long:"cd-red" description:"Red component of secondary countdown color" default:"255"` CountdownGreen uint8 `long:"cd-green" description:"Green component of secondary countdown color" default:"0"` CountdownBlue uint8 `long:"cd-blue" description:"Blue component of secondary countdown color" default:"0"` 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"` LTCFollow bool `` /* 130-byte string literal not displayed */ Format12h bool `long:"format-12h" description:"Use 12 hour format for time-of-day display"` }
EngineOptions contains all common options for clock.Engines
type Message ¶
type Message struct { Type string Data string CountMessage *CountMessage CountdownMessage *CountdownMessage DisplayMessage *DisplayMessage }
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 ¶
MakeServer creates a clock.Server instance from osc.Server instance
type TextMessage ¶ added in v3.10.0
type TextMessage struct {
Text string
}
TextMessage is for text only messages like /clock/dual/text
func (TextMessage) MarshalOSC ¶ added in v3.10.0
func (message TextMessage) MarshalOSC(addr string) *osc.Message
MarshalOSC converts a TextMessage to osc.Message
func (*TextMessage) UnmarshalOSC ¶ added in v3.10.0
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