title: Swift - Have an audio repeat, but it plays in intervals?
body: <p>In <strong>Swift</strong>, I play a song, it plays at the viewDidLoad. It is 16 seconds long, and it plays all 16 seconds. I want it to repeat forever. I made an <code>NSTimer</code> where every 16 seconds, it plays the song. But, it plays 16 seconds when the app loads, stops for 16 seconds, plays, etc.</p>
  
  <p><strong>The line</strong> <code>println("just doing some dandy debugging here.")</code> <strong>does print every 16 seconds.</strong></p>
  
  <p><strong>How is this fixed?</strong></p>
  
  <p><strong>CODE:</strong></p>
  
  <pre><code> //these var's are created on the top of the file.
   var soundTimer: NSTimer = NSTimer()
      var audioPlayer2 = AVAudioPlayer()
   var soundTwo = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("sound", ofType: "wav"))
   //this stuff is in the viewDidLoad function.
   audioPlayer2 = AVAudioPlayer(contentsOfURL: soundTwo, error: nil)
          audioPlayer2.prepareToPlay()
          audioPlayer2.play()
   soundTimer = NSTimer.scheduledTimerWithTimeInterval(16, target: self, selector: Selector("soundTimerPlayed"), userInfo: nil, repeats: true)
      func soundTimerPlayed() {
          println("just doing some dandy debugging here.")
          audioPlayer2.stop()
          audioPlayer2.prepareToPlay()
          audioPlayer2.play()
  }
  </code></pre>