Permalink
Browse files

lyne: Send instruments to FS.

  • Loading branch information...
1 parent 51444fe commit 3b733c964d22c9bbb59f3e525da989e8b06c7229 @MostAwesomeDude committed May 15, 2012
Showing with 11 additions and 5 deletions.
  1. +11 −5 lye/lyne.py
View
@@ -116,15 +116,17 @@ def set_marks(self):
def set_instruments(self, instruments):
for i, instrument in enumerate(instruments):
if instrument == "drums":
- self._drum_channel = i
print "%d: Drums" % i
+ self._drum_channel = i
+ self.channels[i].append((INSTRUMENT, 0))
elif instrument in ("-", '"'):
print "%d: No change" % i
else:
instrument = find_instrument(instrument)
self._previous_instruments[i] = instrument
print "%d: Instrument %s" % (i, instrument)
- self.channels[i].append((INSTRUMENT, instrument))
+ self.channels[i].append((INSTRUMENT,
+ numbered_instruments[instrument]))
def set_pan(self, pans):
for i, pan in enumerate(pans):
@@ -214,7 +216,12 @@ def to_fs(self, sequencer):
for channel, l in enumerate(self.channels):
for t, data in l:
- if t is LYNE:
+ if t is INSTRUMENT:
+ event = FluidEvent()
+ event.dest = dest
+ event.pc(channel, data)
+ sequencer.send(event, ticks + time[channel])
+ elif t is LYNE:
for pitch, begin, duration in data.scheduled:
begin += time[channel]
event = FluidEvent()
@@ -240,8 +247,7 @@ def to_midi(self):
for channel, l in enumerate(self.channels):
for t, data in l:
if t is INSTRUMENT:
- f.addProgramChange(track, channel, time[channel],
- numbered_instruments[data])
+ f.addProgramChange(track, channel, time[channel], data)
elif t is LYNE:
for pitch, begin, duration in data.scheduled:
begin = begin / data.tpb + time[channel]

0 comments on commit 3b733c9

Please sign in to comment.