Class: Xi::TidalClock
Constant Summary collapse
- SYNC_INTERVAL_SEC =
100 / 1000.0
Constants inherited from Clock
Clock::DEFAULT_CPS, Clock::INTERVAL_SEC
Instance Attribute Summary collapse
-
#attached ⇒ Object
(also: #attached?)
readonly
Returns the value of attribute attached.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Attributes inherited from Clock
Instance Method Summary collapse
- #attach ⇒ Object
- #cps=(new_cps) ⇒ Object
- #dettach ⇒ Object
-
#initialize(server: 'localhost', port: 9160, **opts) ⇒ TidalClock
constructor
A new instance of TidalClock.
Methods inherited from Clock
#bpm, #bpm=, #bps, #bps=, #cps, #current_cycle, #current_time, #inspect, #play, #playing?, #seconds_per_cycle, #stop, #stopped?, #subscribe, #unsubscribe
Constructor Details
#initialize(server: 'localhost', port: 9160, **opts) ⇒ TidalClock
Returns a new instance of TidalClock.
11 12 13 14 15 16 17 18 19 |
# File 'lib/xi/tidal_clock.rb', line 11 def initialize(server: 'localhost', port: 9160, **opts) @server = server @port = port @attached = true super(opts) @ws_thread = Thread.new { ws_thread_routine } end |
Instance Attribute Details
#attached ⇒ Object (readonly) Also known as: attached?
Returns the value of attribute attached.
8 9 10 |
# File 'lib/xi/tidal_clock.rb', line 8 def attached @attached end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
8 9 10 |
# File 'lib/xi/tidal_clock.rb', line 8 def port @port end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
8 9 10 |
# File 'lib/xi/tidal_clock.rb', line 8 def server @server end |
Instance Method Details
#attach ⇒ Object
30 31 32 33 |
# File 'lib/xi/tidal_clock.rb', line 30 def attach @attached = true self end |
#cps=(new_cps) ⇒ Object
21 22 23 |
# File 'lib/xi/tidal_clock.rb', line 21 def cps=(new_cps) fail NotImplementedError, 'cps is read-only' end |
#dettach ⇒ Object
25 26 27 28 |
# File 'lib/xi/tidal_clock.rb', line 25 def dettach @attached = false self end |