Check if sound is playing

I want to discover if a sound object (e.g. 'myMusic') is
playing. I've tried the code at the bottom of this post:-
My idea was to call a function that checked the sound's
position twice and compared the two values. If they were different,
then the sound is playing. However it seems that interrogating with
'.position' doesn't give 2 separate values if done in quick
succession.
I basically want a return value that tells me if a sound is
playing or not.
Can anyone help please

Thanks for your help Noel,
The problem I'm having is I need my code to decide, almost
instantly, if a sound needs to be played or not. (within
milliseconds, not 2 seconds unfortunately)
It seems that a sound that's 10,000 milliseconds long will
have a position value of 0 before it's played and a value of 10,000
when it has finished. However if the sound was stopped somewhere in
the middle, the position value freezes at the point it was when the
sound stopped.
Later in the code, I want to start that sound again if the
sound isn't playing, but if it already is, then I don't want to
start it.
I can write an if statement to see if the sound hasn't been
played (mySound.position==0) or if it has reached the end
(mySound.position==mySound.duration) but if it was stopped mid flow
(so to speak) and the position value is 3045, for example, I can't
find a way of telling if the sound was stopped at 3045
milliseconds, or if it is currently playing and just happens to be
at 3045 ms.
I thought by checking the position at two separate intervals
(of a playing sound), then a few milliseconds will have lapsed
between statements and the values would be different. Unfortunately
they were exactly the same. :( So a playing sound would give the
same result as a stopped sound. I could put a delay in between the
two readings, but that would slow my animation down too much.
I've got over the problem by using boolean variables for each
sound that get set to 'True' when a sound is started, get set to
'False' using an .onSoundComplete command, or get set to 'False' if
the sound is stopped mid flow.
It's a bit of a clumsy way of doing it, but it seems to work
and it makes my if Statement a bit easier.
If someone else has a better way, then I'd be over the moon
to learn
Many thanks

Similar Messages

  • I no longer have sound when playing my clips through adobe premiere elements 12. How to I correct this problem? I have checked all audio levels and there is no mute on etc. I have updated to 12.1. Still no sound.

    I no longer have sound when playing my clips through adobe premiere elements 12. How to I correct this problem? I have checked all audio levels and there is no mute on etc. I updated to 12.1, but still no sound in any clips. Even not on old files which used to work.

    bfun
    What computer operating system is your Premiere Elements 12/12.1 running on? Can we assume that this audio plays back OK
    on the same computer when you are using a computer player independent of Premiere Elements?
    What are the properties of these clips that worked before but do not know with regard to sound
    For now, I will assume that you are working on Windows 7, 8, or 8.1 64 bit.
    Have you checked the Edit Menu/Preferences/Audio Hardware ASIO settings? Do you have any 3rd party audio devices incorporated in your computer environment?
    Please delete the Adobe Premiere Elements Prefs file and, if that does not work, then the whole 12.0 Folder in which the Adobe Premiere Elements Prefs file exists. The Windows 7, 8, or 8.1 64 bit path is
    Local Disk C
    Users
    Owner
    AppData
    Roaming
    Adobe
    Premiere Elements
    12.0
    and, in the 12.0 Folder, is the Adobe Premiere Elements Prefs file that you delete. If that does not work, then delete the whole 12.0 Folder in which the Adobe Premiere Elements Prefs file exists. Make sure that you are working with Folder Option "Show Hidden Files, Folders, and Drives" active so that you can see the complete path cited.
    Do you have installation files or installation disc with the purchased serial number in case we need to resort to uninstall/reinstall?
    We will be watching for your follow up.
    ATR

  • After downloading and installing additional content, no sound will play. Logic has no connection to sound library. No level meter activity. Right before i installed additional content I was working on a project, and everything was OK.

    After downloading and installing additional content, no sound will play. Logic has no connection to sound library. No level meter activity.
    Right before i installed the additional content I was working on a project, and everything was OK. What is wrong. How do I make Logic reconnect to the instrument files?

    Whitelab Records wrote:
    So, 20 views and nobody's anybody the wiser?
    A small update to this issue....
    I have been trawling the forums to find an answer but to no avail...
    And... I've tried exporting and bouncing individual stems and the full session, either by muting all bar the stem or soloing the stem.....and still nothing.
    Same problems.....everything is audible in audition but nothing plays on playback.
    Since the 'prelisten' channel strip is Solo safe this would indicate that you have a track or channel strip soloed somewhere else, out of sight. Are the Mute buttons on your channel strips blinking?
    To view all objects in your mixer, click the button. You may have to scroll sideways to check the whole mixer.

  • No sound when playing DVDs, yet fine with bluray

    my sony bluray does not have sound when playing dvds. it acts fine when using blu ray. any suggestions?

    Hello jc1942_69, thank you for your message. Welcome to SONY Community!
    For further assistance, please let us know with the model number of your Blu-ray disc player. As alternative, you can check the link below: http://esupport.sony.com/US/p/support-info.pl?info_id=264
    However, to troubleshoot your Blu-ray disc player in a general way. Follow the steps below:
    1. Turn the Blu-ray Disc player on and make sure the correct video input is selected on the TV.
    2. Press the Home button on the Blu-ray Disc player remote.
    3. Once the menu is displayed, press the Left arrow button on the remote and navigate to Setup.
    4. On Setup, use the Down arrow button and go to Resetting and press the Enter button.
    5. Under Resetting, select either Reset to Factory Default Settings or Initialize Personal Information.
    NOTES:
    Reset to Factory Default Settings option will display another menu where you can reset the current network, audio and video settings on the player, select All Settings if you desire to restore everything.
    Initialize Personal Information will erase all personal information stored on the player and some Internet apps.
    6. Go through each of the two options if you desire to completely restore the Blu-ray Disc player.
    Hopefully this post helps you! 

  • HT1349 No sound while playing music or in other programme but there is not problem to call

    No sound while playing music or in other programme but there is not problem to call

    Hello Koyirai
    If you are having issues with sound, check out the article below to troubleshoot the issue further with checking connections with any Bluetooth devices and checking the headset jack to ensure nothing is blocking access.
    iPhone: No sound or distorted sound from speaker
    http://support.apple.com/kb/ts5180
    Regards,
    -Norm G.

  • No sound effects playing through any output device

    Hi all. I have a frustrating issue with my late 2012 Mac Mini that started a couple of days ago. Maybe it is related to a system update (I think a OS and iTunes update was available last week) but I am not sure. Have checked that all preferences are correct (sound output, midi) and basically I have not personally altered any preferences whatsoever since I replaced my old HT receiver before Christmas.
    The issues. I have no sound effects at all playing either through HDMI (cable to Pioneer SC-LX56) or internal. No trash can, no start up, no nothing. I have no sound when playing Spotify or iTunes. I get sound in Plex HT but the navigation sounds are gone. Normal playback of any movie or music works as before.
    Anyone have any suggestions?
    Thanks,
    Roger

    Hi den.thed and thanks for your reply. Yes, all these are checked and togglig the various output devices I have makes no difference. As I said everything worked flawlessly up until a couple of days ago and no changes apart from Apple SW updates (OS and iTunes). My Plex Home Theater (the only working sound output means at this point, even though navigation sound in Plex HT has also stopped working) and Media Server apps are unchaged as well. All other HDMI inputs on my HT work.
    Further information. The volume icon in the menu bar is greyed out btw. I can toggle and see what output device is used but not change volume by sliding the bar. I am unable to change the alert or output volume as in your snapshot unless I chose internal speakers but this has no effect as there is no sound. I have looked into midi and it looks fine but I do not get speaker tones to test my speakers (I have not fiddled around in there before so what is there has been since i took the Mac mini into use). I have stopped the coreaudio process and rebooted but no difference. The only thing I have not done is  PRAM reset as far as browsing the Apple support community has taught me so far.
    I really appreciate all support here.
    Thanks,
    Roger

  • I can not get any sound while playing Flash content in IE, FireFox, or Chrome

    I have Windows 7, 64 bit.  I have ie 8, I think it is 32 bit, ("About ie" does not indicate 64bit).  
    I have unistalled Adobe Flash and re-installed, I have verified that I have the REG files under System32/ and SysWOW64/ (or whatever)...
    I installed Chrome after I have having this problem.  I have plugged my speakers into both the AudioJack in the back of machine, as well as in the headphone Jack.  I have tried just using headphones...
    I have gone to the 'configuration site' I have deleted Windows temporary files, I have deleted i.e. and FireFox files.
    I have checked multimedia setting in ie advanced tabs. 
    I have checked the sound volume in the 'Mixer'
    Sound works in my broser for Quicktime applications (like video on apples website).  Sound works everywhere else...playing music, Windows startup, speaker test, etc...
    I have worked on this for hours!!!  Please help.
    Thanks!
    -Bob

    Below are the Steps from:
    http://www.codecguide.com/fix_for_flash_sound_problems.htm
    And my results:
    Flash stores its files in a temporary files folder. A corrupt download can cause the sound problems.
    Delete the following folders:
    C:\Documents and Settings\%UserName%\Application Data\Adobe\Flash Player
    C:\Documents and Settings\%UserName%\Application Data\Macromedia\Flash Player
    Actually…Note that point 1 sould be %APPDATA%\Adobe\Flash Player%APPDATA%\Macromedia\Flash Player
    (Thanks willener)
    I completed this – No help
    Empty your temporary internet files.
    Internet Explorer: Tools -> Internet Options
    Firefox: Tools -> Clear Private Data
    Opera: Tools -> Delete Private Data
    I completed this – No help
    Empty your temporary files folder.
    Use this command to empty your temporary files folder:
    Start -> Run -> RMDIR /S /Q "%TEMP%"
    I completed this – No help
    Install the latest version of the Flash plugin. You can download it HERE. If you have problems upgrading the plugin, then uninstall your existing version first with this tool. Close your browser(s) before you run the uninstall tool.
    I completed this – No help
    Run the K-Lite Codec Tweak Tool. Near the top you should see an option to fix the sound (Midi, WaveOut). Select that and press Next. If the option is grayed out, then that particular registry fix is not needed. This fix will restore a missing "wavemapper" registry key.
    I completed this – No help
    Go to the Flash Player Settings Manager website. Click HERE.
    Check the box called "Allow third-party Flash content to store data on your computer."
    I completed this – No help
    Go to the Flash Player Settings Manager website. Click HERE.
    Click on the button to remove the data that the Flash plugins has stored for websites that you have visited.
    I completed this – No help
    Check if your sound device settings are correct:
    Start -> Settings -> Control Panel -> Sound and Audio Devices -> Audio
    This is not correct instructions for Windows 7. 
    Obviously I have checked sound settings in RealTek Audio manger several times. As well as in the mixer, and in the Internet Option Settings (Advanced Multimedia).  I checked setting under “Hardware and Sound” there is nothing there that has any effect.
    If you have QuickTime installed, then go to the QuickTime control panel. On the Audio tab, set "Default Music Synthesizer" to "General MIDI".
    On the Advanced tab, disable "Enable playback of Adobe Flash tracks".
    On the browser tab, click on "MIME Settings". Under "Miscellaneous", make sure "Flash media" is unchecked.
    These are not accurate options on my computer (Quicktime 7.6.9).
    Under Default Music Synthesizer.  There is no “general MIDI” only option is “Quicktime Music Synthesizer”
    Advanced Tab: “Enable playback of Adobe Flash tracks".is not an option
    Browser Tab: "Flash media" is not listed under MIME Settings (There is no Miscellaneous)
    Check if the file msacm32.drv is present in the C:\Windows\system32 folder. If not, copy it from another PC (that has the same version of Windows) and place the file in the system32 folder. If you are using a 64-bit version of Windows, then the file should be present in the C:\Windows\SysWOW64 folder.
    Verified these files are here.
    If you are also having sound problems with other applications, then re-installing your audio drivers might solve the problem.
    I am not having problems with other audio applications, but I still completed this – No help

  • Windows Server 2012 R2 RDWeb - Sound Not Playing

    Hello,
    I am trying to get sound to play on Internet Explorer which is published through RDWeb.
    I am using a sound test page which works fine (http://www.audiocheck.net/audiotests_stereo.php) locally but will not play sound through RDWeb.
    The Windows Audio and Windows Audio Endpoint Builder services are running on the Remote Session Hosts and Remote Web App server. The settings under "Collections > Remote Apps > Client Settings" are all ticked (Audio and Video Playback, Audio
    Recording etc). I haven't come across anything else online of settings to check.
    Does anyone know why this isn't working?

    Hi Chris,
    Thank you for posting in Windows Server Forum.
    Have you check the group policy setting related to audio redirection?
    Here I would like you to verify whether you have enabled Audio and Video Playback Gpo setting on RDSH server. 
    Configuration\Policies\Administrative Templates\Windows Components\Remote Desktop Services\Remote Desktop Session Host\Device and Resource Redirection
    Allow audio and video playback redirection: Enabled
    Allow audio recording redirection (For recording): Enabled
    Hope it helps!
    Thanks.
    Dharmesh Solanki
    TechNet Community Support
    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]

  • How to select which sound to play?

    I'm just getting started using the JavaScript SetVariable in
    my web pages to send information to a Flash movie. One thing I'm
    stumbling on however is how to specify which sound clip to play. I
    have a two layers on my timeline, one with sound A and the other
    with sound B. Based on a variable I set in the JavaScript, I'd like
    to mute one or play the other, or whatever works to get one to play
    and not the other.
    Can this be done? If so, how?
    Thanks from a Flash newbie,
    Beth

    you have very limited control over sound that's attached to a
    timeline. you could work around that by attaching your sounds to
    two different movieclips, but you would do better to use the
    actionscript sound class to control your sounds.
    in the flash help file check actionscript 2.0 language
    reference and check the sound class. you just need to create a
    sound object and read about the attachSound() and start() methods.
    you can then use an if-statement to determine with sound to
    attach to your sound object and solve your problem.

  • When watching a video on youtube, if the monitor blanks for power saving, when it resumes, the video area is green (not refreshed) but the sound keeps playing.

    Steps:
    1. Video is correctly playing on youtube
    2. Since I'm just watching and not pressing any key or moving the mouse, the display will blank for power saving after some minutes
    3. I move the mouse to wake it
    4. The video area is solid green, while the sound continues playing
    5. If I switch tasks, the area from the other task gets painted over the video area, it seems like the video are is never refreshed after the suspend/wake

    Hello,
    Some problems with Flash video playback can be resolved by disabling hardware acceleration in your Flash Player settings. (See [[Flash Plugin - Keep it up to date and troubleshoot problems|this article]] for more information on using the Flash plugin in Firefox).
    To disable hardware acceleration in Flash Player:
    #Go to this [http://helpx.adobe.com/flash-player/kb/video-playback-issues.html#main_Solve_video_playback_issues Adobe Flash Player Help page].
    #Right-click on the Flash Player logo on that page.
    #Click on '''Settings''' in the context menu. The Adobe Flash Player Settings screen will open.
    # Click on the icon at the bottom-left of the Adobe Flash Player Settings window to open the Display panel. <br/> <br/>[[Image:fpSettings1.PNG]] <br/>
    # Remove the check mark from '''Enable hardware acceleration'''.
    # Click '''Close''' to close the Adobe Flash Player Settings Window.
    # Restart Firefox.
    This [http://www.macromedia.com/support/documentation/en/flashplayer/help/help01.html Flash Player Help - Display Settings page] has more information on Flash Player hardware acceleration, if you're interested.
    Does this solve the problem? Let us know.

  • No sound when playing youtube videos

    I have run the troublshoot and checked for upgrades for my sound driver and I still have no sound when playing a youtube video.
    I can listen to radio over the internet fine.
    My laptop started doing this about 2 months ago when I was trying to finish my finals for class.
    Running windows 8. computer only a year old.
    HP Pavilion g7 notebook PC
    D1C20UA#ABA

    tcole2014 wrote:
    Tried this option several times and it did not make a difference.
    This solved my problem:
    In IE, go to Internet Options from the Tools drop down.
    Click on Advanced.
    Scroll down to Multimedia.
    Look for unchecked box for 'Play sounds in web page'
    Check the box.
    Get out of settings and IE altogether.
    Now try IE and see if it works.

  • I have no sound when playing music but ringtones and speak phone works!

    I have an iPhone 4s and all of a sudden I cannot hear any sound when playing music or watching tv etc via my phone but I can hear my ringtone and text etc and I can also hear calls if I place them on speakerphone!
    I have performed a hard reset and also plugged my phone into iTunes but this still hasn't solved the problem.
    Unfortunately my phone has a cracked screen....totally unrelated to the sound problem as everything was working fine after I dropped the phone, however, as I have been informed, this has now invalidated the warranty from apple, even though I am not asking them to fix the screen, just the speaker, therefor I am not entitled to a new phone from apple! Anyway.....if anyone out there can help me in anyway, or can suggest anything that I can try to fix this problem, please, please let me know.
    Many thanks in advance.

    My headphones work by the way.
    Also, when I try to increase, or decrease the volume when playing music or trying to listen to something....even my videos, the buttons on the side do not adjust the volume or attempt to adjust it. I have gone into settings and sound and made sure my phone is not on mute and made sure the setting is checked so that the buttons on the side control the volume! I just don't know what to do!

  • Random sound files play

    Recently, when changing tabs on Firefox, random sound files play. They sounded like PCH sound files so I contacted them. Their support team confirmed that this is a known bug and "would be fixed soon". I can find nothing on the web but few people would associate random Firefox sound files playing with a PCH infection anyway. I want to get rid of them now. Any solutions?
    Windows 8.1, HP Pavilion laptop using Firefox.

    PCH installed the file in FlashPlayer.
    Clearing Flash Cache killed the file and the problem.
    Here are the directions for doing that:
    If you are using a Windows machine running Internet Explorer, Firefox, or Safari:
    Click the "Start" button located in the bottom left hand corner of your screen.
    Windows 8 means a treasure hunt, or Cursor to top right corner, Settings, Control Panel
    Click on "Control Panel" (or depending on your system setup, "Settings" and then "Control Panel").
    Click on "Flash Player" (or "System and Security" and then "Flash Player").
    Click on the "Advanced" tab located along the top of the "Flash Player Settings Manager".
    Ensure the latest version of flash player is installed (click "check now" to verify which version you have installed).
    Click the "Delete All..." button located at the top of the "Advanced" section of the "Flash Player Settings Manager".
    Ensure that there is a checkmark beside the "Delete All Site Data And Settings" option.
    (IMPORTANT: leave the "Delete All Audio and Video License Files" option UNCHECKED).
    Next, click the "Delete Data" button located in the bottom right hand corner of this window.
    Close the "Flash Player Settings Manager".
    Close the "Control Panel".
    Restart your browser
    If you are using Google Chrome please follow the below instructions:
    Click on the following link to navigate to Adobe's online Flash Player Settings Manager.
    Click on the "Delete all sites" button.
    Restart your browser.
    To clear the Flash Player cache on a Mac, please follow these steps:
    Close your web browser.
    Click on the Apple logo in the upper, right-hand corner of your screen and choose "System Preferences"
    Click on the "Flash Player" icon near the bottom of the System Preferences window.
    Under the "Storage" tab, click on the "Delete All" button.
    On the next window, make sure the "Delete All Site Data and Settings" option is selected and unselect the "Delete All Audio and Video License Files" option.
    Click the "Delete Data" button.
    Close the System Preferences window.

  • Crackling and popping sound when playing music and watching youtube videos

    there is a crackling and popping sound when i watch videos on youtube or play music/videos  using vlc media player  and windows media player. recently it has gotten to a point where it happens when windows is starting up or even when the laptop is required to play a sound for example when i plug in a removeable hardware such as thumbdrives

    Hi @donnabail ,
    Thank you for visiting the HP Support Forums and Welcome. I have read about your HP 2000 Notebook and getting a buzzing or popping sound while playing music and watching Youtube videos. Try performing a hard reset.
    When performing a hard reset please note remove any and all USB devices. Disconnect all non-essential devices.
    You can do a system restore. System restore will help if something automatically updated and did not go well on the Notebook that might have caused this.
    You can try this
    1. Right click the Speaker icon in the bottom right corner.
    2. Click Playback Devices.
    3. Click Speakers.
    4. Click properties.
    5. Click the advanced tab on the Properties window.
    6. Change the Default Format drop-down to the highest quality.
    7. Apply the properties.
    8. Click OK to close the properties window.
    What happens if you right click on the video while playing a video and take the check out of hardware acceleration. Shut the browser down and restart the notebook.
    Have you checked for an update on the Active X.
    Please let me know how this goes.
    Thanks.
    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 to say “Thanks” for helping!

  • Lost all my sound when playing movies and shows from internet

    i seemed to have lost all sound when playing movies from internet.  i still have "system" sounds and beeps?

    The speaker is not that good but maybe yours is defective if you have the volume fully raised.
    - Try cleaning out/blowing out the headphone jack. Try inserting/removing the plug a dozen times or so. There is a little switch in the headphone jack that disconnects the speaker when the headphone jack is inserted and have a poor contact.
    Try the following to rule out a software problem
    - Check also Settings > General > Accessibility > Hearing. Make sure that the sound balance is not set all the way to "R" or "R".
    - Reset the iOS device. Nothing will be lost
    Reset iPod touch: Hold down the On/Off button and the Home button at the same time for at
    least ten seconds, until the Apple logo appears.
    - Reset all settings
    Go to Settings > General > Reset and tap Reset All Settings.
    All your preferences and settings are reset. Information (such as contacts and calendars) and media (such as songs and videos) aren’t affected.
    - Restore from backup
    - Restore to factory settings/new iOS device.
    - Make an appointment at the Genius Bar of an Apple store. Seems you have a bad headphone jack or other hardware problem.
    Apple Retail Store - Genius Bar

Maybe you are looking for

  • HELP! Cannot copy files off Time Capsule

    I have a 1TB Time Capsule (DualBand) that I use like a NAS (network attached storage). Time Machine is disabled, but I manually copy files on the Time Capsule's disk when I want to back them up, and share them with other computers in my house. I am t

  • Can I update directly from iPhoto 8.1.2 to 9.3.2 without problems?

    I'm not sure whether to  update  from my iPhoto 8.1.2 straight to the update of iPhoto 9.3.2 or should I go update to update? The updates I found after my 8.1.2 are 9.1,  9.1.1 9.1.3 9.1.5 9.2.1 9.2.2 9.2.3 9.3 9.3.1 9.3.2

  • What is the best desktop for me?

    I have to buy a new desktop. I want to know what is best for me. I maily use Word. is it all just a matter of screen size or is there something else to take into account?

  • Can the profit center on a cost center be changed?

    Hello experts, We have been using cost centers and profit centers for a few years now. Now the client has decided to change the coding structure for profit centers. My question, is can profit centers (mapped to cost centers) be changed at this point?

  • Select userinfo in xMII version 12

    Hi. Is it possible to get / select user information in xMII version 12? E.g. username, email and so on for users created within NW user management? BR. Poul.