title: Pick songs from plist(NSArray) and play using AVAudioPlayer?
body: <p>I'm student working on a coding exercise and I am stumped!</p>
  
  <p>I have two instances of AVAudioPlayer in my app - I can load the songs into each player using a direct path no problem.  </p>
  
  <p>What I'd like to be able to do is play multiple songs held within an array on each player.</p>
  
  <p>Is this possible? and if so how would I go about doing this?</p>
  
  <p>In my plist I have the key set to "One.mp3" as a string and the value as the path to the file...  (was guessing at that part).</p>
  
  <p>Thanks for any insight.</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      //multiple song array
  
      NSString *soundsPath = [[NSBundle mainBundle] pathForResource:@"soundslist" 
                                                             ofType:@"plist"];
  
      soundsList = [[NSArray alloc] initWithContentsOfFile:soundsPath];
  
      NSString* filename = [soundsList objectAtIndex:0];
      NSString *path = [[NSBundle mainBundle] pathForResource:filename 
                                                       ofType:@"mp3"];  
  
      AVAudioPlayer * newAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:[NSURL fileURLWithPath:path] 
                                                                      error:NULL];  
      self.audioPlayer = newAudio; // automatically retain audio and dealloc old file if new file is loaded
  
      [newAudio release]; // release the audio safely
  
      audioPlayer.delegate = self; 
      [audioPlayer prepareToPlay];
      [audioPlayer setNumberOfLoops:0];
      [audioPlayer play];
  }
  </code></pre>