diff --git a/src/jack.py b/src/jack.py index 52e86b4..74d2d2e 100644 --- a/src/jack.py +++ b/src/jack.py @@ -1793,7 +1793,7 @@ def _wrap_port_ptr(self, ptr): elif porttype == _MIDI: cls = OwnMidiPort if self.owns(ptr) else MidiPort else: - assert False + cls = UnknownPort return cls(ptr, self) @@ -1896,6 +1896,11 @@ def unset_alias(self, alias): _check(_lib.jack_port_unset_alias(self._ptr, alias.encode()), 'Error unsetting port alias') + @property + def type(self): + """Name of the JACK port type (read-only).""" + return _decode(_lib.jack_port_type(self._ptr)) + @property def uuid(self): """The UUID of the JACK port.""" @@ -1972,6 +1977,17 @@ class MidiPort(Port): is_midi = property(lambda self: True, doc='This is always ``True``.') +class UnknownPort(Port): + """A JACK port with an unknown type + + This class is derived from `Port` and has exactly the same + attributes and methods. + """ + + is_audio = property(lambda self: False, doc='This is always ``False``.') + is_midi = property(lambda self: False, doc='This is always ``False``.') + + class OwnPort(Port): """A JACK audio port owned by a `Client`.