JRadioButton won't stop audio playback

I have a small program that has 2 radio buttons, one to play an audio file and the other to stop playing that audio file. The program will play the audio file when selected, but when I try to stop it, it doesn't stop the audio file...in fact, i think it opens up another one. Here is my code:
private class MusicThread extends Thread implements ItemListener{
public void itemStateChanged(ItemEvent event){
     try{
     File soundFile = new File("Sounds.mid");
                InputStream in = new FileInputStream(soundFile);
     AudioStream as =  new AudioStream(in);               
      if (event.getSource() == musicOn){
     System.out.println("Music is now ON");
     AudioPlayer.player.start(as);
     if (event.getSource() == musicOff){
     System.out.println("Music is Off");
     AudioPlayer.player.stop(as);
     as.close();
     in.close();
catch(FileNotFoundException ee){ System.out.println("File Not Found");     }
catch(IOException ee){ System.out.println("IO Exception");     }
}     

s_black08 wrote:
Yes...I moved the code where I create the streams. Now, my program will start and stop the music file, but it won't start it back up again.Hmmm... Then your code is not correct.

Similar Messages

  • Stopping audio playback on Zen Mi

    How do I stop playback on the Zen Micro?
    Is there an equivalent to "Stop" on the Zen Micro? There might be pause, but I don't want to Pause, I want to Stop.

    See here.

  • Audio error message on playback and P Pro CS6 won't stop playback. Have to force quit.

    Hello: I'm getting an audio error message on playback and P Pro CS6 won't stop playback. Have to force quit.
    Earlier in the project, I would crash when moving audio up/down tracks or up/down time line.
    Any thoughts?
    Thanks,
    Tolbert
    Mac/12 core/32G ram

    That screenshot will help us figure out what's going wrong, but I won't have any news until at least July 8 because our offices are shut down next week. In the meantime, two suggestions:
    Download CC and see if this crash occurs in the new version.
    Google cpp-99 premiere pro audio prefetch. I got several hits, but not dig into them to see if any had a solution or workaround.

  • Streaming audio data won't stop unless I turn off the phone for 5 minutes.

    I have been testing the Curve 8330 regarding streaming audio from an icecast server. The address of the station is http://www.AirProgressive.org, click on "listen". (I have already run this by the icecast experts and they say it is a Blackberry "bug")
    BLACKBERRY USERS! PLEASE BE AWARE THAT THE STREAM (dataflow) DOES NOT STOP WHEN YOU CLICK "STOP" ON THE MEDIA PLAYER! (and will continue for as long as you leave it on, and even if you turn off your BB for less than 5 Minutes.) I'm not sure if you are charged for these streams, but it seems that the battery is depleted rapidly if this continues without aborting it. See details of my testing below:
    > Access icecast stream by clicking on the link on the website:
         http://www.airprogressive.org:8000/stream.m3u
    > Stream consists of mp3 at 32kbps / 22050 Hz.
    > Stock media player launches, stops at "Do you want to open or save the item."
        > No connections started yet (viewing "List Clients" page of icecast admin interface).
    > Click "open", stream begins playing.
    > Two connections are started instead of just one, always offset by 2 seconds.
        -- but sometimes only one connection starts.
    > FYI, Icecast config: <client-timeout>30</client-timeout>
    Here is the output from the "List Clients" page of Icecast2 Admin
    IP
    Seconds Connected
    User Agent
    Action
    68.7.238.55
    406
    WinampMPEG/5.62, Ultravox/2.1
    Kick
    74.82.68.16
    6
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.16
    4
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    Note the last two entries with the same IP address. This is the Blackberry. Top entry is winamp player on PC for reference. Don't know why two listener connections are generated.
    > Stream is "Stopped" (i.e. click stop)
    > Stream is restarted (i.e. click Play)
    > A new connection is started, this time with a new +1 IP address.
    IP
    Seconds Connected
    User Agent
    Action
    68.7.238.55
    687
    WinampMPEG/5.62, Ultravox/2.1
    Kick
    74.82.68.16
    287
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.16
    285
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.17
    8
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    I can understand that the player may continue to communicate when "stopped" to fill the lookahead buffer, but when it is restarted, it should use the same connection and not start a new one.
    > Click Stop.
    > Click Play.
    IP
    Seconds Connected
    User Agent
    Action
    68.7.238.55
    803
    WinampMPEG/5.62, Ultravox/2.1
    Kick
    74.82.68.16
    403
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.16
    401
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.17
    124
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.18
    24
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    > Yet another connection is started with a new "listener".
    > Click "back" to exit from browser in Blackberry.
    > All threads continue.
        --> I have tested this many times and the threads continue without being cleaned up indefinitely, even though the player is stopped and the stream is not "playing" on the handset.
    > Turn off mobile network. Handset not communicating.
    > Threads continue
    > Handheld turned off.
    IP
    Seconds Connected
    User Agent
    Action
    68.7.238.55
    995
    WinampMPEG/5.62, Ultravox/2.1
    Kick
    74.82.68.16
    595
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.16
    593
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.17
    316
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    74.82.68.18
    216
    Mozilla/4.8 [en] (Windows NT 5.0; U)
    Kick
    Finally, after over 300 seconds, the threads are finally cleaned up.
    IP
    Seconds Connected
    User Agent
    Action
    68.7.238.55
    1139
    WinampMPEG/5.62, Ultravox/2.1
    Kick
    So, to stop the streaming server from communicating with the Blackberry handset, you must either turn it off or disable mobile network for at least 5 minutes.
    It appears that the handset continues to transfer data (and therefore incur charges, if the user does not have an unlimited data plan) if the handset is not turned off or mobile network disabled for at least five minutes. It also runs down the battery much faster because the radio transmitter is actively being used, even if the user is not listening to the stream.
    The Blackberry network has intervening servers that continue to receive data from the streaming server even if the handset is off. This behavior likely has utility to deal with the realities of the cellphone network, to allow the stream to be transferred from one cell to another, and deal with the possibility that the handset may be out of range for up to 5 minutes without "interruption." However, it is hard to turn off the stream.
    QUESTIONS:
    1. Is there a way to stop this sort of behavior using a configuration setting or something? It seems particularly stupid to start a new stream connection each time a STOP/START cycle is completed, allowing the old connections to continue streaming data (even if the data does not make it to the handset).
    2. IS IT TRUE that the user will be "charged" for the data streams that are not disconnected?
    3. Is there a way for a developer to send a signal to the intervening cellphone network to discontinue the orphan streams?
    THANKS!!

    No, I'm using something like this :
    to start...
                       channel = new SoundChannel();
                                            soundPlay = new Sound();
                                            urlReq=new URLRequest;
                                            urlReq.url=mylUrl;  // url of radio mp3
                                            soundPlay.load(urlReq);
                       channel = soundPlay.play();
    to stop it...
                          channel.stop();
                          channel=null;
                          try{soundPlay.close();} catch (e:Error) {} // error or not, the sream won't stop.
    Any idea ? Did you try with a NetStream object ?
    Bernard

  • Audio playback stops short

    Has anyone had problems with audio playback in a previewed or published presentation where the playback stop short and advanced to the next slide?

    Brian,
    The fact that this mp3 is about the same size as a standard 16 bit/44.1k stereo file of a 3 or 4 minute song, indicates to me that it's an extremely long file.
    I'm willing to bet you have run into the measure limit within a Logic song. It's 2000 something (can't remember it exactly).
    The standard work around is to drop Logic's tempo to something really slow, thus allowing the larger file to be able to play within the Logic song limit.
    See if that's it...

  • AIR for Android: Streaming audio data won't stop unless I quit....

    I write an application (AIR-Android with Flash Builder) which can play internet radio stations (streamed audio in mp3).
    When I want to stop the stream like myChannel.stop() / mySound.close(); the sound is stopping but the stream is still loading (I can see it with a network monitor app).
    Streaming audio data won't stop unless I quit the application or I switch my connection from WIFI to 3G or from 3G to WIFI.
    I do not have this problem with Air for Mac and IOS.
    How can I solve this problem ?
    Bernard

    Hi Chris,
    I received a response from a certain Wang Zhe (from Adobe) about this bug.
    https://bugbase.adobe.com/index.cfm?event=bug&id=3070987
    It should provide an example of his test that apparently it worked but I have still no answer from him.
    Is it possible to contact him directly?

  • Audio playback stops while the video is still running!!!

    Hi friends...
    I use my final cut for online streaming... and usually make a timeline for 11-12 hrs and run it in loop... everything worked fine all these years... but offlate we have been having problems with the audio playback... THE PROBLEM IS... while the timeline is still running and we can see the video on the screen the audio stops... but it stops after a few hours not at the time we start the timeline... as of now all we do is tap the spacebar twice to stop and start play again and it works again... but i would want a more permanent solution if anyone could help me out...
    thanks
    Anshu

    Hi,
    Yes, using all the default out of the box Coherence POF support, you would need to restart the cluster to pick up any changes.
    Do you really need the Java classes on the server side? Depending on what server side functionality you are using you might not actually need Java representations of the .Net classes. For example, if these are you entities that are being cached and you are never calling code that deserialises them, then there is no need for Java classes.
    You could potentially write your own implementation of a POF Serializer (PofContext) that is used on the server side that can dynamically add and change classes.
    JK

  • Audio playback suddenly stopped working?

    Audio playback stopped working in my project. The audio is there, but the checkbox in the audio pane will not function. I can click on it all day, but no check appears, and no audio plays.
    I have tried typical troubleshooting. Trash prefs, try different audio files and such. If I make a new project, audio plays in it just fine, but after a few minutes work in that project, the audio goes out again, never to return.
    Any ideas??

    Himaureen3k,
    Welcome to the HP Forums!
    I would like to take a moment and thank you for using the forum, it is a great place to find answers. For you to have the best experience in the HP forum, I would like to direct your attention to the HP Forums Guide First Time Here? Learn How to Post and More.
    I see you received the error " Windows cannot load the device driver for this hardware,The driver may be corrupted or missing (code 39)."
    Have you made any recent changes to your system?
    Have you tried booting into safe mode and doing a Windows repair?
    You can run the The HP Support Assistant to help resolve issues and update drivers.  You can do a restore back to a time when it was working correctly Using Microsoft System Restore (Windows 8).   You can manually download drivers from the download page for your system. HP Drivers & Downloads
    If you would like further assistance, would you provide the exact model of HP computer you have.  How Do I Find My Model Number or Product Number?
    Sparkles1
    I work on behalf of HP
    Please click “Accept as Solution ” if you feel my post solved your issue, it will help others find the solution.
    Click the “Kudos, Thumbs Up" on the bottom right to say “Thanks” for helping!

  • Playback won't stop in multicam sequence

    Here's a new one.
    When editing a multicamera sequence, I keep running into this weird phenomenon where I can't stop the playback.  I hit the space bar, start making cuts, then when I want to stop I hit the space bar again and nothing happens.  The sequence keeps playing, sometimes stopping after a couple a minute or so, sometimes not until the end of the sequence.
    The nested multi-cam sequence has just 4 streams of DSLR video.  The machine I'm using has plenty of CPU power and memory and an nVidia GPU, so I'd be surprised if resources are a problem.  The source media is on a Raid-0 array.
    I've tried switching the resolution to 1/4, but this makes no difference.  I have several layers of audio but have solo'ed just one to see if that would help.  No.
    Any suggestions?

    I am experincing the same problem.
    I am editing in MultiCam Layout with a nested muticam sequance Video and Audio. When playing the footage and doing multicam cuts while watching, the computer will not respond to the stop/spacebar command. It will continue to play until the sequance reaches the very end before it will stop. I have had some success by ALT+Tab to the desktop and then back to Premiere, however most of the time I have to Close Down Premiere via End Task in Task Mangager and then reopen the project with a loss of the recent changes.
    I have tried some suggestions by others;-
    'Show audio waveform' - OFF
    'Show audio keyframes' - OFF
    'Show audio names' - OFF
    "Timeline Scrolling" to "None"
    I have done some trouble shooting and this is what I have found to help.
    What did work for me was to minimise my Premiere Multicam Layout from 3 Monitors = (My Custom Layout - Multicam on Middle Monitor, Timeline spanned across 3 monitors, Left and Right Monitor with effects, Media Browser, Color Scopes etc etc) down to just the 1 Monitor =(Layout CS5.5 Multicam). Mine you all 4 montiors are still on, I have just left Premiere on the one monitor during Multicam Layout Editing.
    And this has stopped the problem from occuring.
    My computer is a bit of a God Box, Twin 2.5 i7 24 Cores 64Ram 6xSSD Drives with a Quatro 5000k graphics card and 4 Monitors.
    While watching Task Manager, none of the resources are anywhere near maxing out, CPU, RAM, Drives are all fine and are not under any load. So I am not sure as to why there is a problem with multicam play back in a multi monitor layout. I would have thought the computers info-tubes would be big enough to cater for multicam in multi-monitor layout.
    Any suggestions?
    (PS not sure if I can somehow flag this to Adobe Tech, Anyone know if I can?)

  • Audio Won't Stop when Previewing

    So, I have a 3 minute mp3 file on my stage; the idea is to provide background music for my animation.  So I go to preview the animation, and everything works fine, until I stop the preview.  Then the audio keeps playing on and on.  If I hit the preview again, obviously the music starts up again, and then won't stop, in a vicious circle of death that has me fleeing from the room.
    To make it clear, I'm not previewing the audio file, I'm previewing the entire animation with the audio file on the stage.  Thank you for your help!

    Okay, I solved it myself but I thought I'd post the solution here for newbies like myself who can't seem to locate anything useful in Adobe's help systems.
    When you set up an audio file, import it into your Library and not the stage.  Set up a layer for your background music, add a keyframe (name it something appropriate, and then in the frame properties, you can set a sound.
    Under "name" select the audio file you imported.  The other important bit is to select "stream" under Sync.  This will make the audio play only when and where the movie plays.  Handy.

  • ITunes stops during playback and won't start until I restart the computer

    I'm hoping someone can help me with this. I just reformated my computer and placed all the updates and programs back onto my computer. I had iTunes on my computer before and I reinstalled it then upgraded it to version 7.3.2.6. Now I've been reintroducing music back into the library on a folder by folder method (drag and drop). Anyway, during review of the songs I will get a random issue where the iTunes just stops during playback. I have shut down the program and restarted it. I've also shut down the following programs at different times to see if it would help:
    iPodService, ITunes.exe (the program), iTunesHelper, and even taskmgr.exe. Nothing seems to help. When I restart the program I click on play (any song or playlist) and nothing happens. The only thing that I have found to help is rebooting my computer. Does anyone have any ideas?
    I've check the event logs and nothing is showing in there and other programs are working without an issues.
    Please help!

    Any suggestions on what this can be?
    A dead battery.  Buy a new one.

  • IDVD won't ecode audio, 'not responding' = force quit

    IDVD 6 /10.4.7/MACPRO
    iDVD won't encode audio portion from iMovie had off.
    original iMovie from DV camera, iMove encodes QT, etc
    iDVD encodes video ( as noted by time bar) but when it gets to the audio portion it stops responding and then I have to forcve quit.
    repaired persmissions, and delited the iDVD.plist
    any thing I can do? iDVD 6 is the first time I used this after update

    Scooper,
    iDVD is "not" slow (nor fast) encoding (actually transcoding) audio. iDVD relies on the Quicktime framework. iDVD invokes an external library from the set of resources provided by QT.
    If the encoding appears to be slow. It may find its root in various origins. First, MacOSX is a Unix system. Unix is not "preemptive". It means that access to resources occurs thanks to a "good will" mode between processes (to make things short). So, it may appear that some processes are stale, but things are usually well under control (by the kernel). So, don't be hasty in killing a process reported as "not responding".
    If you consider that the encoding process takes too much time, there are ways to make things better. First: More RAM. No workaround to that. Give some room to your Mac. Keep also in mind to keep free room on hard drive at least equal to 2 1/2 times the amount of RAM of your system. The Unix kernel of your Mac handles a "swap" that is used to virtually create an amount of RAM larger than what your system physically has. The kernel simply uses your hard-drive as buffer to store copies of RAM blocks occupied by portions of code or data not currently active. If all this is too small, the kernel will spend an awful amount of time dealing with the short space (RAM + free disk space for swap).
    One way to figure out if you're in such case is to use one of the many administration tools available to you. Open Terminal (or a X11 xterm) and type 'top' (without quotes).
    Check the last line of the header for the "pageouts" indicator. If the number in parenthesis is not zero (0), repeatedly, it means that your kernel is swapping memory block from the physical RAM to the virtual RAM stored on the hard drive (swapping).
    Hit 'q' to quit top. You can also try 'top -o cpu'. This will get you which process is currently running requesting the most CPU resources. Normally, on a Unix system, if one process needs CPU and is mostly the only one at the moment asking for CPU, it can be allocated most of the available CPU time and jumps to over 80%. If you consider this "abnormal", just look at the "Load Avg." indicator. It tells you how many processes are "waiting" for their turn to access the CPU - it's averaged throughout the time, through 3 numbers. Remember the "good will" mechanism. If it remains low (up to 3, for a household Mac), then, do not worry. If it goes above, then try to quit some other user applications. An idle system reports numbers below 1.
    These few sysadmin tips will tell you a lot about your system's health. Perhaps, you'll figure out by yourself what's wrong. For sure, not iDVD
    Try perhaps upgrading to QT 7. There are benefits to that.
    T.

  • While watching rented movie it stops during playback, how do i fix it?

    I rented a long movie and it continues to stop during playback, how do I fix that?

    Hi dedesgirl,
    Welcome to Apple Support Communities.
    It sounds like there is an issue playing songs in iTunes. Does the playback issue only occur with specific tracks and were they purchased from the iTunes Store? Take a look at the article linked below and try the suggestions which will resolve most iTunes and QuickTime Player playback issues.
    iTunes and QuickTime for Windows: Audio does not play or plays incorrectly
    http://support.apple.com/kb/TS1362
    I hope this helps.
    -Jason

  • Starting, stopping audio files

    Hi,
    I'm new to Flash and need some assistance. I'm working on a
    movie that is very simple. Or so it should be. The movie simply
    consists of three buttons: play, pause, and stop
    I did the usual thing for including an audio clip by:
    1. created a new layer and named it "audio"
    2. imported a wav file
    3. drag 'n dropped the wav file onto the audio layer
    Now, according to my documentation, I am supposed to assign
    actions to each of the button instances. For now I'm just working
    on the play and stop buttons. For each of these I assigned the
    actions play() and stop() methods respectively.
    When I play the movie, the audio clip starts, which is fine,
    but the buttons do nothing.
    What could I be doing wrong?
    Please advise,
    Alan

    ashiers wrote:
    > Hi,
    >
    > I'm new to Flash and need some assistance. I'm working
    on a movie that is
    > very simple. Or so it should be. The movie simply
    consists of three buttons:
    > play, pause, and stop
    >
    > I did the usual thing for including an audio clip by:
    >
    > 1. created a new layer and named it "audio"
    > 2. imported a wav file
    > 3. drag 'n dropped the wav file onto the audio layer
    >
    > Now, according to my documentation, I am supposed to
    assign actions to each of
    > the button instances. For now I'm just working on the
    play and stop buttons.
    > For each of these I assigned the actions play() and
    stop() methods respectively.
    >
    > When I play the movie, the audio clip starts, which is
    fine, but the buttons
    > do nothing.
    > What could I be doing wrong?
    the stop() and play(); won't stop sound unless you set it to
    stream but than you need
    to add as many frames as the sound length as stream is
    timeline based.
    By using stop(); and stopping timeline you will automatically
    pause the sound.
    And by play(); you will resume from the place you stopped it.
    If you don't want to use stream sound than you need to get
    into action script as
    stop() and play() simply won't do on such basic timeline.
    http://www.kennybellew.com/tutorial/
    Very detail tutorials on Sound in flash, from basic stop/play
    to complex,
    dynamic players with all kind of bells and whistles
    Best Regards
    Urami
    <urami>
    If you want to mail me - DO NOT LAUGH AT MY ADDRESS
    </urami>

  • IPhone won't stop playing - it's possesed!

    Every time I use the ipod functionality on my iPhone, the player goes completely haywire. It starts skipping tracks on it's own, and is completely unresponsive and won't stop playing. When I relaunch the application (by holding the home button), the ipod functionality relaunches itself and continues its fun game. When I reset, the same thing happens. A restore solved the problem (for an hour). Any suggestions?
    Bonus * Does the same thing during video playback.
    iPhone   Mac OS X (10.4.10)  

    You may have a defective unit especially if the same occurred shortly after a complete restore.
    Contact AppleCare or if there is an Apple Store nearby, I would head that way.

Maybe you are looking for

  • Duplicate artists appearing on my ipod

    I'm getting the same artist appearing five times under my ipod Artist menu. Whichever one of these I select I get the same identical full catalogue of tunes for that given artist that I have stored on my ipod. I've reinstalled itunes, I've restored m

  • Photograph metadata in Finder

    Windows Explorer in Windows 7 & 8 have a nice feature natively built into it, that is being able to do in-depth tagging of images/photos directly at the bottom of the window. I can't seem to find the same functionality in Finder. Does Finder/Lion not

  • Zigbee Wireless Boards - Do they work?

    Hey Archies, I have a question about Arch Linux and it's compatibility with Zigbee Wireless. I currently am dual booting windows because of the drivers for Zigbee which I need to develop for school. http://www.ti.com/tool/z-stack Is the Components. M

  • Iphoto causes "crash" upon exit

    Each time I exit iphoto6, After a minute of "nothing", the message to restart the computer manually comes up. I've run the disc utility permissions repair but it didn't solve this. I've deleted some slide shows and enhanced photos to shrink memory, b

  • Compare in JNDI

    A compare operation in JNDI is different from LDAP. Which is more efficient and why?