音频队列kAudioQueueParam

音频队列kAudioQueueParam

本文介绍了音频队列kAudioQueueParam_Pitch的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OS 10.6下的音频队列服务文档现在包括一个音调参数:

The documentation for Audio Queue Services under OS 10.6 now includes a pitch parameter:

kAudioQueueParam_Pitch用于改变音频队列的播放音高的美分数,范围为-2400至2400美分(其中1200美分对应一个音乐八度音阶).仅在启用时间/音高处理器的情况下,此参数才可用.

kAudioQueueParam_PitchThe number of cents to pitch-shift the audio queue’s playback, in the range -2400through 2400 cents (where 1200 cents corresponds to one musical octave.)This parameter is usable only if the time/pitch processor is enabled.

同一文档的其他部分仍然说音量是唯一可用的参数,我找不到对上述时间/音高处理器的任何引用.

Other sections of the same document still say that volume is the only available parameter, and I can't find any reference to the time/pitch processor mentioned above.

有人知道这是什么意思吗?直接将值写入参数对播放没有影响(尽管不会引发错误).同样,写入音量设置也可以.

Does anyone know what this refers to? Directly writing a value to the parameter has no effect on playback (although no error is thrown). Similarly writing the volume setting does work.

像往常一样令人沮丧,没有Apple的支持.

Frustrating as usual with no support from Apple.

推荐答案

此功能仅在iOS 7之前的OSX上可用.如果查看AudioQueue.h,您将发现它仅在iOS 7上有条件可用.重新阅读时,我看到您指的是OS X,而不是iOS,但希望以下内容是跨平台的.

This is only available on OSX until iOS 7. If you look at AudioQueue.h you'll find it is conditionally available only on iOS 7. [note: on re-reading I see you were referring to OS X, not iOS, but hopefully the following is cross-platform]

此外,您需要先在 设置time_pitch算法之前为time_pitch启用队列,并且只有Spectral算法支持音高(所有这些都支持速率)

Also, you need to enable the queue for time_pitch before setting the time_pitch algorithm, and only the Spectral algorithm supports pitch (all of them support rate)

result = AudioQueueNewOutput(&(pAqData->mDataFormat), aqHandleOutputBuffer, pAqData,
                             0, kCFRunLoopCommonModes   , 0, &(pAqData->mQueue));
// enable time_pitch
UInt32 trueValue = 1;
AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_EnableTimePitch, &trueValue, sizeof(trueValue));
UInt32 timePitchAlgorithm = kAudioQueueTimePitchAlgorithm_Spectral; // supports rate and pitch
 AudioQueueSetProperty(pAqData->mQueue, kAudioQueueProperty_TimePitchAlgorithm, &timePitchAlgorithm, sizeof(timePitchAlgorithm));

这篇关于音频队列kAudioQueueParam_Pitch的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-20 01:06