libmid: implement all system messages + cleanup
libanalyze: update to new API