Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java sound using midi

 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to use the code from the head first java 2nd edition book, page 342, and i am using eclipse ide with jre 1.6.0
it's giving me syntax errors when I declare
Sequencer player = MidiSystem.getSequencer();
and it tells me "The import javax.sound.midi is never used"
how can I get this to work? this is very frustrating and I cannot find anything about this through google or searching the forums. I have been looking at both for a half hour now... Thanks for the help
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's complaining about an import statement. I'm sure that's just a warning. Maybe you have:

import javax.sound.midi;

when you meant

import javax.sound.midi.*;
 
Eric Daly
Ranch Hand
Posts: 143
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
actually, I have typed in "import javax.sound.midi.*;"
now for some reason I don't have that warning (yes, it was just a warning) BUT I still have the error for syntax on the line that asks for a new sequencer.
i typed
Sequencer player = new MidiSystem.getSequencer();
and the error says "MidiSystem.getSequencer cannot be resolved to a type"
what should I do next?

EDIT: I figured out what I did wrong. I typed in "new" before MidiSystem.getSequencer(); which I didn't need because the method I'm calling is giving me a new object anyway, so it calls new, not me. thanks for the help.
[ January 16, 2007: Message edited by: Eric Daly ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic