Phat Fat Music

Courtesy of Mr. Coder:


soundsystem.java
 public static int createStream(URL file){
 if(stream==null){
 stream=new MusicStream[1];
 stream[0]=new MusicStream(file);
 return 0;
 }else{
 MusicStream[] tmp=new MusicStream[stream.length];
 System.arraycopy(stream, 0, tmp, 0, tmp.length);
 stream=new MusicStream[tmp.length+1];
 System.arraycopy(tmp, 0, stream, 0, tmp.length);
 stream[tmp.length]=new MusicStream(file);
 return tmp.length;
 }
 }
musicstream.java
 public MusicStream(URL file){
 this.streamFile=file.getFile();
 sourceNumber=StreamPlayer.getInstance().openStream(file);
 }
streamplayer.java
 public int openStream(URL file){
 JMEAudioInputStream tmp = null;
 try {
 tmp = new OggInputStream(file.openStream());
 } catch(IOException e) {
 e.printStackTrace();
 }
 if(tmp==null) return -1;
 int streamNumber=add(tmp);
 if(equalizer !=null){
 filter=new BandpassFilter(equalizer.getFrequencies());
 filter.init(tmp.rate());
 equalizer.addFilter(streamNumber, filter);
 tmp.addFilter(filter);
 }
 return streamNumber;
 }



It would be great if this could be added into jME by someone.

Thanks!

darkfrog

nice readable code formatting froggy :smiley:

That's exactly how it appeared on my screen when you messaged it to me. :-p



I did remove the multiple "Mr. Coder says:" from it…give me some credit. :-p



darkfrog

the code doenst work without "Mr Coder says:" !!!



:lol:



ok, lets all blame it on icq then…

Can't do that, I already blame world hunger on AOL and they also own ICQ. :-p



I blame Microsoft for stupidity and the realisation of all those movies that look to the future and see that AI has taken over and everybody gets stupid, and then when the AI breaks they can't fend for themselves and everyone ends up near extinction when someone from our time just happens upon this unfortunate conclusion and saves everyone…  :-p



darkfrog

well said! (at least when reading it on drugs)

Wow, the drug scene surrounds a younger and younger culture every day (based on your picture of course).



:-p



darkfrog

but i was sober on that picture  8)

For those not subscribed to CVS updates, Arman checked this into CVS now.

Three Cheers for Arman!



darkfrog

great!



basic usage in this thread:

http://www.jmonkeyengine.com/jmeforum/index.php?topic=2774.0