/src/echonest/support/midi/MidiInStream.py

http://echo-nest-remix.googlecode.com/ · Python · 52 lines · 13 code · 15 blank · 24 comment · 2 complexity · 4aface9043a5f15241bdbe06ad7f1926 MD5 · raw file

  1. # -*- coding: ISO-8859-1 -*-
  2. from MidiOutStream import MidiOutStream
  3. class MidiInStream:
  4. """
  5. Takes midi events from the midi input and calls the apropriate
  6. method in the eventhandler object
  7. """
  8. def __init__(self, midiOutStream, device):
  9. """
  10. Sets a default output stream, and sets the device from where
  11. the input comes
  12. """
  13. if midiOutStream is None:
  14. self.midiOutStream = MidiOutStream()
  15. else:
  16. self.midiOutStream = midiOutStream
  17. def close(self):
  18. """
  19. Stop the MidiInstream
  20. """
  21. def read(self, time=0):
  22. """
  23. Start the MidiInstream.
  24. "time" sets timer to specific start value.
  25. """
  26. def resetTimer(self, time=0):
  27. """
  28. Resets the timer, probably a good idea if there is some kind
  29. of looping going on
  30. """