I am revisiting the Head First "boom box" and am stuck in two places:
First, the very first example program, which turns a note on and then off, never stops - I have to use Cntl-C in the command window. I tried using System.exit(0) (this suggestion was also made by
Daniel Gagnon), but then I never hear the note at all (the program does stop, though!)
Second, I am one of several who would like to know what instruments I have available. I have tried using the getAvailableInstruments method of the Synthesizer class by reading Sun's API and got 0 instruments; so I tried searching the ranch. I found 2 hunks of code, one posted by
Kathy Sierra and one posted by
Timothy Stone (both a long time ago). Both of these programs also tell me that I have 0 instruments.
If I try the getDefaultSoundbank method of class Synthesizer, it returns null.
However, if I just play the program in the Head First book, I get the promised piano note. So there's obviously something somewhere! I just wish I could find it/them ...
I am very confused! Could anyone cast any light on this?
PS - I also tried the getLoadedInstruments method. Same results.
[ January 13, 2008: Message edited by: Jinny Morris ]
[ January 13, 2008: Message edited by: Jinny Morris ]
[ January 13, 2008: Message edited by: Jinny Morris ]
[ January 13, 2008: Message edited by: Jinny Morris ]