cornedriesprong / mingus

Automatically exported from code.google.com/p/mingus
GNU General Public License v3.0
0 stars 0 forks source link

General purpose midi sequencer #27

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A general purpose midi sequencer in the midi package, so that we can have
one to interface with fluidsynth, one to route midi messages, etc. Can
probably easily be extracted from midi.fluidsynth. 

Also think about and look into integrating some kind of observer pattern,
so that you can add listeners instead of subclassing. The notify method
could become pretty complex anyway so it might be redundant. 

Original issue reported on code.google.com by Rhijnauwen@gmail.com on 19 Jan 2009 at 2:05

GoogleCodeExporter commented 9 years ago

Original comment by Rhijnauwen@gmail.com on 19 Jan 2009 at 5:18

GoogleCodeExporter commented 9 years ago
Module Sequencer was added to mingus.midi and can be extended by subclassing and
implementing the events. An observer pattern was also implemented to allow 
objects to
receive events dynamically and separately.

Question is then: when to subclass and when to use an observer? 

In principal you can use an instance of Sequencer and attach all your observers 
with
some slight overhead. However you can't send commands to observers, only to the
Sequencer itself. A fluidsynth observer is thus not the best way to go, since 
you
would need to keep track of the Sequencer instance, which adds a lot of 
boilerplate
for simply playing some notes (although this is hidden in the API - it sucks 
for the
implementers):

seq = Sequencer()
fluid = FluidSynthObserver()
seq.attach(fluid)
seq.play_Bar(bar)

The mingus.midi should just subclass; the observers should only be used when 
you have
more than one object that needs to know about the event.

fluid = FluidSynth()
fluid.play_Bar(bar)

Original comment by Rhijnauwen@gmail.com on 23 Jun 2009 at 3:59