mirror of
https://github.com/freedoom/freedoom.git
synced 2025-09-01 13:25:46 -04:00
genmidi: Add tune=
for setting fine tune field.
The fine tuning field was previously being hard-coded to the value of 128 with no option to change it. DMXGUS in particular makes use of this field to tune individual instruments, so let's add proper support for it.
This commit is contained in:
parent
f1c7a44af0
commit
276118107b
2 changed files with 5 additions and 3 deletions
|
@ -78,7 +78,7 @@ def encode_instrument(instrument):
|
|||
else:
|
||||
fixed_note = 0
|
||||
|
||||
header = struct.pack("<hBB", flags, 128, fixed_note)
|
||||
header = struct.pack("<hBB", flags, 128 + instrument.tune, fixed_note)
|
||||
|
||||
return header + instr1_data + instr2_data
|
||||
|
||||
|
@ -149,7 +149,8 @@ def decode_instrument(data, name):
|
|||
fixed_note = None
|
||||
|
||||
return Instrument(
|
||||
voice1, voice2, off1=offset1, off2=offset2, note=fixed_note
|
||||
voice1, voice2, off1=offset1, off2=offset2, note=fixed_note,
|
||||
tune=finetune - 128
|
||||
)
|
||||
|
||||
|
||||
|
|
|
@ -56,7 +56,7 @@ def load_instrument(filename):
|
|||
|
||||
|
||||
class Instrument:
|
||||
def __init__(self, file1, file2=None, off1=0, off2=0, note=None):
|
||||
def __init__(self, file1, file2=None, off1=0, off2=0, note=None, tune=0):
|
||||
self.voice1 = load_instrument(file1)
|
||||
|
||||
if file2 is not None:
|
||||
|
@ -67,6 +67,7 @@ class Instrument:
|
|||
self.fixed_note = note
|
||||
self.offset1 = off1
|
||||
self.offset2 = off2
|
||||
self.tune = tune
|
||||
|
||||
|
||||
NullInstrument = Instrument("dummy.sbi")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue