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(pointer, 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(pointer, client) ⇒ Port
Returns a new instance of Port.
31 32 33 |
# File 'lib/jack/port.rb', line 31 def initialize(pointer, client) @pointer, @client = pointer, client 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
69 70 71 |
# File 'lib/jack/port.rb', line 69 def can_monitor? flags & FLAGS_CAN_MONITOR != 0 end |
#connect(destination) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/jack/port.rb', line 43 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
50 51 52 53 54 55 |
# File 'lib/jack/port.rb', line 50 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
39 40 41 |
# File 'lib/jack/port.rb', line 39 def flags jack_port_flags @pointer end |
#inspect ⇒ Object
81 82 83 |
# File 'lib/jack/port.rb', line 81 def inspect "#<#{self.class} name=#{name}>" end |
#is_input? ⇒ Boolean
57 58 59 |
# File 'lib/jack/port.rb', line 57 def is_input? flags & FLAGS_IS_INPUT != 0 end |
#is_output? ⇒ Boolean
61 62 63 |
# File 'lib/jack/port.rb', line 61 def is_output? flags & FLAGS_IS_OUTPUT != 0 end |
#is_physical? ⇒ Boolean
65 66 67 |
# File 'lib/jack/port.rb', line 65 def is_physical? flags & FLAGS_IS_PHYSICAL != 0 end |
#is_terminal? ⇒ Boolean
73 74 75 |
# File 'lib/jack/port.rb', line 73 def is_terminal? flags & FLAGS_IS_TERMINAL != 0 end |
#name ⇒ Object
35 36 37 |
# File 'lib/jack/port.rb', line 35 def name jack_port_name @pointer end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/jack/port.rb', line 77 def to_s name end |