import javax.sound.midi.*;
import java.io.IOException;
import java.io.InputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
public class Audio{
public void run() {
try {
Sequencer sequencer = MidiSystem.getSequencer();
if (sequencer == null)
throw new MidiUnavailableException();
sequencer.open();
FileInputStream is = new FileInputStream("D:/Documents/NetBeansProjects/Labyrinthian/requiemforadreamthemesong.mid");
Sequence Seq = MidiSystem.getSequence(is);
sequencer.setSequence(Seq);
sequencer.start();
} catch (Exception e) {
e.printStackTrace();
}
}
}
1 Replies - 548 Views - Last Post: 30 March 2012 - 05:29 AM
#1
[Java]Help w/ Text-Based Game(looping a midi file and items class atm)
Posted 29 March 2012 - 09:16 PM
Hey everyone, I am creating a text-based adventure game similar to Zork for a project in my highschool pre-AP computer science class. I am having trouble getting my midi file to loop. How would you guys suggest to loop this? I will post my code below for the audio class. Also how would you suggest to create an Items class for items such as a sword, torch, keys, lock picks, etc. I was thinking about using a multidimentional array but i'm not very familiar with these and i don't really know how to go about doing it. Thanks.
Replies To: [Java]Help w/ Text-Based Game(looping a midi file and items class atm)
#2
Re: [Java]Help w/ Text-Based Game(looping a midi file and items class atm)
Posted 30 March 2012 - 05:29 AM
[UPDATE]
I have gotten the midi file to loop but i still need your ideas on what i should do to create the Items class.
I have gotten the midi file to loop but i still need your ideas on what i should do to create the Items class.
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote



|