Instead of reimplementing everything from scratch you may want to look at Craig Sapps excellent MIDI and Audio I/O class library at www-ccrma.stanford.edu/~craig. Yes,