Results 1 to 2 of 2
  1. #1

    Member Since
    Mar 09, 2012
    Soundboard problem please help
    Hey guys I'm having a small problem connecting the code for the sound to the button.

    I created a project "Tabbed application" and then i added an image to the first and second view, then i added audio.toolbox.framework in the "link binary with library" section under build phases section. Then created round rect buttons and put them where they needed to be. Heres when the problem starts, when i click on one of the buttons and press ctrl a light blue line appears and i drag it to the code for that button in the .m file but it won't connect to it nothing happens. Could somebody please help me with this ?

    Here the code i wrote for the button but I'm pretty sure its fine
    -(IBAction)sound1 {
        CFBundleRef mainBundle = CFBundleGetMainBundle();
        CFURLRef soundFileURLRef;
        soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"sound1", CFSTR ("wav"), NULL);
        UInt32 soundID;
        AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);

  2. #2

    Mark FX's Avatar
    Member Since
    Aug 13, 2011
    West Sussex, UK
    The implementation of your IBAction method is incorrect, all IBaction methods should
    follow the example below.

    //in your .h interface file you should declare your IBAction method like this
    - (IBAction)methodName:(id)sender;
    //In your .m implementation file you then implement the above method like this.
    - (IBAction)methodName:(id)sender
          //Your code goes here
    In your example, your missing the (id)sender part of the declaration, which every
    IBAction method should have.

    Save the files before moving over to Interface Builder, then control drag from the Button to
    the controller class's Object cube, and select the IBAction method.

    Also I noticed your using the AudioToolkit Framework for your sound playing methods, if
    your only wanting to play short system type sounds, or audio files in a simple playback
    utility, you might want to consider the NSSound class.

    Hope this helps.

    Regards Mark

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Digital Soundboard
    By ThePowerUp in forum Music, Audio, and Podcasting
    Replies: 0
    Last Post: 10-03-2014, 05:48 PM
  2. outlook 2011 problem problem problem
    By knfall97 in forum macOS - Apps and Games
    Replies: 0
    Last Post: 03-13-2011, 12:16 AM
  3. Replies: 0
    Last Post: 03-08-2010, 08:13 PM
  4. Extracting audio from flash-based web soundboard
    By sibradbury in forum Music, Audio, and Podcasting
    Replies: 1
    Last Post: 08-31-2008, 01:00 PM
  5. Fried Soundboard or Soundcard ? ?
    By Geoff J in forum Apple Notebooks
    Replies: 0
    Last Post: 04-03-2007, 02:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts