0

I followed the instructions in the read me file exactly, but for some reason, in my app, every time I hit the UIButton corresponding to the code to play the sound "[soundA play]; the app just crashes without any detailed error description except for lldb. I'm using Finch because it plays the audio using OpenAL, and I need to use OpenAL for the type of app I'm making because AVAudioPlayer or System Sounds are not usable for what I'm making. Here is the code that I am using.

Main file:

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
soundFactory = [[FIFactory alloc] init];
engine = [soundFactory buildSoundEngine];
[engine activateAudioSessionWithCategory:AVAudioSessionCategoryPlayback];
[engine openAudioDevice];
soundA = [soundFactory loadSoundNamed:@"1.caf" maxPolyphony:16 error:NULL];
soundB = [soundFactory loadSoundNamed:@"2.caf" maxPolyphony:16 error:NULL];
soundC = [soundFactory loadSoundNamed:@"3.caf" maxPolyphony:16 error:NULL];
soundD = [soundFactory loadSoundNamed:@"4.caf" maxPolyphony:16 error:NULL];
}

- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone) {
    return (interfaceOrientation != UIInterfaceOrientationPortraitUpsideDown);
} else {
    return YES;
}
}
- (IBAction) PlaySoundA {[soundA play];}
- (IBAction) PlaySoundB {[soundB play];}
- (IBAction) PlaySoundC {[soundC play];}
- (IBAction) PlaySoundD {[soundD play];}

@end

Header file:

#import <UIKit/UIKit.h>
#import "FISoundEngine.h"
#import "FIFactory.h"
#import "FISound.h"

@interface ViewController : UIViewController {
FIFactory* soundFactory;
FISoundEngine* engine;
FISound* soundA;
FISound* soundB;
FISound* soundC;
FISound* soundD;
}

@end

Any help would be appreciated! Thanks!

Chris
  • 452
  • 1
  • 7
  • 15

1 Answers1

0

Most likely the sound player cannot find your sound file. try right clicking on the audio file and selecting view in finder. make sure the file is actually in your project directory and not

FierceMonkey
  • 1,964
  • 1
  • 16
  • 22
  • The file is added to the project, copied into the project resources folder, and added to the target. I also ran some code to search for the files because I thought of this being the problem too, but the app can locate the files and play them with other audio frameworks, but I need to use OpenAL and Finch to play these. – Chris Aug 15 '12 at 01:01
  • Have you linked the UIButton to the button in your XIB file via the connections inspector in interface builder? – FierceMonkey Aug 16 '12 at 01:58
  • yeah, if it wasn't linked, then it wouldn't crash because it wouldn't be calling the method causing the app to crash – Chris Aug 16 '12 at 23:05