
A 28/01/2013, às 19:36, Martin Drautzburg escreveu:
Hello all,
I know how to play a Midi file. I also know how to read the keyboard. But I don't know how to bring the two together such that I can start and stop playing from the keyboard.
It is not required (just nice to have) that the console remains responsive while the midi file plays. But it is essential that I can stop the performance.
Is this difficult?
I’m also a beginner, so take this with a grain of salt: I suppose the midi playing command doesn’t block until finished playing otherwise you couldn’t stop midway. If that is the case you can do something like main = forever readFromConsole readFromConsole = do in <- getLine processInput in processInput “start” = startMidi processInput “stop” = stopMidi where startMidi and stopMidi are functions. best, Miguel