jjzjj

AudioToolBox

全部标签

ios - Swift 中的 AudioToolBox - 声音在模拟器中有效,但在我的 iPad 上无效

我正在创建一个音乐应用程序,其中不同的铃声将在节奏周期的不同点播放。到目前为止,我的代码在模拟器中运行良好,但我的设备上没有任何声音。我从其他应用程序获得声音。我的代码有问题吗?谢谢你的帮助!importUIKitimportAudioToolboxfuncplayChime1(){varchime1URL:NSURL?varchime1ID:SystemSoundID=0letfilePath=NSBundle.mainBundle().pathForResource("Chime",ofType:"mp3")chime1URL=NSURL(fileURLWithPath:fileP

ios - 获取音频队列缓冲区的 <AudioTimeStamp>

我正尝试在Swift中创建一个连续的FIFO录音机。我在尝试创建audioQueueCallback时遇到问题。来自文档AudioTimeStamp有这个初始化方法:AudioTimeStamp(mSampleTime:Float64,mHostTime:UInt64,mRateScalar:Float64,mWordClockTime:UInt64,mSMPTETime:SMPTETime,mFlags:AudioTimeStampFlags,mReserved:UInt32)我不知道如何使用它。在我看来,该设备应该有一个可靠的内部时钟,以便能够管理音频队列,但我还没有找到它的任何文

swift - AUAudioUnit 和 AudioUnit 有什么区别

我看到了WDC2016conference关于CoreAudio,DougWyatt在第29分钟开始谈论实时音频。因为我正在开发一个高性能的音频应用程序,所以我需要这样做。但是我注意到他使用了AUAudioUnit但是在我的C应用程序中(我更喜欢使用C/C++来编写音频代码并且我遵循ChrisAdamsonadvices)。所以我有3个问题:AudioUnit和AUAudioUnit有什么区别?据我所知,我读到一个音频单元是AudioComponent.h中定义的AudioComponentInstance类型,而AUAudioUnit将是它的包装类。为什么我不能在C/C++项目中使用

objective-c - 如何从 Swift 中的 void UnsafePointer 中提取数据?

我在Objective-C(使用AudioToolbox框架)中有以下代码,我试图将其转换为Swift:MusicTimeStamptimeStamp;MusicEventTypeeventType;constvoid*eventData;UInt32eventDataSize;//MusicEventIteratorGetEventInfoisdeclaredinAudioToolboxframeworkasthis://OSStatusMusicEventIteratorGetEventInfo(MusicEventIteratorinIterator,MusicTimeStamp

ios - 快速将 float 组写入 wav 音频文件

我现在有这样的流程:我用AudioEngine录制音频,将它发送到音频处理库并取回音频缓冲区,然后我有强烈的意愿将它写入wav文件,但我完全不知道如何swift做到这一点。我已经从另一个stackoverflow答案中尝试了这个片段,但它写了一个空的和损坏的文件。(loadapcmintoaAVAudioPCMBuffer)//getdatafromlibraryvarlen:CLong=0letres:UnsafePointer=getData(CLong(),&len)letbufferPointer:UnsafeBufferPointer=UnsafeBufferPointer(

ios - Swift - AVPlayer 加载失败,出现错误 Error Domain=NSURLErrorDomain Code=-999 "cancelled"

我尝试从url字符串播放视频。但是我在问题标题中遇到了一些错误。我在下面尝试这段代码。videoPath是一个url字符串。letvideoURL=URL(string:videoPath)letplayer=AVPlayer(url:videoURL!)letplayerViewController=AVPlayerViewController()playerViewController.player=playerself.present(playerViewController,animated:true){playerViewController.player!.play()}错

objective-c - 为什么 AudioServicesCreateSystemSoundID 内部抛出异常,却返回 0 作为错误码?

我在4.3.2、5.0和5.1模拟器中运行一个iOS程序,我在AudioToolbox中遇到了一个奇怪的内部异常。我在Xcode(Xcode4.3.1,在10.7.3上运行)中为所有异常设置了一个断点,调试器在调用AudioServicesCreateSystemSoundID()期间中断:SystemSoundIDsoundID;OSStatuserrorCode=AudioServicesCreateSystemSoundID(soundFileURLRef,&soundID);//^boom.^回溯:(lldb)bt*thread#1:tid=0x1f03,0x9000e230l

objective-c - 为什么 AudioServicesCreateSystemSoundID 内部抛出异常,却返回 0 作为错误码?

我在4.3.2、5.0和5.1模拟器中运行一个iOS程序,我在AudioToolbox中遇到了一个奇怪的内部异常。我在Xcode(Xcode4.3.1,在10.7.3上运行)中为所有异常设置了一个断点,调试器在调用AudioServicesCreateSystemSoundID()期间中断:SystemSoundIDsoundID;OSStatuserrorCode=AudioServicesCreateSystemSoundID(soundFileURLRef,&soundID);//^boom.^回溯:(lldb)bt*thread#1:tid=0x1f03,0x9000e230l

iOS SDK::vibration & 播放蜂鸣声。

我需要振动iOS设备,不支持振动的设备会发出哔声。为此我正在使用ImportAudioToolbox.framework#importAudioServicesPlayAlertSound(kSystemSoundID_Vibrate);它在iPhone设备上振动,但在iPad和iPod上没有声音。虽然引用说它会播放声音。我做错了什么?MakingtheiPhonevibratehttp://blog.mugunthkumar.com/coding/iphone-tutorial-better-way-to-check-capabilities-of-ios-devices/

iOS SDK::vibration & 播放蜂鸣声。

我需要振动iOS设备,不支持振动的设备会发出哔声。为此我正在使用ImportAudioToolbox.framework#importAudioServicesPlayAlertSound(kSystemSoundID_Vibrate);它在iPhone设备上振动,但在iPad和iPod上没有声音。虽然引用说它会播放声音。我做错了什么?MakingtheiPhonevibratehttp://blog.mugunthkumar.com/coding/iphone-tutorial-better-way-to-check-capabilities-of-ios-devices/