Hi Chris,

> Here is a patch for libsigrokdecode.  The patch file for sigrok-test
> is a file attachment since the contents are long but yet less
> interesting to most readers.

Quick comment from my point of view: it is helpful to have more
than one annotation: if there's a short (abbreviated) and a long
(verbose) version, I would honestly love to see both submitted by
the PD. That way, the libsigrok client can choose which one to show.

In the case of PV, it will choose the longest one that fits in the
annotation bubble while the text shown when hovering the cursor
over the annotation will always show the longest version. That's
why, despite understanding that this doesn't currently fit your
code, I would prefer if you did it this way instead of simply
removing the verbose versions.

Thanks for your contributions so far!
  -Soeren


> 
> Description:
> Shorted the displayed decode text; remove redundant words and used
> common abbreviations.
> 
> ---
>  decoders/midi/lists.py | 36 ++++++++++++++++++------------------
>  decoders/midi/pd.py    | 22 +++++++++++-----------
>  2 files changed, 29 insertions(+), 29 deletions(-)
> 
> diff --git a/decoders/midi/lists.py b/decoders/midi/lists.py
> index dc728a9..1c7cd6d 100644
> --- a/decoders/midi/lists.py
> +++ b/decoders/midi/lists.py
> @@ -22,17 +22,17 @@ status_bytes = {
>      # Channel voice messages
>      0x80: 'note off',
>      0x90: 'note on', # However, velocity = 0 means "note off".
> -    0xa0: 'polyphonic key pressure / aftertouch',
> +    0xa0: 'polyphonic key pressure',
>      0xb0: 'control change',
>      0xc0: 'program change',
> -    0xd0: 'channel pressure / aftertouch',
> +    0xd0: 'channel pressure',
>      0xe0: 'pitch bend change',
>  
>      # Channel mode messages
>      # 0xb0: 'select channel mode', # Note: Same as 'control change'.
>  
>      # System exclusive messages
> -    0xf0: 'system exclusive (SysEx)',
> +    0xf0: 'SysEx',
>  
>      # System common messages
>      0xf1: 'MIDI time code quarter frame',
> @@ -41,7 +41,7 @@ status_bytes = {
>      0xf4: 'undefined 0xf4',
>      0xf5: 'undefined 0xf5',
>      0xf6: 'tune request',
> -    0xf7: 'end of system exclusive (EOX)',
> +    0xf7: 'end of SysEx (EOX)',
>  
>      # System real time messages
>      0xf8: 'timing clock',
> @@ -478,10 +478,10 @@ control_functions = {
>      0x5f: 'effects 5 depth (formerly phaser depth)',
>      0x60: 'data increment',
>      0x61: 'data decrement',
> -    0x62: 'Non-Registered Parameter Number LSB',
> -    0x63: 'Non-Registered Parameter Number MSB',
> -    0x64: 'Registered Parameter Number LSB',
> -    0x65: 'Registered Parameter Number MSB',
> +    0x62: 'NRPN LSB',
> +    0x63: 'NRPN MSB',
> +    0x64: 'RPN LSB',
> +    0x65: 'RPN MSB',
>      # 0x66-0x77: undefined
>      # 0x78-0x7f: reserved for channel mode messages
>      0x78: 'all sound off',
> @@ -641,19 +641,19 @@ drum_kit = {
>  quarter_frame_type = {
>      0: 'frame count LS nibble',
>      1: 'frame count MS nibble',
> -    2: 'seconds count LS nibble',
> -    3: 'seconds count MS nibble',
> -    4: 'minutes count LS nibble',
> -    5: 'minutes count MS nibble',
> -    6: 'hours count LS nibble',
> -    7: 'hours count MS nibble and SMPTE type',
> +    2: 'seconds LS nibble',
> +    3: 'seconds MS nibble',
> +    4: 'minutes LS nibble',
> +    5: 'minutes MS nibble',
> +    6: 'hours LS nibble',
> +    7: 'hours MS nibble and SMPTE type',
>  }
>  
>  smpte_type = {
> -    0: '24 frames/second',
> -    1: '25 frames/second',
> -    2: '30 frames/second (drop-frame)',
> -    3: '30 frames/second (non-drop)',
> +    0: '24 FPS',
> +    1: '25 FPS',
> +    2: '30 FPS (drop-frame)',
> +    3: '30 FPS (non-drop)',
>  }
>  
>  chromatic_notes = {
> diff --git a/decoders/midi/pd.py b/decoders/midi/pd.py
> index ccbca34..353d0d3 100644
> --- a/decoders/midi/pd.py
> +++ b/decoders/midi/pd.py
> @@ -66,7 +66,7 @@ class Decoder(srd.Decoder):
>          self.es_block = self.es
>          msg, chan, note, velocity = c[0] & 0xf0, (c[0] & 0x0f) + 1, 
> c[1], c[2]
>          note_name = self.get_note_name(chan, note)
> -        self.putx([0, ['Channel %d: %s (note = %d \'%s\', velocity = 
> %d)' % \
> +        self.putx([0, ['ch %d: %s (note = %d \'%s\', velocity = %d)' % 
> \
>                    (chan, status_bytes[msg], note, note_name, 
> velocity)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -81,7 +81,7 @@ class Decoder(srd.Decoder):
>          msg, chan, note, velocity = c[0] & 0xf0, (c[0] & 0x0f) + 1, 
> c[1], c[2]
>          s = 'note off' if (velocity == 0) else status_bytes[msg]
>          note_name = self.get_note_name(chan, note)
> -        self.putx([0, ['Channel %d: %s (note = %d \'%s\', velocity = 
> %d)' % \
> +        self.putx([0, ['ch %d: %s (note = %d \'%s\', velocity = %d)' % 
> \
>                    (chan, s, note, note_name, velocity)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -94,7 +94,7 @@ class Decoder(srd.Decoder):
>          self.es_block = self.es
>          msg, chan, note, pressure = c[0] & 0xf0, (c[0] & 0x0f) + 1, 
> c[1], c[2]
>          note_name = self.get_note_name(chan, note)
> -        self.putx([0, ['Channel %d: %s (note = %d \'%s\', pressure = 
> %d)' % \
> +        self.putx([0, ['ch %d: %s (note = %d \'%s\', pressure = %d)' % 
> \
>                    (chan, status_bytes[msg], note, note_name, 
> pressure)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -103,7 +103,7 @@ class Decoder(srd.Decoder):
>          # n = channel, vv = value (<= 0x3f: normal,> 0x3f: legato)
>          chan, vv = (self.cmd[0] & 0x0f) + 1, self.cmd[2]
>          t = 'normal' if vv <= 0x3f else 'legato'
> -        self.putx([0, ['Channel %d: control function \'%s\' = %s' % \
> +        self.putx([0, ['ch %d: control change \'%s\' = %s' % \
>                    (chan, control_functions[0x44], t)]])
>  
>      def handle_controller_0x54(self):
> @@ -111,7 +111,7 @@ class Decoder(srd.Decoder):
>          # n = channel, kk = source note for pitch reference
>          chan, kk = (self.cmd[0] & 0x0f) + 1, self.cmd[2]
>          kk_name = self.get_note_name(chan, kk)
> -        self.putx([0, ['Channel %d: control function \'%s\' (source 
> note ' \
> +        self.putx([0, ['ch %d: control change \'%s\' (source note ' \
>                    '= %d / %s)' % \
>                    (chan, control_functions[0x54], kk, kk_name)]])
>  
> @@ -122,7 +122,7 @@ class Decoder(srd.Decoder):
>          ctrl_fn = control_functions.get(fn, default_name)
>          if ctrl_fn == default_name:
>              ctrl_fn = '%s 0x%02x' % (default_name, fn)
> -        self.putx([0, ['Channel %d: control change to function \'%s\' 
> ' \
> +        self.putx([0, ['ch %d: control change \'%s\' ' \
>                    '(param = 0x%02x)' % (chan, ctrl_fn, param)]])
>  
>      def handle_channel_mode(self):
> @@ -147,7 +147,7 @@ class Decoder(srd.Decoder):
>                  vv_string = '(channels \'basic\' through 16)'
>          elif vv != 0: # All other channel mode messages expect vv == 
> 0.
>              vv_string = '(non-standard param value of 0x%02x)' % vv
> -        self.putx([0, ['Channel %d: mode message \'%s\' %s' % \
> +        self.putx([0, ['ch %d: mode \'%s\' %s' % \
>              (chan, mode_fn, vv_string)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -182,7 +182,7 @@ class Decoder(srd.Decoder):
>          else:
>              change_type = 'drum kit'
>              name = drum_kit.get(pp, 'undefined')
> -        self.putx([0, ['Channel %d: %s to %s %d (assuming %s)' % \
> +        self.putx([0, ['ch %d: %s to %s %d (assuming %s)' % \
>              (chan, status_bytes[msg], change_type, pp, name)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -194,7 +194,7 @@ class Decoder(srd.Decoder):
>              return
>          self.es_block = self.es
>          msg, chan, vv = self.cmd[0] & 0xf0, (self.cmd[0] & 0x0f) + 1,
> self.cmd[1]
> -        self.putx([0, ['Channel %d: %s %d' % (chan, status_bytes[msg], 
> vv)]])
> +        self.putx([0, ['ch %d: %s %d' % (chan, status_bytes[msg], 
> vv)]])
>          self.cmd, self.state = [], 'IDLE'
>  
>      def handle_channel_msg_0xe0(self):
> @@ -207,7 +207,7 @@ class Decoder(srd.Decoder):
>          msg, chan, ll, mm = self.cmd[0] & 0xf0, (self.cmd[0] & 0x0f) + 
> 1, \
>                              self.cmd[1], self.cmd[2]
>          decimal = (mm << 7) + ll
> -        self.putx([0, ['Channel %d: %s 0x%02x 0x%02x (%d)' % \
> +        self.putx([0, ['ch %d: %s 0x%02x 0x%02x (%d)' % \
>              (chan, status_bytes[msg], ll, mm, decimal)]])
>          self.cmd, self.state = [], 'IDLE'
>  
> @@ -333,7 +333,7 @@ class Decoder(srd.Decoder):
>      def handle_sysrealtime_msg(self, newbyte):
>          # System realtime message: 0b11111ttt (t = message type)
>          self.es_block = self.es
> -        self.putx([0, ['System realtime message: %s' % 
> status_bytes[newbyte]]])
> +        self.putx([0, ['System realtime: %s' % 
> status_bytes[newbyte]]])
>          self.cmd, self.state = [], 'IDLE'
>  
>      def decode(self, ss, es, data):
> ------------------------------------------------------------------------------
> 
> _______________________________________________
> sigrok-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/sigrok-devel

------------------------------------------------------------------------------
_______________________________________________
sigrok-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sigrok-devel

Reply via email to