title: playing a sound, waiting it to finish playing and continue (iphone)
body: <p>i'm new with the iphone and objective c, so far, I have been able to code some small examples.</p>
  
  <p>i would like to play a sound and, continue with rest of the code when the sample finishes playing, i.e:</p>
  
  <pre><code>printf("hello");
  playASound["file.wav"];
  printf("world");
  </code></pre>
  
  <p>actually i'm getting: print hello, play the file and print world at the same time
  but 
  what i want is: print hello, play the file, print world... 
  so, the question is how do i get it?</p>
  
  <p>thanks</p>
  
  <p>btw. here is the playASound code:</p>
  
  <pre><code>-(void) playASound: (NSString *) file {
  
      //Get the filename of the sound file:
      NSString *path = [NSString stringWithFormat:@"%@/%@",
                        [[NSBundle mainBundle] resourcePath],
                        file];
  
      SystemSoundID soundID;
      //Get a URL for the sound file
      NSURL *filePath = [NSURL fileURLWithPath:path isDirectory:NO];
      AudioServicesCreateSystemSoundID((CFURLRef)filePath, &amp;soundID);
      //play the file
      AudioServicesPlaySystemSound(soundID);
  }
  </code></pre>