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 > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 07-08-2010, 10:24 AM   #1 (permalink)
Registered Member
 
Join Date: Jun 2010
Posts: 11
typhoch2 is on a distinguished road
Default Play random Sound on shake?

Hey I am building a fun app for me and my friends and I have some sound-files. I got my App working on my jailbroken Phone with only 1 sound, if I press the whole screen (1 Button on the whole screen). Now I want it to play a Sound, if I shake the Phone, but instead of that 1 sound play one of my 10 soundfiles.

I don't know how to detect, if the phone is shaking or not. Maybe somebody can give me an Example.

Here is my m-File of my App:

Code:
//
//  SoundViewController.m
//  Sound
//
//  Created by blackyE on 16.06.09.
//  Copyright __MyCompanyName__ 2009. All rights reserved.
//

#import "SoundViewController.h"

@implementation SoundViewController
@synthesize soundFileObject, soundFileURLRef;


-(IBAction)starteSound:(id)sender {
	AudioServicesCreateSystemSoundID ((CFURLRef)[NSURL fileURLWithPath: [[NSBundle mainBundle] pathForResource: @"lu" ofType: @"wav"]], &soundFileObject);
	AudioServicesPlaySystemSound (self.soundFileObject);	
}

- (void)didReceiveMemoryWarning {
	// Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
	
	// Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
	// Release any retained subviews of the main view.
	// e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}

@end
typhoch2 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 339
10 members and 329 guests
cgokey, EXOPTENDAELAX, GHuebner, Mirotion22, ohmniac, PavelSea, Pudding, SLIC, Sloshmonster, Sonuye857
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,653
Threads: 94,115
Posts: 402,888
Top Poster: BrianSlick (7,990)
Welcome to our newest member, ohmniac
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 10:26 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0