4242
4343"""
4444
45- from .midi_message import MIDIMessage , ALL_CHANNELS
45+ from .midi_message import MIDIMessage
4646
4747__version__ = "0.0.0-auto.0"
4848__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_MIDI.git"
@@ -58,8 +58,8 @@ class MIDI:
5858 :param in_channel: The input channel(s).
5959 This is used by ``receive`` to filter data.
6060 This can either be an ``int`` for the wire protocol channel number (0-15)
61- a tuple of ``int`` to listen for multiple channels or ``"ALL"`` .
62- Defaults to None .
61+ a tuple of ``int`` to listen for multiple channels.
62+ Defaults to all channels .
6363 :param int out_channel: The wire protocol output channel number (0-15)
6464 used by ``send`` if no channel is specified,
6565 defaults to 0 (MIDI Channel 1).
@@ -82,9 +82,9 @@ def __init__(
8282 raise ValueError ("No midi_in or midi_out provided" )
8383 self ._midi_in = midi_in
8484 self ._midi_out = midi_out
85- self ._in_channel = in_channel # dealing with pylint inadequacy
85+ self ._in_channel = in_channel
8686 self .in_channel = in_channel
87- self ._out_channel = out_channel # dealing with pylint inadequacy
87+ self ._out_channel = out_channel
8888 self .out_channel = out_channel
8989 self ._debug = debug
9090 # This input buffer holds what has been read from midi_in
@@ -98,16 +98,16 @@ def in_channel(self):
9898 """The incoming MIDI channel. Must be 0-15. Correlates to MIDI channels 1-16, e.g.
9999 ``in_channel = 3`` will listen on MIDI channel 4.
100100 Can also listen on multiple channels, e.g. ``in_channel = (0,1,2)``
101- will listen on MIDI channels 1-3 or ``in_channel = "ALL"`` for every channel .
102- Default is None ."""
101+ will listen on MIDI channels 1-3.
102+ Default is all channels ."""
103103 return self ._in_channel
104104
105105 @in_channel .setter
106106 def in_channel (self , channel ):
107- if channel is None or (isinstance (channel , int ) and 0 <= channel <= 15 ):
107+ if channel is None or channel == "ALL" :
108+ self ._in_channel = tuple (range (16 ))
109+ elif isinstance (channel , int ) and 0 <= channel <= 15 :
108110 self ._in_channel = channel
109- elif isinstance (channel , str ) and channel == "ALL" :
110- self ._in_channel = ALL_CHANNELS
111111 elif isinstance (channel , tuple ) and all (0 <= c <= 15 for c in channel ):
112112 self ._in_channel = channel
113113 else :
0 commit comments