Hi guys I've just submitted an assignment for uni work, it was only required for app to work in iOS simulator but i liked the app and wanted it on my phone however its really slow! any suggestions much appreciated.
Heres my app delegate.m ---------------
#import <PAEEngine/PAEEngine.h>
#import "AppDelegate.h"
@interface AppDelegate ()
@property PAEAudioHost* host;
@end
@implementation AppDelegate
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.host = [PAEAudioHost audioHostWithNumOutputs:2]; //creates a stereo output using audio engine
self.filenames = @[@"Sounds/FX/R1blaster1.wav", //sound sample array
@"Sounds/FX/R1blaster2.wav",
@"Sounds/FX/R1blaster3.wav",
@"Sounds/FX/R1blaster4.wav",
@"Sounds/FX/R1blaster5.wav",
@"Sounds/FX/R1saber1.wav",
@"Sounds/FX/R1saber2.wav",
@"Sounds/FX/R1saber3.wav",
@"Sounds/FX/R1saber4.wav",
@"Sounds/FX/R1saber5.wav",
@"Sounds/FX/R1saber6.wav",
@"Sounds/FX/bombrx.wav",
@"Sounds/FX/Alarmrx.wav",
@"Sounds/FX/wilhelmrx.wav",
@"Sounds/FX/tie2rx.wav",
@"Sounds/FX/tie3rx.wav",
@"Sounds/FX/ship1rx.wav",
@"Sounds/FX/ship2rx.wav",
@"Sounds/FX/ship3rx.wav",
@"Sounds/FX/mayhemrx.wav",
@"Sounds/Themer1.wav",
@"Sounds/Imperialsongr1.wav",
@"Sounds/Characters/Ewokr3.wav",
@"Sounds/Characters/Ewokscreamr3.wav",
@"Sounds/Characters/Chewyr1.wav",
@"Sounds/Characters/jabbar1.wav",
@"Sounds/Characters/R2ar1.wav",
@"Sounds/Characters/c3porx.wav",
@"Sounds/Characters/R2screamr1.wav",
@"Sounds/Characters/trooperrx.wav",
@"Sounds/Characters/vaderbreathr1.wav",
@"Sounds/Characters/vaderdarkside.wav",
@"Sounds/Characters/vaderr1.wav",
@"Sounds/Characters/yodar1.wav",
@"Sounds/Characters/leiarx.wav",
@"Sounds/Characters/lukerx.wav",
@"Sounds/Characters/hanrx.wav"];
self.chaelStrips = [[NSMutableArray alloc] initWithCapacity:self.filenames.count]; //sets number of chael strips
//to amount of samples
for (int i = 0; i < self.filenames.count; ++i)
{
PAEChaelStrip* chaelStrip = [PAEChaelStrip chaelStripWithNumChaels:2]; //sets PAE engine parameters to
PAEAmplitude* amp = [PAEAmplitude amplitudeWithNumInputs:2]; //variables
PAEControl* levelControl = [PAEControl controlWithValue:0.35]; //tus down amplitude to prevent clipping
amp.level.input = levelControl;
chaelStrip.inserts = @[amp];
[self.chaelStrips addObject:chaelStrip];
}
self.host.mainMix = [PAEMixer mixerWithSources:self.chaelStrips]; //creates master mix of all parameters
[self.host start];
retu YES; //makes sure to retu the process to start
}
-(void)playSound:(NSInteger)index // sound trigger function
{
if (index < 0 || index >= self.filenames.count) //if statement that retus signal value
retu;
PAEChaelStrip* strip = self.chaelStrips[index];
PAEAudioFilePlayer* player = [PAEAudioFilePlayer audioFilePlayerNamed:self.filenames[index]]; //enables file player
player.loop = NO; //makes sure sound doesnt loop
strip.input = player;
}
@end
