adding sound, a to do list….
(sorry this is fairly complex)
in projectview: frameworks -> add existing framework audiotools
copy from another template from this blogs (template4, project Sounds2) the folder sound from this project into your own project
in your own project search for the …AppDelegate.h into the list of files, add the following sentences on the corresponding places:
#import <UIKit/UIKit.h>
@class SoundButton2ViewController;
//this line under import and or class:
#import "ShortSound.h"
@interface PagingScrollViewAppDelegate : NSObject <UIApplicationDelegate> {
UIWindow *window;
SoundButton2ViewController *viewController;
//this line:
ShortSound* soundEngine;
}
//this line:
@property (nonatomic, retain) ShortSound* soundEngine;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet SoundButton2ViewController *viewController;
@end
then in the corresponding AppDelegate.m
under the line:
@implementation ….AppDelegate
//add this line:
@synthesize soundEngine;
then where you want the sound:
in the headerfile (.h) add:
#import "PagingScrollViewAppDelegate.h"
in the sourcefile (.m)
create a variable: referring to the AppDelegate mentioned above:
PagingScrollViewAppDelegate *appDelegate = (PagingScrollViewAppDelegate*)[[UIApplication sharedApplication] delegate];
[appDelegate.soundEngine playSound : @"sis" ]; //this line actually plays the sound
and finally the last line plays the sis.cav file.
This sis.cav file , for testing , can be copied from the sound template.
How to get a .cav file is explained in Mobile Design 3. (Using terminal window and afconverter)
To change the sounds, make new sounds, drag these sounds in the project, and change the names of the soundfiles in the ShortSound.m file:
