             self.engine.prepare()
             #if !os(OSX)
                 if AKSettings.audioInputEnabled {
+                    
+                #if os(iOS)
                     if AKSettings.defaultToSpeaker {
                         
                         try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord, withOptions:AVAudioSessionCategoryOptions.DefaultToSpeaker)

                
                try self.engine.start()
                
            #endif
        } catch {
            fatalError("AudioKit: Could not start engine. error: \(error).")
        }
        shouldBeRunning = true
    }
    
    /// Stop the audio engine

                        try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord)
                        
                    }
                #else
                    // tvOS
                    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayAndRecord)
                    
                #endif
                    
                } else if AKSettings.playbackWhileMuted {
                    try AVAudioSession.sharedInstance().setCategory(AVAudioSessionCategoryPlayback)
