简体   繁体   中英

AudioKit 4.6 no sound

I've been developing an iOS app the last year with AudioKit-4.0.4. Now that I have the app working I thought it was time to update my AudioKit library to a newer version.

I have downloaded AudioKit-4.6 and merely swapped out the older "AudioKit For iOS.xcodeproj" in my XCode project with the new version. Everything built just fine, except for AudioKit.start() now has to be wrapped with a "try". No other changes were needed to get a successful build.

But now my app does not produce any sound.

Here is my code for starting AudioKit:

AKSettings.audioInputEnabled = true
mix = AKMixer()

AKSettings.playbackWhileMuted = true
AudioKit.output = mix

do {
    try AudioKit.start()
    print("----- AudioKit Started -----")
} catch {
    print("Error AudioKit.start")
}

do {
    try AKSettings.setSession(category: AKSettings.SessionCategory.playback, with: AVAudioSession.CategoryOptions.mixWithOthers)
} catch {
    print("Error setSession mixWithOthers")
}

In addition to no audio, I am seeing these repeated messages in the console log:

----- AudioKit Started -----
2019-04-08 15:03:45.709359-0700 HarmonicChimes[2708:2212995] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)
2019-04-08 15:03:45.711236-0700 HarmonicChimes[2708:2212995] [avas] AVAudioSessionPortImpl.mm:56:ValidateRequiredFields: Unknown selected data source for Port Speaker (type: Speaker)

These AV messages show on my iOS 12 device but not iOS 11 and older. Some googling on the net indicates these AV messages are Apple's problem, not AudioKit, but I was not seeing them when running with AudioKit 4.0.4.

The no sound problem is a show stopper! I have searched for "AudioKit no sound" but not found anything that makes sense.

It would appear that 4.6 is not just a simple plug-in replacement for 4.0? Is there a new AudioKit api to get the sound started? My app's plist and capabilities are set to allow for background operation, could that have something to do with this?

(I am using XCode 10.1, macOS 10.13.6, and iOS 12.)

I posted the answer to this question in AudioKit's GitHub issues pages, but for the record here, it is just that AKOscillator was on by default in the past (bad) and has been fixed in the newest version. So, @WholeCheese has to add an osc.start() to his files. Next, I hope to do a screen share with him to solve the Audiobus issues.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM