Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum

View Single Post
Old 08-14-2009, 06:17 PM   #2 (permalink)
blackyE
Registered Member
 
blackyE's Avatar
 
Join Date: Aug 2008
Location: Germany
Posts: 78
blackyE is on a distinguished road
Default

try this!

Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AVFoundation/AVAudioPlayer.h>

@interface MainView : UIView {
        
        AVAudioPlayer *theAudio;

}

-(IBAction)sound1;
-(IBAction)stop;

@end

MAIN:

#import "MainView.h"

@implementation MainView

- (IBAction)sound1 {

NSString *path = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
AVAudioPlayer* theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPathath] error:NULL];
theAudio.delegate = self;
[theAudio play];

}

- (IBAction) stop {

[theAudio stop];

}
blackyE is offline   Reply With Quote
 

» Advertisements
» Stats
Members: 175,024
Threads: 93,868
Posts: 401,934
Top Poster: BrianSlick (7,964)
Welcome to our newest member, davincic
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 11:37 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.