From 67d80e5980116df21b04a3a185725b630b7f8559 Mon Sep 17 00:00:00 2001 From: Maximilien Rigaut Date: Wed, 1 May 2019 16:30:36 +0200 Subject: [PATCH] Added the test module and refined the code --- .gitmodules | 3 +++ mapping/GrandMA2.py | 13 ++++++++----- mapping/mapping.py | 21 +++++++++++++++++++++ minitest | 1 + 4 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 .gitmodules create mode 100644 mapping/mapping.py create mode 160000 minitest diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..a542854 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "minitest"] + path = minitest + url = https://github.com/Malphaet/minitest.git diff --git a/mapping/GrandMA2.py b/mapping/GrandMA2.py index 4769eb1..9296343 100644 --- a/mapping/GrandMA2.py +++ b/mapping/GrandMA2.py @@ -1,17 +1,20 @@ class BasicMessageParse(object): - """Classic System Specific Midi Message as Hex (BasicSyHexParse).""" + """Classic System Specific Midi Message as Hex (BasicSyHexParse). + Uses one method, parseMidi to parse the message and return a BasicMapping object with the mapping of the message inside""" def __init__(self): '''Basic init''' - self.type=None #Witch type of message it is, witch to choose from + self.mapping={"value":None,"type":None} # A barebone initialisation, unusable, it will need to be overridden to work self.value=None self. def parseMidi(self,message): - """Take a midi SyxEx message and return a BasicParse""" + """Take a midi SyxEx message and return a BasicMapping""" pass -class BasicParser(object): - """A message with accesible properties and a reading manual""" +class BasicMapping(object): + """A basic reading of the message, propreties are initialised depending on the way the SyEx message is formed, + this objet will need the configuration to read and understand the message + """ def __init__(self): pass diff --git a/mapping/mapping.py b/mapping/mapping.py new file mode 100644 index 0000000..1fa4606 --- /dev/null +++ b/mapping/mapping.py @@ -0,0 +1,21 @@ +class BasicMessageParse(object): + """Classic System Specific Midi Message as Hex (BasicSyHexParse). + Uses one method, parseMidi to parse the message and return a BasicMapping object with the mapping of the message inside""" + + def __init__(self): + '''Basic init''' + self._mapping={"value":None,"type":None} # A barebone initialisation, unusable, it will need to be overridden to work + + def parseMidi(self,message): + """Take a midi SyxEx message and return a BasicMapping (there can be many children of BasicMapping to take more properly care of the cases)""" + return BasicMapping(self._mapping) + +class BasicMapping(object): + """A basic reading of the message, propreties are initialised depending on the way the SyEx message is formed, + this objet will need the configuration to read and understand the message + """ + def __init__(self,dictmapping): + 'Barebone init' + self._mapping=dictmapping + + def diff --git a/minitest b/minitest new file mode 160000 index 0000000..11a1157 --- /dev/null +++ b/minitest @@ -0,0 +1 @@ +Subproject commit 11a1157bd86f0166e43445ab137bb483ec85d71f