Class: ATEM::Switcher::Input

Inherits:
Object
  • Object
show all
Defined in:
lib/atem/switcher/input.rb,
lib/atem/switcher/input/audio.rb

Defined Under Namespace

Modules: Type Classes: Audio

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(switcher) ⇒ Input

Returns a new instance of Input.



27
28
29
30
31
# File 'lib/atem/switcher/input.rb', line 27

def initialize switcher

	@switcher = switcher

end

Instance Attribute Details

#audioObject

Returns the value of attribute audio.



8
9
10
# File 'lib/atem/switcher/input.rb', line 8

def audio
  @audio
end

#idObject (readonly)

Returns the value of attribute id.



7
8
9
# File 'lib/atem/switcher/input.rb', line 7

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/atem/switcher/input.rb', line 7

def name
  @name
end

#quick_initObject (readonly)

Returns the value of attribute quick_init.



7
8
9
# File 'lib/atem/switcher/input.rb', line 7

def quick_init
  @quick_init
end

#short_nameObject (readonly)

Returns the value of attribute short_name.



7
8
9
# File 'lib/atem/switcher/input.rb', line 7

def short_name
  @short_name
end

#switcherObject (readonly)

Returns the value of attribute switcher.



7
8
9
# File 'lib/atem/switcher/input.rb', line 7

def switcher
  @switcher
end

#typeObject

Returns the value of attribute type.



8
9
10
# File 'lib/atem/switcher/input.rb', line 8

def type
  @type
end

Class Method Details

.from(packet, switcher, type) ⇒ Object



16
17
18
19
20
21
22
23
24
25
# File 'lib/atem/switcher/input.rb', line 16

def self.from packet, switcher, type

	input = self.new switcher
	input.init_from packet

	input.type = type

	input

end

Instance Method Details

#init(id, name = nil, short_name = nil) ⇒ Object



40
41
42
43
44
45
46
47
# File 'lib/atem/switcher/input.rb', line 40

def init id, name = nil, short_name = nil

	@id = id
	@name = name or "Input #{@id}"
	@short_name = short_name or "#{@id.to_s.rjust(4, "0")}"
	@quick_init = true

end

#init_from(packet) ⇒ Object



33
34
35
36
37
38
# File 'lib/atem/switcher/input.rb', line 33

def init_from packet 

	@id, @name, @short_name, @supported, @ext_port_type, @port_type, @availability = 
		packet.unpack("S>Z20Z4xCxCCxC")

end

#previewObject



51
52
53
# File 'lib/atem/switcher/input.rb', line 51

def preview
	@switcher.preview @id
end

#programObject



55
56
57
# File 'lib/atem/switcher/input.rb', line 55

def program
	@switcher.program @id
end