i am trying to add a sound wav to a button i created. I do believe i have done all the necessary code, however i cannot get the sound to play. Any help?
I've tried to add in the wav file linked to my button. using Audioserviceplay and create functions, but still no sound! Hello world, i am trying to add a sound wav to a button i created. I do believe i have done all the necessary code, however i cannot get the sound to play. Any help?
I've tried to add in the wav file linked to my button. using Audioserviceplay and create functions, but still no sound!
//
// ViewController.m
// Jets Soundboard
//
// Created by Daniel Bernardin on 2015-02-09.
// Copyright (c) 2015 Jets Sound. All rights reserved.
//
#import "ViewController.h"
#import <AudioToolbox/AudioToolbox.h>
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <CoreGraphics/CoreGraphics.h>
@interface ViewController ()
@end
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
[ super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (IBAction)TrueNorth:(id)sender {
CFBundleRef mainBundle = CFBundleGetMainBundle();
CFURLRef soundFileURLRef;
soundFileURLRef = CFBundleCopyResourceURL(mainBundle, (CFStringRef) @"TrueNorth", CFSTR("wav"), NULL);
UInt32 soundID;
AudioServicesCreateSystemSoundID(soundFileURLRef, &soundID);
AudioServicesPlaySystemSound(soundID);
}
@end
Aucun commentaire:
Enregistrer un commentaire