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