【问题标题】:iOS: AudioUnit of current AVAudioPlayeriOS:当前 AVAudioPlayer 的 AudioUnit
【发布时间】:2015-09-30 11:49:05
【问题描述】:

我正在开发一个使用 AVAudioPlayer 播放音频文件的应用程序。效果很好,但现在我想添加 均衡器预设.我已经从这段代码中得到了所有的预设值

AudioUnitGetProperty(AudioUnit instance, kAudioUnitProperty_FactoryPresets, kAudioUnitScope_Global, 0, &mEQPresetsArray, &size);

我可以使用以下行更改音频单元属性

AUPreset *aPreset = (AUPreset*)CFArrayGetValueAtIndex(EQPresetsArray, 7);
AudioUnitSetProperty(AudioUnit instance, kAudioUnitProperty_PresentPreset, kAudioUnitScope_Global, 0, aPreset, sizeof(AUPreset));

但问题是我无法获取当前播放器/AVAudioPlayer 实例的 AudioUnit。

这个任务有简单的解决方案吗?

提前致谢!!!!

【问题讨论】:

  • 有以下方法: extern OSStatus AUGraphAddNode( AUGraph inGraph,const AudioComponentDescription * inDescription,AUNode * outNode) 添加节点。有没有获取当前节点?
  • 这样做的唯一方法是不使用 AVAudioPlayer,而是使用资产或文件阅读器和音频单元创建自己的音频播放器。
  • 感谢 Nicholson 的回复。但实际上我已经使用 AVAudioPlayer 完成了播放器的所有功能。如果我们获得当前的 AUNode 或 AudioUnit,这将非常有帮助或节省大量时间。
  • 我们可以将设置>music>eq 预设值应用到我的应用 AVPlayer。我们必须在应用中设置任何设置吗?

标签: ios objective-c avaudioplayer core-audio


【解决方案1】:

您可以退一步使用 AVPlayer,然后添加一个 MTAudioProcessingTap.Example Code Here

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-10-10
    • 1970-01-01
    相关资源
    最近更新 更多