Make different channels optional based on program settings
This commit is contained in:
parent
7812a45ad3
commit
de6f0709f3
30
git-sound.py
30
git-sound.py
@ -86,10 +86,13 @@ class GitMIDI(MIDIFile):
|
|||||||
# TODO: Make this configurable
|
# TODO: Make this configurable
|
||||||
self.addTempo(0, 0, 120)
|
self.addTempo(0, 0, 120)
|
||||||
|
|
||||||
self.addProgramChange(0, self.LOG_CHANNEL,
|
if self.__need_commits:
|
||||||
0, self.__program['commit']['program'])
|
self.addProgramChange(0, self.LOG_CHANNEL,
|
||||||
self.addProgramChange(0, self.FILE_CHANNEL,
|
0, self.__program['commit']['program'])
|
||||||
0, self.__program['file']['program'])
|
|
||||||
|
if self.__need_files:
|
||||||
|
self.addProgramChange(0, self.FILE_CHANNEL,
|
||||||
|
0, self.__program['file']['program'])
|
||||||
|
|
||||||
def __setup_repo(self):
|
def __setup_repo(self):
|
||||||
if self.__verbose:
|
if self.__verbose:
|
||||||
@ -119,6 +122,9 @@ class GitMIDI(MIDIFile):
|
|||||||
self.__scale = scale
|
self.__scale = scale
|
||||||
self.__program = program
|
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_midi()
|
||||||
self.__setup_repo()
|
self.__setup_repo()
|
||||||
|
|
||||||
@ -235,14 +241,16 @@ class GitMIDI(MIDIFile):
|
|||||||
section_len = len(section['file_notes']) * duration
|
section_len = len(section['file_notes']) * duration
|
||||||
|
|
||||||
# Add a long note
|
# Add a long note
|
||||||
repo_midi.addNote(track, log_channel,
|
if self.__need_commits:
|
||||||
section['commit_note'], time,
|
repo_midi.addNote(track, log_channel,
|
||||||
section_len, section['commit_volume'])
|
section['commit_note'], time,
|
||||||
|
section_len, section['commit_volume'])
|
||||||
|
|
||||||
for i, file_note in enumerate(section['file_notes']):
|
if self.__need_files:
|
||||||
repo_midi.addNote(track, decor_channel,
|
for i, file_note in enumerate(section['file_notes']):
|
||||||
file_note['note'], time + i * duration,
|
repo_midi.addNote(track, decor_channel,
|
||||||
duration, file_note['volume'])
|
file_note['note'], time + i * duration,
|
||||||
|
duration, file_note['volume'])
|
||||||
|
|
||||||
time += section_len
|
time += section_len
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user