Skip to content

Commit

Permalink
Merge pull request #56 from anandchandra50/master
Browse files Browse the repository at this point in the history
updated pitch engine input
  • Loading branch information
vadymmarkov authored Jan 11, 2018
2 parents 3ad1068 + 93482ee commit dbbfda7
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion Source/SignalTracking/Units/InputSignalTracker.swift
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,19 @@ final class InputSignalTracker: SignalTracker {

func start() throws {
try session.setCategory(AVAudioSessionCategoryPlayAndRecord)
try session.overrideOutputAudioPort(AVAudioSessionPortOverride.speaker)

// check input type
let currentRoute = session.currentRoute
if currentRoute.outputs.count != 0 {
for description in currentRoute.outputs {
if (description.portType != AVAudioSessionPortHeadphones) { // input from speaker if port is not headphones
try session.overrideOutputAudioPort(AVAudioSessionPortOverride.speaker)
} else { // input from default (headphones)
try session.overrideOutputAudioPort(.none)
}
}
}

audioEngine = AVAudioEngine()

guard let inputNode = audioEngine?.inputNode else {
Expand Down

0 comments on commit dbbfda7

Please sign in to comment.