title: Volume Slider in swift
body: <p>I am trying <strong>to create a slider that controls volume of 4 audio files</strong>.  </p>
  
  <p>Here is my code for the audio:</p>
  
  <pre><code>var ButtonAudioURL  = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("audio1", ofType: "mp3")!)
  
  var firstplayer     = AVAudioPlayer()    
  var ButtonAudioURL2 = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("audio2", ofType: "mp3")!) 
  
  var secondplayer   = AVAudioPlayer()    
  var ButtonAudioURL3 = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("audio3", ofType: "mp3")!)
  
  var thirdplayer = AVAudioPlayer()    
  var ButtonAudioURL4 = NSURL(fileURLWithPath: NSBundle.mainBundle().pathForResource("audio4", ofType: "mp3")!)
  
  var forthplayer = AVAudioPlayer()
  
  override func viewDidLoad() {
  
      super.viewDidLoad()
      // Do any additional setup after loading the view, typically from a nib.
      firstplayer  = AVAudioPlayer(contentsOfURL: ButtonAudioURL, error: nil)        
      secondplayer = AVAudioPlayer(contentsOfURL: ButtonAudioURL2, error: nil)     
      thirdplayer  = AVAudioPlayer(contentsOfURL: ButtonAudioURL3, error: nil)       
      forthplayer  = AVAudioPlayer(contentsOfURL: ButtonAudioURL4, error: nil)
  </code></pre>
  
  <p>I have the audio to play when each button is touched.  But I just need to get a slider to control the volume of each audio file from each button.</p>
  
  <p>How should i do this?  I have looked at MPVolumeView class reference on developer.apple, but I am still confused and in the <strong>developer.apple reference for MPVolumeView</strong>, it talks about AirPlay, can I disable that?   </p>
  
  <p>I just need a slider to control the volume.   </p>