Class: Zgomot::UI::GlobalsWindow
Constant Summary collapse
- ITEM_WIDTH =
32- TIME_WIDTH =
15
Instance Attribute Summary collapse
-
#beats_per_minute_window ⇒ Object
readonly
Returns the value of attribute beats_per_minute_window.
-
#input_window ⇒ Object
readonly
Returns the value of attribute input_window.
-
#output_window ⇒ Object
readonly
Returns the value of attribute output_window.
-
#resolution_window ⇒ Object
readonly
Returns the value of attribute resolution_window.
-
#seconds_per_beat_window ⇒ Object
readonly
Returns the value of attribute seconds_per_beat_window.
-
#time_signature_window ⇒ Object
readonly
Returns the value of attribute time_signature_window.
-
#time_window ⇒ Object
readonly
Returns the value of attribute time_window.
-
#title_window ⇒ Object
readonly
Returns the value of attribute title_window.
Instance Method Summary collapse
- #display ⇒ Object
-
#initialize(top) ⇒ GlobalsWindow
constructor
A new instance of GlobalsWindow.
- #time_to_s ⇒ Object
Constructor Details
#initialize(top) ⇒ GlobalsWindow
Returns a new instance of GlobalsWindow.
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/zgomot/ui/windows.rb', line 127 def initialize(top) output = Zgomot::Drivers::Mgr.output input = Zgomot::Drivers::Mgr.input || 'None' beats_per_minute = Zgomot::Midi::Clock.beats_per_minute.to_i.to_s time_signature = Zgomot::Midi::Clock.time_signature resolution = "1/#{Zgomot::Midi::Clock.resolution.to_i}" seconds_per_beat = Zgomot::Midi::Clock.beat_sec.to_s @title_window = TitleWindow.new('zgomot', COLOR_BORDER, 0, COLOR_PINK) @input_window = TextWithValueWindow.new('Input', input, COLOR_BORDER, 3, 0, COLOR_IDLE) @output_window = TextWithValueWindow.new('Output', output, COLOR_BORDER, 4, 0, COLOR_IDLE) @time_signature_window = TextWithValueWindow.new('Time Signature', time_signature, COLOR_BORDER, 5, 0, COLOR_IDLE) @beats_per_minute_window = TextWithValueWindow.new('Beats/Minute', beats_per_minute, COLOR_BORDER, 3, ITEM_WIDTH, COLOR_IDLE) @seconds_per_beat_window = TextWithValueWindow.new('Seconds/Beat', seconds_per_beat, COLOR_BORDER, 4, ITEM_WIDTH, COLOR_IDLE) @resolution_window = TextWithValueWindow.new('Resolution', resolution, COLOR_BORDER, 5, ITEM_WIDTH, COLOR_IDLE) @time_window = TextWindow.new(time_to_s, COLOR_ACTIVE, 3, WIDTH - TIME_WIDTH) end |
Instance Attribute Details
#beats_per_minute_window ⇒ Object (readonly)
Returns the value of attribute beats_per_minute_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def beats_per_minute_window @beats_per_minute_window end |
#input_window ⇒ Object (readonly)
Returns the value of attribute input_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def input_window @input_window end |
#output_window ⇒ Object (readonly)
Returns the value of attribute output_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def output_window @output_window end |
#resolution_window ⇒ Object (readonly)
Returns the value of attribute resolution_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def resolution_window @resolution_window end |
#seconds_per_beat_window ⇒ Object (readonly)
Returns the value of attribute seconds_per_beat_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def seconds_per_beat_window @seconds_per_beat_window end |
#time_signature_window ⇒ Object (readonly)
Returns the value of attribute time_signature_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def time_signature_window @time_signature_window end |
#time_window ⇒ Object (readonly)
Returns the value of attribute time_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def time_window @time_window end |
#title_window ⇒ Object (readonly)
Returns the value of attribute title_window.
125 126 127 |
# File 'lib/zgomot/ui/windows.rb', line 125 def title_window @title_window end |
Instance Method Details
#display ⇒ Object
146 147 148 149 150 151 152 153 154 155 |
# File 'lib/zgomot/ui/windows.rb', line 146 def display title_window.display time_window.display(time_to_s) input_window.display output_window.display time_signature_window.display beats_per_minute_window.display seconds_per_beat_window.display resolution_window.display end |
#time_to_s ⇒ Object
143 144 145 |
# File 'lib/zgomot/ui/windows.rb', line 143 def time_to_s "%#{TIME_WIDTH}s" % /(\d*:\d*)/.match(Zgomot::Midi::Dispatcher.clk).captures.first end |