iOS AUSampler audiounit - file path issue with EXS audio files?

被刻印的时光 ゝ 提交于 2019-11-30 18:35:27

问题


Following the Apple docs here I have been able to successfully load a GarageBand EXS sampler instrument into AUSampler in my iOS app by recreating, for example the following path within my app directory:

/Sampler Files/Funk Horn Section/nameofaudio.aif

iOS looks for the audio file in the following directory:

file:///Library/Application%20Support/GarageBand/Instrument%20Library/Sampler/Sampler%20Files/Funk%20Horn%20Section/'

However this doesn't work when I create my own EXS file. How does it know to remove the first part of the filepath if GarageBand?? I've even tried creating my EXS instrument and even created in the same GarageBand directory but it makes no difference:

Failed to locate sample '001%20VirusTI%20-%20SeaThr%2314A1B3.aif -- file:///macSSD/Library/Application%20Support/GarageBand/Instrument%20Library/Sampler/Sampler%20Files/VirusTI%20-%20SeaThreeHS%20v2/'

I've also tried manually editing the file path in the exs file with a text editor but nothing works.

The EXS instrument plays fine in logic. But my app can't find it.

Any help greatly appreciated.


回答1:


The key here is that your source sampler file has to reference samples that come from any of these 'trigger' directory structures to work properly:

"/Sounds/" "/Sampler Files/" "/Apple Loops/" "/EXS Factory Samples/" "/SoundFont Samples/"

Your sample has to exist in a directory path with one of those triggers in it, and then the path has to match the exact same in your bundle. iOS looks for one of those triggers, then deletes everything before that, and uses that as the new search path in the bundle to find your sample. It is tricky, but it will work this way if you make sure everything is in order.

I fought with this because my samples were stored in places without any of those keywords, and so it would never find them.



来源:https://stackoverflow.com/questions/21468108/ios-ausampler-audiounit-file-path-issue-with-exs-audio-files

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!