Running sounds in succession

I have been trying to get some code together that will play one sound, and when that sound is done, play another sound but I have been unable to do so. I was hoping that someone here could point out the error in my logic and or code so that I can get it running.
//The calling method
     private void playSound(String soundString)
          try
               Clip theClip = getClip(getURL(soundString));
               SoundThread st = new SoundThread(theClip, 0);
               st.playSound();
               while (st.isDonePlaying() == false)
                    Thread.sleep(20);
          } catch (Exception ex)
               ex.printStackTrace();
//The sounds thread class
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;
     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);
     public void playSound()
          loopCount = 0;
          start();
     public void loopSound()
          loopCount = Clip.LOOP_CONTINUOUSLY;
          start();
     public void stopSound()
          soundClip.stop();
          soundClip.flush();
          soundClip.setFramePosition(0);
          donePlaying = true;
     public int getSoundIndex()
          return soundIndex;
     public boolean isDonePlaying()
          return donePlaying;
     public void run()
          soundClip.loop(loopCount);
          donePlaying = true;
}

You can't do that with Clip, as it starts a separate thread to play each, which (can) cause Multiple Clips to play at once.
To play sounds serially, use the Java Sound API.

Similar Messages

  • Random 3 note tone, low high mid tone sound in succession.

    Hi All,
    Occasionally I get a three tone sound from my MBP.  It sounds like  something you would hear on a station with a low high mid tone sound in succession.  As it is too random it is hard to capture using opensnoop and filemon.
    Thanks, Dave.

    If you are running Skype, it could be alerts that contacts are available. You can turn the off in Skype/Preferences.

  • Is there a way to use my external hard drive to run sounds from Mainstage2?

    Is there a way to use my external hard drive to run sounds from Mainstage2?

    TM can back up external HDs. If you have both of your external drives attached, go to the options in TM preferences. Be sure the data drive is not listed (this lists drives/folders to exclude from a backup). Then initiate a TM backup or wait for the hourly backup. That should back up the data drive.
    You can only tell TM what to exclude from a backup, not what to include.

  • TS1365 My Macbook Pro 17" 2.44ghz all of a sudden one day decided to not boot up. When the power button is pressed the sleep light in the front on the latch release turns on and there is a small running sound but it never boots up and the screen never lig

    My Macbook Pro 17" 2.44ghz all of a sudden one day decided to not boot up. When the power button is pressed the sleep light in the front on the latch release turns on and there is a small running sound but it never boots up and the screen never lights up. Anyone else have this problem? Any ideas?
    I'd love to repair it but not if it'll cost 500 bucks or more to replace the logicboard.
    I appreciate any help
    Michael

    Lao Bo,
    yes, you can locate and copy a file from your HD to a USB key using UNIX commands. If you know the exact name of the file which you’re trying to locate, try this:
    find / -iname filename -print
    This command will search your entire internal disk for the particular filename. If you know that it’s within a particular user account, then you can save search time with this variation:
    find /Users/username -iname filename -print
    Either variation of this command will print all files found which have the given filename. Presuming that you’re able to identify the correct file, you can copy it to a USB key using the command
    cp -p filename_returned_by_find /Volumes/USB_volume
    If you’re not sure which volume name your USB key has, this command will show you what the possibilities are:
    ls /Volumes
    Please let me know if you have any trouble with these commands.

  • Toshiba - I cannot run Recovery DVDs successfully

    I appreciate if somebody can help me to solve my problem as explained below.
    My Toshiba laptop L650 developed some problems that is when I decided to resotore to its original form by running Recover DVDs which I created earlier using Toshiba Tempro.  Unfortunately, recovery process did not complete and I got error message which says "Boot manager missing", screen became black and I could not start my laptop.  Another bad news is that my HDD was formatted and I loose all my data in C&D drives.
    Also I would like to know if recovery CD/DVDs do back up of C&D drives data.
    How can I run recovery DVDs successfully?

    Hi
    I dont think that the hacker or the virus is responsible for non CD drive booting. I cant believe it. In my opinion if the drive cannot read the CD so possibly the CD is corrupt or the drive has a malfunction.
    However, in my opinion you should be able to enter the BIOS. As mentioned above you can use the ESC and then F1 to enter the Toshiba BIOS. But if there is a Phoenix BIOS preinstalled so you have to use the F2 key. You have to press this buttons immediately after pressing the power button.
    On my notebook I can also use the F12 key and the booting menu appears.
    Then I can use the arrow buttons to select the booting device.
    If you are not able to boot from the recovery CD so try to boot from the original Microsoft Windows CD.
    Possibly it helps. Good luck :|

  • The app store says lion is installed. However it is not on my computer despite running and apparently successfully installing the downloaded package

    The app store says lion is installed. However it is not on my computer despite running and apparently successfully installing the downloaded package. Any thoughts? Obviously I cant download it again as the app store says it is installed. I cannot find the package on my mac, when I try and search for it!!

    Hi Hugh,
    Once you download Lion from the app store you still have to install it.  Its located in your Applications directory.

  • Long running reports end successfully - present s "page can not be found"

    Long running reports and browser timeouts - page can not be found"
    We are launching Oracle 9i Reports from a Portal 9ias (release 9.0.2.2) system. We are in production with about 100 users. It is not going well with respect to Report problems.
    We have the following problems:
    1) hanging reports,
    2) reports where parameter screens will not present due to large LOV on parameter screen,
    3) and the most aggravating problem is "Page can not be found" presented to user when in fact the report ran successfully and create a .pdf.
    We are at our wits end with Oracle Support and the Oracle Portal and Reports product.
    As I said, I am launching Oracle Reports 9i from a Portal 9.0.2.2 application. I have several long running reports that complete successfully but return to the user an error "Page can not be found". Meta-link Note: 189454.1 suggests a modification to ReceiveTimeout parameter in the pc registry. We set the ReceiveTimeout parameter to 7200000. This did not solve the problem. Users still receive "Page can not be found".
    Is there a report server side setting that we must set also ... or some other setting we should check?
    I need to solve this issue. Is there someone out there that can help? Are there other people having similar Oracle Reports issues? According to Oracle Support we are the only people with these issues. Are we?

    1) If you can reproduce the Reports Hanging issue consistently you can push Oracle Support to file a bug.
    2) I am not sure about this now, but again you can take this to Oracle Support and push for resolution.
    3) There are some problems with IE - Adobe integration. This is not a Reports bug. You can try
    (a) Switching off Adobe - web integration in Adobe Acrobat reader settings, so that Adobe will not automatically open pdf file in web. Instead a dialog will be shown as to which application to open the pdf file or save it to disk and user can save the file to disk and open.
    (b) Use IE latest version. (or some other browser like Netscape )
    [ You can roll back the ReceiveTimeout param change you made to see the impacts one at a time ]
    1) To confirm that this is a Adobe - IE pdf problem run the same report to htmlcss, rtf. If these come fine, then we can ascertain that this is Adobe - IE issue.
    2) Give http://host:port/reports/rwservlet/showjobs?server=server_name. You can see all the jobs and their jobids. For the concerned jobs you can click and see whether output is actually generated or not.
    Thanks
    The Oracle Reports Team
    The statements and opinions expressed here are my own and not that of my employer

  • Intel iMac running boot camp success

    I am looking at replacing my HS PC Lab and I am debating if I want to replace the labe with 17" iMac Intel machines and running boot camp on the iMac to get to my windows applications. Is there anybody out there that has purchased the Intel iMacs and run boot camp for windows applcations for the entire school day? If so, what is your success rate? Are you running Windows 2000, Windows XP Pro, or Windows Vista? I have heard of schools doing this for 1 hour a day and are happy with it.

    Hi there.... my 5 cent is:
    I use OSX for as much as possible.
    I use bootcamp with Windows XP for gaming, and get "native" PC speed. With the present version of Bootcamp I have had no issues at all. The iMac just works as a PC (but looks so MUCH better)..
    I use Parallels desktop with Windows XP for all other "non gaming" windows applications with only a small impact on speed. All other for me however means only a piece of GPS software for my PocketPC - not available in OSX version....
    If you want style and versatility - go for the Mac
    iMac 20" Core Duo, 2 GB Ram, 256 Mb Video   Mac OS X (10.4.8)  

  • Audio; can I have 2 running sound tracks?

    Hi All-
    I have 1/2 a dozen clips in the time line and I have disabled the audio from all (inspector--->Audio---->uncheck Channel Config).
    These clips are all Irish dance ("Lord of the Dance" type), the audio on the clips is no good, hence I disabled it. I have 5-6 music mp3's to add as the main audio soundtrack, I'll fade in/out with clips (clips are separate dances). I'm not worried about any synching here.
    I also have a lengthy audio clip of just tap dancing on a hardwood stage. I would like to have the music run and at the same time have the tap dancing sound effect play with the music-yet be able to fade the tapping in/out and have separate volume on it (to blend it into the music track).
    Not sure how to begin, or if it can be done. I'm thinking possibly using the "Dual Mono" because I think separate channels can be independently adjusted as I'm thinking? Any idea's on doing this, how to, some freebie tutorial anywhere,any workflow sequence etc would be appreciated-
    Thanks, Robes

    Rhobes wrote:
    … Not sure how to begin, or if it can be done. I'm thinking possibly using the "Dual Mono" …
    way too complicated thinking   - just add your tracks to the project, and use the ribbons and/ or R_ange tool first, than adjust:
    obligatory link to Mark&Steve:
    http://youtu.be/s_ztmlKLhAU

  • Certreq -submit run locally returns successful but run remote via invoke-command hangs

    Good morning I have been struggling with a certificate request script.
    The requesting server is in the dmz and I have a management server internally.
    I successfully create the Inf file, as well as the req file then copy the req file to my internal management server. Once copied internal I attempt to run the following command from my laptop executing as my admin account
    $Fqdn = "server.dmz.com"
    $managementServer = "InternalServer"
    $Path = "C$\Test\CertRequests"
    Invoke-Command -ComputerName $Managementserver -ScriptBlock {param($CertificateAuthority,$FQDN,$Managementserver,$Path) certreq.exe -submit -attrib "CertificateTemplate:DVNOfflineComputer" -config "$CertificateAuthority" "\\$Managementserver\$Path\$FQDN.req" "\\$Managementserver\$Path\$FQDN.crt"} -ArgumentList $CertificateAuthority,$FQDN,$Managementserver,$Path
    This exact command pasted into a powershell window locally on the management server returns the crt file.
    Run via invoke-command just hangs forever. I even tried to the Silent=True in inf file as well as -q but neither worked.
    Any help is greatly appreciated.

    Hi Jason,
    I reform the script as below, and add the "test-path" to check if the .req and .crt files exist, please also note you haven't assign value to the "$CertificateAuthority" variable:
    $Fqdn = "server.dmz.com"
    $managementServer = "InternalServer"
    $Path = "C$\Test\CertRequests"
    $CertificateAuthority = "something"
    $script={
    param($CertificateAuthority,$FQDN,$Managementserver,$Path)
    test-path "\\$Managementserver\$Path\$FQDN.req"
    test-path "\\$Managementserver\$Path\$FQDN.crt"
    certreq.exe -submit -attrib "CertificateTemplate:DVNOfflineComputer" -config $CertificateAuthority "\\$Managementserver\$Path\$FQDN.req" "\\$Managementserver\$Path\$FQDN.crt"
    Invoke-Command -ComputerName $Managementserver -ScriptBlock $script -ArgumentList $CertificateAuthority,$FQDN,$Managementserver,$Path
    If there is anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Support, contact [email protected]

  • Flash Player will not run after a "successful" installation.

    Over the past couple of weeks, when attempting to play a video or display a picture, I have responded to the prompt that I require the newest version of Flashplayer and have clicked to follow the link. I have done this and installed at least 10 times, the last time being a few minutes ago.  Each time I get the message that the installation was successful and that I am currently running the latest version (11.6 something), but I still get the prompt saying I need a newer version when trying to play the video or display the picture. On your help page where my version or an error message is supposed to display in a box to assisst with trouble shooting, the box remains blank.  On some occasions I have even gone into Control Panel, Program and Features, and have uninstalled Flash Player before reinstalling it. I have aslo tried disabling my virus protection (Norten) although on the times I haven't I have checked in Norton and it says it has allowed the installation.  Nothing makes no difference.  I have gone through a lot of your trouble shooting help suggestions but have found nothing that works.  I have (and have confirmed I have according to the on-line help directions) Windows 7, 64 bit, and Internet Explorer Version 9, 64 bit.  Each time I have downloaded the 64-bit version of Flash player.  Something I have noticed but can't figure out is that when I go into Control Panel, on the first screen ("Adjust your computer settings") there is a Flash Player (32-bit) heading.  After an uninstall this disappears but reappears after installion even though I have definitely chosen the 64 bit download.  I hope you can help me figure out what is going on.

    Flash Player Help | Installation problems | Mac OS
    Archived Flash Player versions
    Mylenium

  • [solved] Problems with multiple applications running sound...

    Multiple programs on my system are unable to use sound at the same time. When any two programs that are supposed to output sound run together, the program that started the output first prevents the other from outputing. I read the Wiki page on ALSA, but have had no luck so far in identifying the problem. I do believe that I am using alsa, as the sound of the program with sound does change as I adjust the alsa mixer volumes.
    This started happening when I reinstalled arch this moring with XFCE (I needed to add more space to root partition and replace my DE, and fealt it would be easiest to just reinstall the OS.) In the few days I was using KDE, the sound worked fine. I also previously used Ubuntu on this system in which the sound worked fine.
    I am inclined to believe that It is either something I have not configured properly (however I did not do anything to sound setup in the KDE install) or a package that did not install with XFCE, but does with KDE-base.
    EDIT: Also, If the sounds are coming from the same application they can both play, IE I can hear 2 youtube videos at the same time but not a youtube video and VLC or Skype.
    Last edited by unr3st (2011-05-31 08:26:28)

    brebs wrote:
    Run fuser.
    Lots of info in my ~/.asoundrc
    Here is the output,
    [unrest@Uberschlecht ~]$ fuser -v /dev/snd/* /dev/dsp*
    Specified filename /dev/dsp* does not exist.
                         USER        PID ACCESS COMMAND
    /dev/snd/controlC0:  unrest     1423 F.... pulseaudio
                         unrest     1483 f.... xfce4-mixer-plu
                         unrest     1541 F.... plugin-containe
    /dev/snd/pcmC0D0p:   unrest     1541 F...m plugin-containe
    /dev/snd/timer:      unrest     1541 F.... plugin-containe
    There are no process in /dev/dsp
    It may be worth adding that I had no .asoundrc in my home directory
    I have also just discovered that flash seems to be the program that causes the interferences, as VLC and Skype run fine  together. I am going to try the instructions by Karol, reboot, and report the results.

  • [HTML5/Flash CC] Example code to add/run sound programmatically?

    Anyone have a code snippet to do this? I managed to make a really stupid work-around for the moment. Created a movieclip in it with nothing but the sound, gave it an instance name and now I can do mcBeep.gotoAndPlay('start') to play it, but for obvious reasons, I'd like to be able to do this without having to leave an empty movieclip lying around on stage...
    Thanks in advance!

    JLudwig wrote:
    Any reason why you call getSourceDataLine() twice? ..Oh wait, I know this one (..snaps fingers. yes) it is because I am a mor0n, and forgot the class level (static) attribute declared earlier in the source when I (re)declared the local attribute and called getSourceDatLine (which was redundant, given the next line, which as you point out also called getSourceDataLine).
    There are (at least) two ways to correct this problem.
    1) Remove the class level attribute and the second call.
    2) Remove the local attribute as well as the first call (all on the same code line).
    Method 1 makes more sense, unless you intend to refactor the code to only instantiate a single SDL for however many times the user presses (what was it? Oh yeah..) 'Generate Tone'.
    My 'excuse' for my odd programming is that this was 'hacked down' from a longer program to form an SSCCE. I should have paid more attention to the fine details (and perhaps run a lint checker on it).
    Thanks for pointing that out. I guess from the fact you spotted it, that you have already corrected the problem. That you thought to report it, gives me confidence that you 'will go far (and be well thought of, besides)' in the open source community.
    ..This is quite handy, thank you.You're welcome. Thanks for letting us know about the error (OK - the pointless redundancy). Thanks to your report, other people who see this code later, will not have to wonder what (the heck) I was thinking when I did that.
    Another thing I noted, now I run the source on a 400MHz laptop (it's hard times, here) is that the logic could be improved. At the speeds that my laptop can feed data into the SDL, the sound that comes out the speakers approximates the sound of flatulence (with embedded static, as a free bonus!).
    Edit 1: Changed one descriptive word so that it might get by the net-nanny.
    Edited by: AndrewThompson64 on Mar 27, 2008 11:09 PM

  • Run app until successfully installed

    Is it possible to setup an app object so that it will run on each time a user logs in until it is successfully installed. And once it is successfully installed, it quits running. As far as I know there are only two settings: (1) Run Once and (2) Run every time a user logs in. But is there a setting to "run every time a user logs in until it is successfully installed, and then quit"?
    Thanks...

    > Is it possible to setup an app object so that it will run on each time a
    > user logs in until it is successfully installed. And once it is
    > successfully installed, it quits running. As far as I know there are
    > only two settings: (1) Run Once and (2) Run every time a user logs in.
    > But is there a setting to "run every time a user logs in until it is
    > successfully installed, and then quit"?
    With your option (2) you could add a "Distribution Rule" that checks for a
    file or a registry entry that only exists after a successful install and
    specify a condition to run only when this file or entry does not exist.
    Regards
    Rolf Lidvall
    Swedish Radio (Ltd)

  • Play arrayed sounds in succession

    I've got an array named
    voice of ten Sound objects, which I'd like to play, one
    after another, when a button is pressed. I tried the routine posted
    below. What happens is that the first two Sound objects play, then
    nothing. I've been fooling with variations on the above with no
    luck. Any guidance would be hugely appreciated.

    Just a quick follow-up; on running the code I found that the
    second
    voice[j].start() should be removed from the
    countOff() function. Then it works perfectly!

Maybe you are looking for

  • Webview Agent 24 Report Question

    From business Unit I was running agent report 24 last week to look at calls held and hold time.  I noticed several agents where the report does not seem to record the hold time properly.  Looking at the Queue summary. For example,  the February repor

  • UWC or AMCONSOLE - HTTP 404 File not Found

    Hello, I was trying to change to root doc to something else then i set it back to what it was via the Web Admin - Class of Virtual... I select it Tree of view... then under the prefs tab I changed the Doc Root pressed apply and restarted the web serv

  • Problems with the technical assistance and Warranty in BRAZIL

    My English is not the best, but I will do my best. I've bought an Iphone 4 from a telephony company called TIM here in Brazil, and after 15 days the device was not working anymore. I sent it to the technical assistance 32 days ago, and they said yest

  • BAPI in CALL DIALOG

    How can I make a BAPI work in a CALL DIALOG ? Since a call dialog opens in the same SAP LUW The Bapi BAPI_OUTB_DELIVERY_CHANGE does not work, Neither does using WS_DELVIERY_CHANGE. Please suggest an alternative Thanks

  • Why we use logical system

    dear all i want to know why we use logical system .?????????????