Skip to content

实现iOS的音频输出;修复iOS下钢琴卷帘处无法拖动的问题#108

Open
jiPku wants to merge 6 commits into
vocoder712:masterfrom
jiPku:ios-support
Open

实现iOS的音频输出;修复iOS下钢琴卷帘处无法拖动的问题#108
jiPku wants to merge 6 commits into
vocoder712:masterfrom
jiPku:ios-support

Conversation

@jiPku

@jiPku jiPku commented Jan 9, 2026

Copy link
Copy Markdown
Contributor

iOS: 实现 AVAudioEngineOutput 并改进 ObjectProvider 初始化流程

iOS 音频输出实现:

  • OpenUtauMobile/Platforms/iOS/Utils/Audio/AVAudioEngineOutput.cs 中新增了 AVAudioEngineOutput 类。
    该类基于 AVFoundation 和 NAudio 实现了 IAudioOutput,支持实际音频播放、临时 WAV 渲染以及资源清理。

Object Provider 初始化更新:

  • 更新了 OpenUtauMobile/Utils/ObjectProvider.cs 中的 ObjectProvider.Initialize()
    在 iOS 平台上实例化 AVAudioEngineOutput,若初始化失败则自动回退到 DummyAudioOutput,并记录所选音频输出类型的日志。

@jiPku jiPku changed the title # **iOS: 实现 AVAudioEngineOutput 并改进 ObjectProvider 初始化流程** 实现iOS的音频输出 Jan 9, 2026
@jiPku jiPku changed the title 实现iOS的音频输出 实现iOS的音频输出并修复iOS下钢琴卷帘处无法拖动的问题 Jan 10, 2026
@jiPku jiPku changed the title 实现iOS的音频输出并修复iOS下钢琴卷帘处无法拖动的问题 实现iOS的音频输出;修复iOS下钢琴卷帘处无法拖动的问题;添加iOS平台的worldline构建项目 Jan 10, 2026
@jiPku jiPku changed the title 实现iOS的音频输出;修复iOS下钢琴卷帘处无法拖动的问题;添加iOS平台的worldline构建项目 实现iOS的音频输出;修复iOS下钢琴卷帘处无法拖动的问题 Jan 12, 2026
@MarMar101

MarMar101 commented May 11, 2026

Copy link
Copy Markdown

I think there might be an issue with AVAudioEngine. My song played for a while but then stopped halfway through. My app became +10GB large and I eventually ran out of storage. I am not sure if there is a way to delete the temp WAVs that are already stored on the device. I ran it on an iphone12 mini. I started seeing the following logs over and over listed down below. I had to delete the app and reinstall it.

2026-05-11 01:24:49.625 -05:00 [INF] Rendered temp WAV to /private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_0059adfb-662a-4ecd-9e8e-5210e2f21926.wav
2026-05-11 01:24:50.512 -05:00 [ERR] Failed to render temp WAV for AVAudioEngineOutput
System.IO.IOException: No space left on device : '/private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_4157cd86-3729-47d0-8b31-f0b222d8bd58.wav'
   at System.IO.Strategies.FileStreamHelpers.CheckFileCall(Int64 result, String path, Boolean ignoreNotSupported)
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteSpan(ReadOnlySpan`1 source, ArraySegment`1 arraySegment)
   at System.IO.Strategies.BufferedFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.FileStream.Write(ReadOnlySpan`1 buffer)
   at System.IO.BinaryWriter.Write(Single value)
   at NAudio.Wave.WaveFileWriter.WriteSample(Single sample)
   at OpenUtauMobile.Platforms.iOS.Utils.Audio.AVAudioEngineOutput.Init(ISampleProvider sampleProvider) in /Users/runner/work/OpenUtauMobileIOS/OpenUtauMobileIOS/OpenUtauMobile/Platforms/iOS/Utils/Audio/AVAudioEngineOutput.cs:line 60
2026-05-11 01:24:50.559 -05:00 [ERR] Failed to render temp WAV for AVAudioEngineOutput
System.IO.IOException: No space left on device : '/private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_74213666-e242-4823-98ef-2c9b5fd5015f.wav'
   at System.IO.Strategies.FileStreamHelpers.CheckFileCall(Int64 result, String path, Boolean ignoreNotSupported)
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.Flush(Boolean flushToDisk)
   at System.IO.FileStream.Flush(Boolean flushToDisk)
   at System.IO.FileStream.Flush()
   at System.IO.BinaryWriter.Flush()
   at NAudio.Wave.WaveFileWriter.UpdateHeader(BinaryWriter writer)
   at NAudio.Wave.WaveFileWriter.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.IO.Stream.Dispose()
   at OpenUtauMobile.Platforms.iOS.Utils.Audio.AVAudioEngineOutput.Init(ISampleProvider sampleProvider) in /Users/runner/work/OpenUtauMobileIOS/OpenUtauMobileIOS/OpenUtauMobile/Platforms/iOS/Utils/Audio/AVAudioEngineOutput.cs:line 62

@jiPku

jiPku commented May 11, 2026

Copy link
Copy Markdown
Contributor Author

我觉得可能是AVAudioEngine出了问题。我的歌播放了一会儿,但中途就停了。我的应用变得+10GB大,最终存储空间用完了。我不确定有没有办法删除设备上已经存储的临时WAV文件。我是在 iPhone 12 mini 上运行的。我开始在下面反复看到以下日志。我不得不删除应用并重新安装。

2026-05-11 01:24:49.625 -05:00 [INF] Rendered temp WAV to /private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_0059adfb-662a-4ecd-9e8e-5210e2f21926.wav
2026-05-11 01:24:50.512 -05:00 [ERR] Failed to render temp WAV for AVAudioEngineOutput
System.IO.IOException: No space left on device : '/private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_4157cd86-3729-47d0-8b31-f0b222d8bd58.wav'
   at System.IO.Strategies.FileStreamHelpers.CheckFileCall(Int64 result, String path, Boolean ignoreNotSupported)
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.WriteSpan(ReadOnlySpan`1 source, ArraySegment`1 arraySegment)
   at System.IO.Strategies.BufferedFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.FileStream.Write(ReadOnlySpan`1 buffer)
   at System.IO.BinaryWriter.Write(Single value)
   at NAudio.Wave.WaveFileWriter.WriteSample(Single sample)
   at OpenUtauMobile.Platforms.iOS.Utils.Audio.AVAudioEngineOutput.Init(ISampleProvider sampleProvider) in /Users/runner/work/OpenUtauMobileIOS/OpenUtauMobileIOS/OpenUtauMobile/Platforms/iOS/Utils/Audio/AVAudioEngineOutput.cs:line 60
2026-05-11 01:24:50.559 -05:00 [ERR] Failed to render temp WAV for AVAudioEngineOutput
System.IO.IOException: No space left on device : '/private/var/mobile/Containers/Data/Application/AEF44AC2-8A2A-48D6-BE12-647CD79B0513/tmp/openutaumobile_render_74213666-e242-4823-98ef-2c9b5fd5015f.wav'
   at System.IO.Strategies.FileStreamHelpers.CheckFileCall(Int64 result, String path, Boolean ignoreNotSupported)
   at System.IO.RandomAccess.WriteAtOffset(SafeFileHandle handle, ReadOnlySpan`1 buffer, Int64 fileOffset)
   at System.IO.Strategies.OSFileStreamStrategy.Write(ReadOnlySpan`1 buffer)
   at System.IO.Strategies.OSFileStreamStrategy.Write(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.Strategies.BufferedFileStreamStrategy.FlushWrite()
   at System.IO.Strategies.BufferedFileStreamStrategy.Flush(Boolean flushToDisk)
   at System.IO.FileStream.Flush(Boolean flushToDisk)
   at System.IO.FileStream.Flush()
   at System.IO.BinaryWriter.Flush()
   at NAudio.Wave.WaveFileWriter.UpdateHeader(BinaryWriter writer)
   at NAudio.Wave.WaveFileWriter.Dispose(Boolean disposing)
   at System.IO.Stream.Close()
   at System.IO.Stream.Dispose()
   at OpenUtauMobile.Platforms.iOS.Utils.Audio.AVAudioEngineOutput.Init(ISampleProvider sampleProvider) in /Users/runner/work/OpenUtauMobileIOS/OpenUtauMobileIOS/OpenUtauMobile/Platforms/iOS/Utils/Audio/AVAudioEngineOutput.cs:line 62

该Pull request目前仅实现了部分功能以验证部署在iOS平台上的可行性,我们会在项目趋于稳定后重新评估在iOS平台上实现的可能!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants