Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Sound in sun.audio.*;

Reply
Thread Tools

Sound in sun.audio.*;

 
 
Pak_indo
Guest
Posts: n/a
 
      10-10-2004
Hi folks,

ok, I have 5 or so files which need to be played one after another, pretty
much immediately after another such that it sounds like theyre kinda linked
so to speak(I cant make one big file as the order they come in differs on
runtime)
What i would like to know is, is this possible with this package? The
current code I am using to play is
try{
InputStream in = new FileInputStream(fileName);
// Create an AudioStream object from the input stream.
AudioStream as = new AudioStream(in);
// Use the static class member "player" from class AudioPlayer to play
// clip.
AudioPlayer.player.start(as);
// Similarly, to stop the audio.
//AudioPlayer.player.stop(as);
}
catch(Exception e){System.out.println(e);}

and would like to know how I can manipulate this to play them one after
another, ie is there a specific method which would help me etc.

Thanks for any time which anyone could give me

cheers

pak


 
Reply With Quote
 
 
 
 
Knute Johnson
Guest
Posts: n/a
 
      10-10-2004
Pak_indo wrote:
> Hi folks,
>
> ok, I have 5 or so files which need to be played one after another, pretty
> much immediately after another such that it sounds like theyre kinda linked
> so to speak(I cant make one big file as the order they come in differs on
> runtime)
> What i would like to know is, is this possible with this package? The
> current code I am using to play is
> try{
> InputStream in = new FileInputStream(fileName);
> // Create an AudioStream object from the input stream.
> AudioStream as = new AudioStream(in);
> // Use the static class member "player" from class AudioPlayer to play
> // clip.
> AudioPlayer.player.start(as);
> // Similarly, to stop the audio.
> //AudioPlayer.player.stop(as);
> }
> catch(Exception e){System.out.println(e);}
>
> and would like to know how I can manipulate this to play them one after
> another, ie is there a specific method which would help me etc.
>
> Thanks for any time which anyone could give me
>
> cheers
>
> pak
>
>


You can use JavaSound to play your files. I would use a LineListener to
check for the end of the audio stream and then open the next stream. If
the files are not too long you could also use the Clip interface to load
the entire file and play them in any order.

--

Knute Johnson
email s/nospam/knute/
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Mobo On-Board Sound + PCI Sound Card? John E Computer Support 24 10-01-2007 05:53 AM
Playing sound through non default sound card dkga_dkga@yahoo.com Java 0 03-05-2006 04:38 AM
Sound Quality In Sound API Luc The Perverse Java 4 10-31-2005 04:36 AM
No sound. Yellow exclamation by" Windows sound system". =?Utf-8?B?VGFueWE=?= MCSE 2 10-26-2003 07:44 PM
Geforce 4 MX 440 Sound Prob (thats right, sound) Matthew Morrison Computer Support 2 07-29-2003 01:23 AM



Advertisments