简体   繁体   English

如何在我的应用程序中播放来自iOS / iPhone的内部声音文件?

[英]How to play internal sound files from iOS/iPhone in my app?

I am trying to use the internal sound files such as alarm, siren etc.. in an app I am trying to code. 我正在尝试在要编写代码的应用程序中使用内部声音文件,例如警报,警报器等。 Basically when I turn a switch on, I want one of the internal sound files of my choosing to play. 基本上,当我打开开关时,我希望播放我选择的内部声音文件之一。

I am currently using WAV's in the project file to do this, but I would like to use the internal sound files on iOS. 我目前在项目文件中使用WAV来执行此操作,但是我想在iOS上使用内部声音文件。

How can this be done/accessed? 如何完成/访问?

You can use the iOSSystemSoundsLibrary like: <AudioToolbox/AudioToolbox.h> . 您可以像这样使用iOSSystemSoundsLibrary: <AudioToolbox/AudioToolbox.h> The way it works is: AudioServicesPlaySystemSound (1003); // SMSReceived 它的工作方式是: AudioServicesPlaySystemSound (1003); // SMSReceived AudioServicesPlaySystemSound (1003); // SMSReceived . AudioServicesPlaySystemSound (1003); // SMSReceived The list of sound and the examples "How to use" you can find at the page: TUNER88 . 声音列表和示例“如何使用”可在以下页面找到: TUNER88

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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