Help with audio

Discussion in 'iOS Programming' started by s8film40, Feb 20, 2010.

  1. s8film40 macrumors 6502


    Aug 14, 2007
    I've started my first iPhone application and I am learning a lot along the way, but now I seem to be stuck.
    For the application I am building I want to be able to play multiple audio files, and have four buttons to control playback, (Play, Pause, Next Track, and Previous track). I want the play button to start the first audio file and then play just the first file and then stop, I then want to be able to press the same play button again and then play the second file and so on. I came across what I at least thought might work well for this functionality here:

    I got this to work and it does a great job of playing the first track and then stopping (which is what I want). I can't seem to be able to get it to add the following tracks. when I put the code in for the additional track as the instructions at the bottom of the page say:
    [backgroundMusic close];
    	[backgroundMusic initWithPath:[[NSBundle mainBundle] pathForResource:@"nextTrack" ofType:@"caf"]];
    Instead it just plays the second track instead of the first.
    If anyone can figure out what I'm doing wrong I would greatly appreciate it.
  2. KoolStar macrumors demi-god


    Oct 16, 2006
  3. s8film40 thread starter macrumors 6502


    Aug 14, 2007
    How do I queue the audio?

Share This Page