Make different channels optional based on program settings

This commit is contained in:
Gergely Polonkai 2016-05-26 19:31:43 +02:00
parent 7812a45ad3
commit de6f0709f3

View File

@ -86,8 +86,11 @@ class GitMIDI(MIDIFile):
# TODO: Make this configurable
self.addTempo(0, 0, 120)
if self.__need_commits:
self.addProgramChange(0, self.LOG_CHANNEL,
0, self.__program['commit']['program'])
if self.__need_files:
self.addProgramChange(0, self.FILE_CHANNEL,
0, self.__program['file']['program'])
@ -119,6 +122,9 @@ class GitMIDI(MIDIFile):
self.__scale = scale
self.__program = program
self.__need_commits = self.__program['commit']['program'] is not None
self.__need_files = self.__program['file']['program'] is not None
self.__setup_midi()
self.__setup_repo()
@ -235,10 +241,12 @@ class GitMIDI(MIDIFile):
section_len = len(section['file_notes']) * duration
# Add a long note
if self.__need_commits:
repo_midi.addNote(track, log_channel,
section['commit_note'], time,
section_len, section['commit_volume'])
if self.__need_files:
for i, file_note in enumerate(section['file_notes']):
repo_midi.addNote(track, decor_channel,
file_note['note'], time + i * duration,