summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoryenatch <yenatch@gmail.com>2013-12-28 19:53:32 -0500
committeryenatch <yenatch@gmail.com>2013-12-28 19:53:32 -0500
commit82389c999856e58b443c025228ecddd24dc6e4ab (patch)
treecbb50032e57c506a7ffa6e946e03ce3c83ca76c0
parent981e0c634f6da555fb74e5e2c948c13a820ec6ef (diff)
audio: note duration from 0-15 to 1-16 to match pokered
-rw-r--r--pokemontools/audio.py12
1 files changed, 11 insertions, 1 deletions
diff --git a/pokemontools/audio.py b/pokemontools/audio.py
index 699bebf..898c646 100644
--- a/pokemontools/audio.py
+++ b/pokemontools/audio.py
@@ -96,13 +96,23 @@ class PitchParam(HiNybbleParam):
pitch += '_'
return pitch
+class NoteDurationParam(LoNybbleParam):
+ def to_asm(self):
+ self.nybble += 1
+ return LoNybbleParam.to_asm(self)
+
+ @staticmethod
+ def from_asm(value):
+ value = str(int(value) - 1)
+ return LoNybbleParam.from_asm(value)
+
class Note(Command):
macro_name = "note"
size = 0
end = False
param_types = {
0: {"name": "pitch", "class": PitchParam},
- 1: {"name": "duration", "class": LoNybbleParam},
+ 1: {"name": "duration", "class": NoteDurationParam},
}
allowed_lengths = [2]
override_byte_check = True