Play more than one auido files

Is it possible, in j2me, to play more than one auido files at the same time?
I want to play an audio file as my background music and player some other files as sound effect.

http://developer.sonyericsson.com/site/global/techsupport/tipstrickscode/java/p_using_simultaneous_sounds.jsp

Similar Messages

  • HT1459 After updating ITunes, it, ITunes started loosing my music files and stopped playing more than one song at a time.What now?

    After updating ITunes, it, ITunes started loosing my music files and stopped playing more than one song at a time also there would be duplicate songs in the same folders.What now?

    Sound like something messed up somehow. Maybe you can consider reinstalling the drivers again? @28.86.2.0

  • Play more than one sound

    I want to write a program that can play more tha one music file(wav).
    I have used threat and mixer(javax.sound.sample.*) but Ican't do this.
    Help me please !!!!!!
    And show me some code example about mixer if can
    Thank you very much !!!!!!!!

    Here is a simple solution for playing more than one sound at the time. It uses two classes where the first is a thread that plays a sound, and the second is a "container" that loads and stores your sounds.
    SoundThread.java
    import javax.sound.sampled.*;
    public class SoundThread extends Thread
        private Clip soundClip = null;
        private int soundIndex = 0;
        private int loopCount = 0;
        private boolean donePlaying = false;
         * Constructor
         * @param acClip Clip The sound clip.
         * @param index int The index of the sound (so that the correct thread can be found when a sound should be stopped.)
        public SoundThread( Clip clip, int index )
            soundIndex = index;
            soundClip = clip;
            soundClip.stop();
            soundClip.flush();
            soundClip.setFramePosition( 0 );
            soundClip.setLoopPoints(0, -1);
            setPriority(Thread.MIN_PRIORITY);
          * Tell the thread to play the sound once and start playback.
         public void playSound()
             loopCount = 0;
             start();
         * Tell the thread to loop the sound and start playing.
        public void loopSound()
            loopCount = Clip.LOOP_CONTINUOUSLY;
            start();
         * Stop playing the sound in this thread.
        public void stopSound()
            soundClip.stop();
            soundClip.flush();
            soundClip.setFramePosition( 0 );
            donePlaying = true;
         * Get the index of this particular sound clip.
         * @return int The index.
        public int getSoundIndex()
            return soundIndex;
         * Has the sound finished playing?
         * @return boolean True iff it's done.
        public boolean isDonePlaying()
            return donePlaying;
         * Play the sound in the thread.
        public void run()
            soundClip.loop( loopCount );
            donePlaying = true;
    SoundPlayer.java
    import javax.sound.sampled.*;
    import java.net.URL;
    import java.util.LinkedList;
    import java.util.Vector;
    public class SoundPlayer
        private Vector<Clip> clipList = null;
        private LinkedList<SoundThread> playerList = null;
         * Constructor
         * Initializes the list of sounds being played and the list of sound clips.
        public SoundPlayer()
            playerList = new LinkedList<SoundThread>();
            clipList = new Vector<Clip>();
         * Add a sound to the list of sounds in the player.
         * @param fileName String The file name (including sub-directories) to the sound.
         * @return int The index of the sound in the list, -1 if it could not be added.
         * @throws UnsupportedAudioFileException The format of the file is unrecognized.
         * @throws LineUnavailableException No output found.
         * @throws IOException Most likely the file could not be found.
        public int setSound( String fileName ) throws Exception
            Clip theClip = getClip(getURL(fileName));
            if ( clipList.add(theClip) == false )
                theClip.flush();
                theClip.close();
                return -1;
            return clipList.indexOf(theClip);
         * Get a reference to a specific sound.
         * @param soundIndex int The internal index of the sound.
         * @return Clip A reference to the sound.
        public Clip getSound( int soundIndex )
            return clipList.elementAt(soundIndex);
         * Play a sound.
         * @param soundIndex int The internal index of the sound to be played.
        public void play( int soundIndex )
            SoundThread player = new SoundThread(getSound(soundIndex), soundIndex);
            playerList.add(player);
            player.playSound();
         * Stop playing all sounds.
        public void stop()
            while ( playerList.isEmpty() == false )
                SoundThread player = playerList.removeFirst();
                player.stopSound();
                player = null;
         * Stop playing a specific looping sound.
         * @param soundIndex int The internal index of the sound to be stopped.
        public void stop( int soundIndex )
            // Create a temporary list for sounds that are playing and should continue to play.
            LinkedList<SoundThread> tempList = new LinkedList<SoundThread>();
            while ( playerList.isEmpty() == false )
                SoundThread player = playerList.removeFirst();
                // This is the sound clip that should be stopped.
                if ( player.getSoundIndex() == soundIndex )
                    player.stopSound();
                // Remove any threads that are done playing.
                if ( player.isDonePlaying() )
                    player = null;
                // Add all other threads to the temporary list.
                else
                    tempList.add(player);
            // Update the player list to the new list.
            playerList = tempList;
         * Loop a sound.
         * @param soundIndex int The internal index of the sound to be played.
        public void loop( int soundIndex )
            SoundThread player = new SoundThread(getSound(soundIndex), soundIndex);
            playerList.add(player);
            player.loopSound();
         * Get an URL to a file inside the current jar archive.
         * @param fileName String The file name, including subdierctory information if applicable.
         * @return URL An URL to the file.
        public URL getURL( String fileName )
            return this.getClass().getClassLoader().getResource(fileName);
         * Load a sound clip from an URL.
         * @param urlResource URL An URL to the sound file.
         * @return Clip A reference to the sound.
        public Clip getClip( URL urlResource ) throws Exception
            Clip theSound = null;
            try
                // Open a stream to the sound.
                AudioInputStream ais = AudioSystem.getAudioInputStream( urlResource );
                // Get the format of the sound clip.
                AudioFormat af = ais.getFormat();
                // Create a line for the sound clip.
                DataLine.Info dli = new DataLine.Info( Clip.class, af, AudioSystem.NOT_SPECIFIED );
                // If the format of the clip is not supported directly then try to transcode it to PCM.
                if ( !AudioSystem.isLineSupported( dli ) )
                    // Create a new PCM audio format for the clip.
                    AudioFormat pcm = new AudioFormat( af.getSampleRate(), 16, af.getChannels(), true, false );
                    // Open a stream to the sound using the new format.
                    ais = AudioSystem.getAudioInputStream( pcm, ais );
                    // Read the format of the clip.
                    af = ais.getFormat();
                    // Create a new line for the sound clip.
                    dli = new DataLine.Info( Clip.class, af );
                // Create the clip, open it, and read its entire contents.
                theSound = ( Clip )AudioSystem.getLine( dli );
                theSound.open( ais );
                theSound.drain();
            catch( Exception ex )
                throw new Exception(urlResource.toString() + "\n" + ex.getMessage());
            // Return a reference to the sound clip.
            return theSound;
          * Destructor
          * Release memory used by loaded sounds.
         public void dispose()
             stop();
             for ( int i = 0; i < clipList.size(); i++ )
                 Clip c = clipList.elementAt(i);
                 c.stop();
                 c.flush();
                 c.close();
             clipList = null;
    }Here is an example of how to use these classes:
        public static final void main( String[] args )
            try
                SoundPlayer sp = new SoundPlayer();
                int clip1 = sp.setSound("clip1.wav");
                int clip2 = sp.setSound("mySounds/clip2.aiff");
                int clip3 = sp.setSound("clip3.au");
                sp.loop( clip1 );
                Thread.sleep( 5000 );
                sp.play( clip2 );
                Thread.sleep( 1000 );
                sp.play( clip3 );
                Thread.sleep( 4000 );
                sp.stop( clip1 );
                sp.dispose();
            catch( Exception ex )
                ex.printStackTrace();
    ...The main weakness of this solution is that if you've got two or more instances of the same sound looping and want only one of them to stop, then, sorry, they're all stopped. There are probably more weak points but these two classes have worked well for my purposes so far.
    Hope this solves at least part of your problem.
    Hjalti
    PS. I have assembled these two classes from code snippets and examples found here and there on the Web so I'm in no way claiming to be the original author of all of this code. Unfortunately I haven't registered where it all came from so I'm unable to give credit where credit is due.

  • Projector that plays more than one movie

    How can I make one projector play more than one movie? If the movies are protected, can the projector still play them? How can I link them? Thanks for your help.

    Hi Norman,
    I’ll elaborate on Sean’s reply.
    As Sean mentioned you can use:
    _movie.go("markerName", "MovieName")
    To jump to the marker named ‘Markername’ in a movie called ‘MovieName’.
    I tend to still use the verbose syntax
    go to "markerName" of movie "MovieName"
    If you had:
    go to movie "MovieName"
    you’d jump to the start of the movie (frame 1)
    you could use:
    go to movie "MovieName.dir"
    but the '.dir' is not needed and if you create a protected DXR or DCR, the statement (without the movie extension) would work.
    Now, if you want to avoid writing a unique behavior for every link you’re creating, I’ve got a tutorial that describes how to do it at:
    http://www.deansdirectortutorials.com/Lingo/paramDialog.htm
    The above uses property variables and a parameter dialog box. It does require some understanding of programming (not too much though).
    If you have D11.5, in the Library Palette, in the ‘Controls’, category, there is a ‘Jump to Movie Button’ behavior. This behavior can be dragged and dropped onto a sprite and then you can type in the marker name and movie name in a parameter dialog box to set the link for the sprite. I say D11.5 because while earlier versions of Director have this behavior, there is a small error (easily fixed) that makes the marker jumping part non-functional. Anyway, my behavior in my tut site does the same thing.
    Dean
    Director Lecturer / Consultant / Director Enthusiast
    http://www.deansdirectortutorials.com/
    http://www.multimediacreative.com.au

  • Play more than one song at a time

    The apple tv won't play more than one song on my playlist. And why can't there be playlists under "Music" and well as "Computer"?

    WLFehrs wrote:
    This has been a condition since day one.  The "working" icon just keeps going and it doesn't move on to the next song.  I've tried using the random play option as well to no avail.
    Is this when trying to stream content from iTunes using the Computers icons and Music submenu? I assume  the same happens when you try to play from the internet using the main Music icon too?  Is it only on Shuffle or when playing an album?
    What about movie rentals from itunes Store  - will they play ok?
    WLFehrs wrote:
    Connectivity isn't a problem, my home network has the latest tech and the Apple TV is within 15 feet anyway. 
    While that seems logical don't entirely discount it - issues like this are incredibly frustrating to pin down to which component on the network is causing the problem  - your old AppleTV worked (with Windows 8?) so this makes the newer model the more likely culprit I would agree.
    Whenever there are issues like this, if you have not done so:
    1 - Unpower AppleTV, router and restart along with the computer.
    2 - If connecting via wifi and it is feasible to test with ethernet do so to exclude wifi as the problem somewhere in the chain.
    3 - If streaming from iTunes check the computer is not going to sleep - power saving with hard drives spinning down could potentially cause a 'timeout' issue for access and worth temporarily disabling to test.
    4 - Temporarily disable any security software (firewall/port blocking) on the computer or check if it is detecting AppleTV repeated connections as an unknown intrusion threat.
    5 - Reset AppleTV and set it up again from the Settings menu.
    6 - Restore AppleTV using iTunes and a microUSB to USB connection:
    Apple TV (2nd and 3rd generation): Restoring your Apple TV
    7 - Assuming under warranty, take it to an Apple store and see if you can get a replacement.  It may be faulty.
    As I said these issues can be very tricky to pin down and it can be a process of elimination.
    I had issues last year with connection problems - I thought it was an itunes update as there were threads elsewhere about multiple connections being established.  One day I restarted my router and the problem was fixed.  A few years ago my AppleTV1s were hanging after extended use - it was the Netgear router overheating ( aknown fault with that particular model).
    AC

  • ITunes will no longer play more than one song in a row

    I upgraded my iTunes and it seemed to be working fine. But all of a sudden I cannot get my libraray or any playlist ti play more than one song at a time automatically. It just stops after each song. Any ideas?
    Thanks
      Windows XP  

    But all of a sudden I cannot get my libraray or any playlist ti play more than one song at a time automatically. It just stops after each song.
    head into your itunes main library window. are all the little boxes to the left of your tracks unchecked?
    is so, hold down Ctrl and click on one of those boxes to recheck all the songs. (this may take a little time.)
    do you get continuous play once all the songs are rechecked?

  • How to open more than one RAW-File by drag&drop/doubleclick with CS2?

    Hello,
    is it possible to open more than one RAW-file from iPhoto with Photoshop's RAW-converter in just one single step? If I drag&drop my selection to my Photoshop-Icon, PS opens just the iPhoto-created library-JPGs of the RAW-files but not the RAWs itself (I've turned out the copyying of the imported photos to the iPhoto-library. Instead iPhoto seems to create a JPG for the library from every RAW I import). If I doubleclick a selection of RAWs in iPhoto just the doubleclicked RAW-File will be opened in Photoshop. Is it possible to select more than one RAW-file in iPhoto and get Photoshop to open all the selected RAWs but not the JPGs? It would make my work a lot easier... thank you.
    rockenbaby

    hello
    try selecting the photos that you want however many- go, File then Export.
    you can make all your file selections image size etc and then save them direct to your PS file.
    hope this helps.
    cjp

  • How to Include more than one jar files

    My application uses more than one jar files. And all the jar files i am using are signed. when i include the jar files, i am including them in the resources section of the ".jnlp" file . The section of code looks like this:
    <resources>
    <jar href="utestfw.jar" main="true" download="eager"/>
    <jar href="crimson.jar"/>
    <jar href="jaxp.jar"/>
    </resources>
    <application-desc main-class="utestfw.ObjectBrowser"/>
    The deployment of the application is successful. The jar file - "utestfw.jar" contains the application main class when the application is launched it works, but when i choose the feature which involves the classes of either "crimson.jar" or "jaxp.jar" , the application terminates and the webstart console and the application is closed automatically. Am i wrong in adding the jar files? what is the way to add more than one jar files to the ".jnlp" file.
    Can anyone please help me?
    -Aparna

    I'll post u the jnlp file which i am using. To sign all the jars i've used the same alias ( a self signed certificate using keytool and jarsigner).Here is the jnlp file:
    <?xml version="1.0" encoding="utf-8"?>
    <jnlp spec="0.2 1.0"
    codebase="http://127.0.0.1:8080/healthdec"
    href="testTool.jnlp">
    <information>
    <title>Unit Test Manager </title>
    <vendor>Sun Microsystems, Inc.</vendor>
    <description>A minimalist drawing application along the lines of Illustrator</description>
    <icon href="images/testing.gif"/>
    <offline-allowed/>
    </information>
    <resources>
    <j2se version="1.3+ 1.2+"/>
    <jar href="utestfw.jar" main="true" download="eager"/>
    <jar href="crimson.jar" main="false" download="eager"/>
    <jar href="jaxp.jar" main="false" download="eager"/>
    </resources>
    <application-desc main-class="utestfw.ObjectBrowser"/>
    <security>
    <all-permissions/>
    </security>
    </jnlp>
    Can u please look at the above code and suggest me where i am wrong. Thanks.
    -Regards
    Aparna

  • How to compile more than one .cpp file?

    Hi Folks!
    I'm really need help. Stuck with the simple thing: I need to compile more than one source code file into .SWC.
    It's fine with a single file typing:
    g++ source1.cpp -swc -o mylib.swc
    when I try to use
    g++ source1.cpp source2.cpp -swc -o mylib.swc
    source1.cpp is ignored, and source2.cpp is used.
    As result I'm getting error in SWF:
    Undefined sym: _main
        at cmodule.mylib::CLibInit/init()
        at test_fla::MainTimeline/frame1()
    Because source1.cpp skipped.

    I digged it.
    Just created makefile with lines
    all:
        g++ -c source1.cpp -o source1.o
        g++ -c source2.cpp -o source2.o
        g++ -swc -o mylib.swc source1.o source2.o;
    and run make.
    in docs I found that I can pass more than one .cpp file, but it won't work for Alchemy. However, if we compile .cpp one by one into .o files we can then link them together.

  • How can I put more than one source file when I am creating my installer from LV 7 Express

    Hi,
    I am creating my installer for my application and I would want to add more than one source file at once, how could I do it?
    Thanks,
    ToNi.

    Hi,
    I'm referring to the first executable. In other words, I have my application and I want to build and executable of it. Then I go to "Tools->Build application..." and then in the source files tab I can add my vi files but I want to add more than vi at the same time (at once) and not one by one. How can I do it?
    And my second question is: When I make the installer for my application I save the configuration in a build Script file (.bld) in order to use it whenever I want. Then If from another computer different from the one where I generate the .bld file, I load it, LV tells me that something is wrong (LV says there are some errors in some VIs but It doesn't tell me what files are). Why?
    Thanks in advance,
    ToNi.

  • How do I attach more than one PDF file to an email

    How do I attach more than one PDF file to an email

    You cannot do that on iOS when you are using the Share feature from Reader.

  • Applet Videoplayer, able to play more than one movie

    Hallo,
    I am looking for a sample applet that works as a video player.
    I have tested the sample code provided by JMF, but there is no
    example that allows to replace the current movie with a new movie.
    In other words, I am looking for a applet program, which allows me
    to give in new movie adresses and so to reload the player with a
    new film.
    Thanks in advance
    mk

    I do not know if I am using a flvplayback component. I am using "import video" - using the URL. I am using a skin provided in flash. Is that a flvplayback component?
    I am not using flv if that matters (using h.264 - f4v I believe it is called).
    Where do I put this code you have provided? I find this the most confusing part of Flash - I never know where to insert provided code.
    Does it go in the original swf file (if so - where?), or does it go in the main swf (where all the swfs would play one after the other) - and if so, where exactly?
    I don't really get how I load more than one swf in a main file to begin with either...... as I said - when I try - I get a loop of two frames - like an animation - it's not playing the full videos (with page setup), and then moving onto the next one. This is where I get lost - and tutorials are not being very helpful (as they deal strictly with video - often not continuous play, but user controlled, OR, they provide code with no directions where to actually put things).
    Do I import the swf into the master swf? Or just use code to tell it where the files are??
    Feel free to use small words and speak slowly. I haven't used this program before, and it seems very different from building a website with, say CSS for example (something I DO know how to do). I appreciate specific directions (or tutorials that provide the specific directions that address this question....)
    BTW - and overall ty for your continued assistance. If I had more time, I would pick up a book and work through things slowly - but I need to get at least a few things working to hand in the art piece for school - doesn't need to be finished, but needs to at least demonstrate a few of the website's overall features. I fully intend to do more detailed learning later to finish the piece outside of class.

  • Is it Possible to Play More than 1 Audio File Parallelly ?

    Friends,
    Is it possible to run more than 1 audio file at a time using Player or Processor ???
    For example, i have
    Audio1.MP3, which play for 2 minutes (which has only music).
    Audio2.MP3, which play for 1 minute ( which has only voice).
    I want to start with Audio1.MP3 and when it reach 1 minute, Audio2.MP3 should parallelly run with Audio1.MP3, so that 2 audio file should finish at same time.
    I want my music and voice should be mixed... (i.e) i want to mix two audio tracks..
    Is it possible thru JMF ????
    Regards
    Senthil

    I dont know if its possible with JMF, but it is with javax.sound
    You write a method to play a file, and then you create two threads where each one plays a different sound file, and tell one of them to wait 60000 millis.
    R. Hollenstein

  • How can I reference more than one jar file

    hi, In an applet, I use
    Archive = "foo.jar" to reference this jar file.
    But how can I reference more than one file?
    Thanks.

    Suggestion: spend a few minutes reading the tutorials.
    http://java.sun.com/docs/books/tutorial/applet/appletsonly/html.html
    You can specify multiple archive files by separating them with commas:
    <APPLET CODE="myapplet.class" ARCHIVE="file1, file2"     WIDTH=anInt HEIGHT=anInt>
    </APPLET>

  • More than one upload file at a time?

    Say if I have like more than one file upload field in my
    form, is there a way where I can do the upload of all the files
    together just like what I usually do in HTML?
    I am having the problem to do this because apparently, PHP
    only receives the $_FILES['Filedata'], which is only one of the
    upload fields that I have on a form. So it only allows a single
    upload when a submit button of a form is clicked on.

    Thanks mhartnett.
    I have looked at the example on the link you gave. According
    to the example for the FileReferenceList in the documentation, it
    seems to make multiple or rather separated requests to the
    server-side upload script.
    So for example if I have 3 files to upload, the script will
    call the the upload() function of the FileReference class thrice
    with the URLRequest(which is the server-side upload script). So in
    this case, my server-side script that is handling the upload will
    only upload one file at one time.
    Is there a way where I can have say all the 3 files sent
    together to the server-side script, and then have them uploaded all
    at once within the server-side script itself?
    So say my PHP file, I could have access to like
    $_FILES['Filedata1'], $_FILES['Filedata2'] and $_FILES['Filedata3']
    together at one request.

Maybe you are looking for