Bug in library, bad tick from Read()

Bug #1746078 reported by Petr Mach
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-pypm (Ubuntu)
New
Undecided
Unassigned

Bug Description

This code:
    while True:
        while not midi_input.Poll():
            sleep(0.01)
        md = midi_input.Read(1)
        print md

Return data as:

[[[128, 67, 64, 0], 0]]
[[[144, 69, 53, 0], 1]]
[[[128, 65, 64, 0], 0]]
[[[144, 67, 59, 0], 1]]
[[[128, 69, 64, 0], 0]]
[[[144, 65, 63, 0], 0]]
[[[128, 67, 64, 0], 1]]
[[[128, 65, 64, 0], 1]]
[[[144, 69, 57, 0], 1]]
[[[144, 67, 66, 0], 0]]
[[[128, 69, 64, 0], 1]]
[[[144, 65, 66, 0], 1]]
[[[128, 65, 64, 0], 1]]
[[[128, 67, 64, 0], 1]]

Last number is midi tick and is bad. I must be increased and it must be much bigger.
Some time ago it worked.

I have updated Ubuntu 16.04.
python-pypm is version 0.0.7-8
libportmidi0 is version 1:200-0ubuntu3

Whole testing code:

import sys
from time import sleep

import pypm as m
m.Initialize()

def getMidiInput(devName):
    for i in xrange(m.CountDevices()):
        iFace, name, inp, outp, opened = m.GetDeviceInfo(i)
        if inp:
            if devName in name:
                return m.Input(i)
            else:
                print 'Skiped device:', name
    return False

def monitor(midi_input):
    cntEv = 0

    while True:
        cntEv += 1
        while not midi_input.Poll():
            sleep(0.01)
        md = midi_input.Read(4) # 1 massage only
        print md

if __name__ == '__main__':
    devName = 'Pa600'
    if len(sys.argv) > 1:
        devName = sys.argv[1]
    midiIn = getMidiInput(devName)
    if midiIn:
        print 'Device', devName, 'connected.'
        monitor(midiIn)
    else:
        print 'Device', devName, 'not exist.'

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.