Class: JACK::Port
Constant Summary collapse
- FLAGS_IS_INPUT =
0x1
- FLAGS_IS_OUTPUT =
0x2
- FLAGS_IS_PHYSICAL =
0x4
- FLAGS_CAN_MONITOR =
0x8
- FLAGS_IS_TERMINAL =
0x10
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#pointer ⇒ Object
readonly
Returns the value of attribute pointer.
Instance Method Summary collapse
- #can_monitor? ⇒ Boolean
- #connect(destination) ⇒ Object
- #disconnect(destination) ⇒ Object
- #flags ⇒ Object
-
#initialize(identifier, client) ⇒ Port
constructor
A new instance of Port.
- #inspect ⇒ Object
- #is_input? ⇒ Boolean
- #is_output? ⇒ Boolean
- #is_physical? ⇒ Boolean
- #is_terminal? ⇒ Boolean
- #name ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(identifier, client) ⇒ Port
Returns a new instance of Port.
31 32 33 34 35 36 37 38 39 |
# File 'lib/jack/port.rb', line 31 def initialize(identifier, client) @client = client if identifier.is_a? String @pointer = @client.port_by_name(identifier).pointer else @pointer = identifier end end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
23 24 25 |
# File 'lib/jack/port.rb', line 23 def client @client end |
#pointer ⇒ Object (readonly)
Returns the value of attribute pointer.
23 24 25 |
# File 'lib/jack/port.rb', line 23 def pointer @pointer end |
Instance Method Details
#can_monitor? ⇒ Boolean
75 76 77 |
# File 'lib/jack/port.rb', line 75 def can_monitor? flags & FLAGS_CAN_MONITOR != 0 end |
#connect(destination) ⇒ Object
49 50 51 52 53 54 |
# File 'lib/jack/port.rb', line 49 def connect(destination) raise ArgumentError, "You must pass JACK::Port or String to JACK::Port.connect" if not destination.is_a? Port and not destination.is_a? String destination = client.port_by_name(destination) if destination.is_a? String client.connect self, destination end |
#disconnect(destination) ⇒ Object
56 57 58 59 60 61 |
# File 'lib/jack/port.rb', line 56 def disconnect(destination) raise ArgumentError, "You must pass JACK::Port or String to JACK::Port.disconnect" if not destination.is_a? Port and not destination.is_a? String destination = client.port_by_name(destination) if destination.is_a? String client.disconnect self, destination end |
#flags ⇒ Object
45 46 47 |
# File 'lib/jack/port.rb', line 45 def flags jack_port_flags @pointer end |
#inspect ⇒ Object
87 88 89 |
# File 'lib/jack/port.rb', line 87 def inspect "#<#{self.class} name=#{name}>" end |
#is_input? ⇒ Boolean
63 64 65 |
# File 'lib/jack/port.rb', line 63 def is_input? flags & FLAGS_IS_INPUT != 0 end |
#is_output? ⇒ Boolean
67 68 69 |
# File 'lib/jack/port.rb', line 67 def is_output? flags & FLAGS_IS_OUTPUT != 0 end |
#is_physical? ⇒ Boolean
71 72 73 |
# File 'lib/jack/port.rb', line 71 def is_physical? flags & FLAGS_IS_PHYSICAL != 0 end |
#is_terminal? ⇒ Boolean
79 80 81 |
# File 'lib/jack/port.rb', line 79 def is_terminal? flags & FLAGS_IS_TERMINAL != 0 end |
#name ⇒ Object
41 42 43 |
# File 'lib/jack/port.rb', line 41 def name jack_port_name @pointer end |
#to_s ⇒ Object
83 84 85 |
# File 'lib/jack/port.rb', line 83 def to_s name end |