IPhone (Cocoa Touch) Button that plays sound file on click?

Hello.
I am trying to create a button that, when clicked, it plays a given sound file in the app's filesystem.
This is what I have set up thus far:
Regular Rectangular button -> connected to NSObject Called "sounds" -> with the Event "playsound1" chosen as the event.
I then wrote the class files, brought them into Xcode file project under classes, and now I'm staring at sound.h and sounds.m with no idea what to do next.
I was able to create in a regular Mac OSX Cocoa, a button that plays the system beep using NSBeep. However, I don't know how to achieve this similar objective with using a given sound file in the iPhone Cocoa Touch.
Thanks

I have tried so many things. I'm so lost.

Similar Messages

  • How do you open/play a .wav file (music file) without play sound file .vi

    I am having big problems to create a music background for my project. I am newbie using labview and maybe my questions is not so dificult to solve (I hope so)
    I was using play sound file vi but the problem is that I dont want the music file start automatically. I wanna control the start time using a button. I tried include a sound output stop but when the app start and I add more wav files in my vi, the sound file start, then stop abruptally because the stop vi and the everything is normal. I would like to eliminate that error.
    Someone have any idea, maybe using open file or another way. 
    Thanks in advance
    I add a screenshot of my vi and also the vi in this post
    Attachments:
    test sound.vi ‏11 KB

    I leave an example that can provide, use it in your program
    Atom
    Certified LabVIEW Associate Developer
    Attachments:
    playsound.zip ‏58 KB

  • Error while playing sound file in Applet

    Hi!!
    I am trying to play sound file in the applet which produces sound continuously, when it goes above certain set value. When i run the sound file individually it runs perfectly fine but when i try to call that class in diff. program its giving me some security error..i am trying to solve this problem from last so many days..i dont know whether i have to make some change in Security file policy or java policy..the error is like..
    java.security.AccessControlException: access denied (java.util.PropertyPermissio
    n user.dir read)
    at java.security.AccessControlContext.checkPermission(AccessControlConte
    xt.java:269)
    at java.security.AccessController.checkPermission(AccessController.java:
    401)
    at java.lang.SecurityManager.checkPermission(SecurityManager.java:524)
    at java.lang.SecurityManager.checkPropertyAccess(SecurityManager.java:12
    76)
    at java.lang.System.getProperty(System.java:573)
    at SoundApplication.startLoadingSounds(SoundApplication.java:52)
    at SoundApplication.<init>(SoundApplication.java:42)
    at TempSet.actionPerformed(TempSet.java:103)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:17
    86)
    at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(Abstra
    ctButton.java:1839)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel
    .java:420)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:258
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonL
    istener.java:245)
    at java.awt.Component.processMouseEvent(Component.java:5100)
    at java.awt.Component.processEvent(Component.java:4897)
    at java.awt.Container.processEvent(Container.java:1569)
    at java.awt.Component.dispatchEventImpl(Component.java:3615)
    at java.awt.Container.dispatchEventImpl(Container.java:1627)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3483
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:3198)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:3128)
    at java.awt.Container.dispatchEventImpl(Container.java:1613)
    at java.awt.Window.dispatchEventImpl(Window.java:1606)
    at java.awt.Component.dispatchEvent(Component.java:3477)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:456)
    at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchTh
    read.java:201)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThre
    ad.java:151)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:145)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:137)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:100)
    Please suggest some solution for this..its kinda urgent..
    Thanks in advance.
    Regards,
    Amish

    Are you loading your Applet from a webserver? You could make the sound file available through the same webserver.
    Alternatively, you could package the sound with the code in a JAR. It does mean a bigger download for your Applet users though, but the Applet would be able to access the file quickly.
    If you put your file in the JAR, say in /sound/myfile.ext , then you can get access to it from your code like this:
    URL soundURL = getClass().getResource( " /sound/myfile.ext" );

  • What's the best solution for audio out of sound files from a MacBook Air to both an amplifier and to a subwoofer amplifier? I'm using the MBA to play sound files for worship services at our church.

    I have a MacBook Air (13", 1.7GHz, 8GB RAM, 500GB SSD) that I'll be using to play sound files (primarily organ and piano) for worship services at my church. We'll be using a QSC RMX2450 650 Watts/Channel amplifier with Community CPL-27 speakers and also a JBL SUB 250P powered subwoofer with its own amplifier. What's the best option for getting sound out from the Mac to both of these amplifiers? 

    if you work with own recorded sounds you might wanna have a music program where you want to work with samples, steinberg has got very good ones (so they say)... but their really really ( ²) expensive(that's why almost no one haves them), magix haves good ones too bu their more for 'unprofessional' use, ableton haves really good ones too and they're not to difficult to use (if you know a bit of those programs you learn very quickly) and if you don't get them, there is a sort of manual built in it which explains and lets you do things to start (basics)
    i hope this helped, btw stereo speakers are always better if you buy good ones (no pc speakers), but if you don't think you need them, don't buy them...
    so again, i hope you have some ideas now

  • Today,when i tried to listen music in my iphone 5 ,i noticed that my sound wasnt coming from the speakers but when i plugged earphone ,i listed the sound??

    today,when i tried to listen music in my iphone 5 ,i noticed that my sound wasnt coming from the speakers but when i plugged earphone ,i listened the sound?? i couldnt recognize the problem with my iphone?? really need help!!

    I am having the same problem. I have just tried this. Unplug iphone > open itunes > delete all music from itunes library > close itunes > re-open itunes > add music from original folder > plug in iphone > select songs > press sync > unplug iphone using eject button onscreen > checked phone .... still nothing in music folder on phone. On itunes the "On this iphone" tab the songs remain there but greyed out.

  • Unable to load/play sound files using SoundEngine_LoadEffect

    Hi All,
    I am able to load/play sound files using SoundEngine_LoadBackgroundMusicTrack but unable to load/play sound files using SoundEngine_LoadEffect on iPhone Simulator. I am using the SoundEngine.h/cpp from Crash Landing. Oddly enough sound effects load and play succesffully when i start the app with 'Start with Performance Tool'. Does anyone know what is actually going on.
    Also i would like to know what is the difference between playing sound files using these two methods. What are the restrictions on individual sound file types for each method.
    Thanks

    I was able to load/run the sound effects after using Simulator - iPhoneOS 2.1 in the Active Target/Build drop down on Xcode toolbar. Both Active SDK, and Active Executable should be 2.1 in order to play the sound effects.

  • Interactive play sound file.vi crashs labview

    While playing with a *.wav file to perform an FFT on the data, I tried running this VI. Labview then crashes. No error.

    Which version of LabVIEW are you using?  I'm using LabVIEW 2011 SP1, and I ran the "Interactive Play Sound File.vi" from the example finder and the VI worked for me.  
    Are you just trying to play a sound file in your own VI?  If so, the DLL library call from the example could be causing the crash.  It could also be that your program isn't crashing, but just terminating before your sound file has a chance to play.
    There is an easier way to play a sound file, just use the "Play Sound File.vi".  You may also need to use the "Sound Output Wait.vi" to prevent your LabVIEW program from terminating before the sound has a chance to play.  I've attached a picture of the setup I'm refering to.
    Product Support Engineer
    National Instruments
    Attachments:
    sound_snippet.png ‏14 KB

  • I have iphone 4s 32GB ,the volume of the ringer and alerts can't be adjusted using the volume buttons and lock sounds and keyboard clicks available, but all not appear ??!!!!!!!

    I have iphone 4s 32GB ,the volume of the ringer and alerts can't be adjusted using the volume buttons and lock sounds and keyboard clicks available, but all not appear ??!!!!!!!

    Hi nitramred,
    To start troubleshooting this issue where you are unable to adjust the volume after receiving a call, please go ahead and first force close all of the apps currently running on the device, and then reset it by following the steps in the articles below.
    iOS: Force an app to close
    Turn your iOS device off and on (restart) and reset
    Take care,
    Alex H.

  • Help on Play Sound File.vi - file format

    Hello,
    My request is quiet simple but I don't understand why it doesn't work.
    I want read a .wav sound file with the Play Sound File vi. But when I run the vi, an error message appears " Cannot recognize sound format"
    I have tried with different .wav sound files but nothing works.
    Do you know why this error happens ?
    Thanks
    Attachments:
    Sound_Labview.png ‏142 KB

    Ok thanks.
    Since the last time I posted I've tried many other wav sounds but nothing works I still had the same Labview error.
    I join you few of my wav files and maybe you can try it.
    Thanks
    Attachments:
    wav.zip ‏160 KB

  • How do I tell Apple to fix their software like apps that play sound even though the sound is turned off and not being able to disable features you hate like game center

    Apple is suppose to be the pinnacle of usability and, yet, I want to throw my new IPhone 4s as far as I can and watch is smash into a million pieces on concrete. Seriously, I've already got three things that irritate the **** out of me. First, there are Apple apps that insist on playing sound even though the sound is turned off. If I flick a switch to turn the sound off, I want the sound off!!!! Second, if I do not want a totally unnecessary feature like Game Center, I should be able to disable it. I completed most of the Angry Bird levels with 2 or 3 stars and now I have to start over from square one. Maybe, this happened when I upgraded to the 4s but it sure seemed to happen when I joined Game Center. Tomorrow, I am going to reset my 4s to factory defaults to try to get rid of my Game Center account. I don't want Game Center! I do need Game Center! I hate Game Center! Finally, I had an alarm go off to wake me up and there was a Snooze button but no button to turn the alarm off. I flicked the slider to access the main screen expecting to see something to turn the alarm off but there was nothing. The alarm just kept alarming. I had to warm boot my IPhone to shut the alarm off! Really, Apple!!!!

    The sound is turned off. Only, some Apple apps like YouTube and Siri make sound when the sound is turned off. It is very embarrassing when this happens at work. My question was how do I tell Apple to fix this?
    Turning off game center does not work. The games just prompt me to sign in when they are started.I have tried everything I can find online to stop this behavior. It is annoying and should not happen. My question was how do I tell Apple to fix this?
    The alarm went off. There was a green thing that looked like a button but pressing it did nothing. There was a red button that said snooze. I did not want to snooze. I wanted to turn the alarm off. I slid the bar to unlock the phone and there were no running apps with a button to press. The alarm just keep running. I have not had this problem since it first occurred. The alarm now shuts off when I just unlock the phone. It may have happened because I had another alarm app running. The two may have interfered with each other. I would like to tell Apple about it.
    It also annoys me that the button that closes apps leaves the phone app running. If I press on a number at 6:00 AM to get information about who called me, the phone automatically dials the person back and my natural reaction is to press on the button to close the phone app but the phone keeps dialing this person at 6:00 AM. It is a bad design. I would like to tell Apple about it.
    Finally, I looked all over Apple's site to try to find someplace I could send them a polite message to let them know that I was not happy with these "features" but could not find anything. It is extremely frustrating to have issues with a product and not being able to tell the manufacturer about it. So, you grow up!.
    When trying to fix the Game Center issue, I saw a link someone posted to report issues with the IPad to Apple. The answer I am looking for is where is the link to report issues with the IPhone.

  • 1.1.3 - iPod Touch video podcasts play sound; only still image

    For some strange reason, since getting the new update (but not the January update as I'm not going to pay £13 for that!) for my iPod Touch, video podcasts of trailers downloaded from Apple Trailers through iTunes play as sound files with a random frame from the video appearing as album art.
    So if I turn my iPod Touch horizontal, the single image shows up at the end of Cover Flow as audio podcasts do when being played. However, there is no video at all. Normal videos play fine.
    What the **** is going on?

    Oh ... I'm so stupid. Sorry - when I wrote that they don't show up under VIDEO, I didn't actually check.
    They are there and they do work. In fact, I think that as long as people like me remember which is which, having videos only play audio when played from the PODCASTS section is quite useful in some circumstances.
    I've learnt my lesson.
    Now if only I could get that update for free ...

  • Audition CS5.5 Won't Play Sound Files

    Just recently I have not been able to play any files that I have loaded.  In the bottom left hand corner, it notes that the file(s) is either playing or stopped when I press play on the transport, but the cursor won't move and sound will not come out.  Below is the screen shot that I think might be the culprit, but I am not totally sure. I am using Audition CS5.5 on an iMac.  Thougths?

    Well, that's certainly a clue--Audition isn't finding your sound card.  You don't say what you have but the first thing I'd try is reloading your sound card drivers.
    Also, on the other Preferences menu (Audio Hardware) check that you have the proper sound card and driver class selected.
    Finally, depending on what version of Windows you have, it might be worth going to the Windows Audio menu and check that Windows hasn't disabled the device you wish to use for some reason.

  • JMStudio locks up playing sound file - using java 1.5.0_02 - HELP!

    I'm using the jmf 2.1.1e cross platform version on Windows XP SP2. I have java 1.5.0_02 installed.
    When I open the sound file using JMStudio it locks up. It plays videos that don't have sound fine, so it's not the video. It's the sound that is killing it.
    Does anyone have any suggestions?

    Hi,
    yeah it's possible to play sound on Windows but you have to use the Windows Performance Pack instead of the crossplatform-version of JMF.
    This has to do with the JavaSound Architecture of Java 5.0. They made changes and now the JavaSound Renderer didn't work under Windows but the DircetSound Renderer works fine.
    So be sure that your application uses the DirectSound Renderer!
    This is one of the main problems of JMF but now Sun gets interested in JMF and they would build a new version of JMF. If this is true they have to fix this problem!
    Best regards, thomas

  • Button trigger a sound file?

    I know about controller files, but I just am trying to get an audio file to play from a button instance in InDesign DPS. The audio won't play or it pulls up the Adobe Viewer panel in the app onClick. Do I need to somehow embed the file? How does iPad recognize onClick vs onRelease thanks.

    You cannot trigger sound with a button. Create the artwork and place the sound file with no poster above it.
    Bob

  • How to play sound file on HTML

    I have successfully able to record voice and save it into the database and replay it. Also able to store an external wave file and replay it using forms.
    I need to play the same soundfile from database on HTML using PL/SQL.
    Would appreciate if someone can support my problem. I need to know the package to read and play the database column storing sound.
    Thanks and Regards,
    Vipul

    Hi Vipul,
    Great to know that you could record a sound file and save it in Oracle and play it through Forms. We are having a similar requirment. Could you please list down the steps of exactly how did you achieve this ?
    It would be of great help to us if you can clear us the same. Thanks in Advance.
    Thanks,
    Karthik.

Maybe you are looking for

  • Unable to get the admin object for the CsContainerAdmin service

    Hi, On AIX, we deployed XIR2 SP2 --> XIR2 SP3 --> SP3 Productivity Pack. The Conection server does show up on the server list in the CMC, but on trying to access this server, it throws an error" Unable to get the admin object for the CsContainerAdmin

  • Is my battery life the same as when I first got my ipod?

    I've had my iPod for a couple months, I've noticed that the battery life seems weaker and dies out quicker now. Am I just thinking this, is my battery life the same as when i first got my iPod?

  • Problems adding videos to my SLVR L7

    I was wondering how I could get videos to run with my Cingular SLVR L7 itunes. I have converted the files to mpeg4 but still can't get itunes to transfer them to my phone and clicking and dragging directly to the phone just puts the file there and do

  • Website Data Organization?

    When you go into settings on the Ipod Touch, click Safari, and go to the Advanced Settings, is the website data organized by data usage? Is there not a way to view when the website was visited?

  • Very urgent - Parsing stored procedure error !!!

    Hi, We tried to migrate a SQL server 7 database to an Oracle 8.1.7 database using the migration workbench. We had successfully captured the SQL server source model. But when we tried to create the Oracle model, the following error occurred for some s