0
A
回答
0
看来,改变音量增益是不可能在飞行时AudioQueue运行,一些如何能够增加麦克风增益缓冲器,张贴代码,
void AQRecorder::setGain(void *data, int bytes, float gain){
SInt16 *editBuffer = (SInt16 *)data;
// loop over every packet
for (int nb = 0; nb < (bytes/2); nb++) {
// we check if the gain has been modified to save resoures
if (gain != 0) {
// we need more accuracy in our calculation so we calculate with doubles
double gainSample = ((double)editBuffer[nb])/32767.0;
/*
at this point we multiply with our gain factor
we dont make a addition to prevent generation of sound where no sound is.
no noise
0*10=0
noise if zero
0+10=10
*/
gainSample *= gain;
/**
our signal range cant be higher or lesser -1.0/1.0
we prevent that the signal got outside our range
*/
gainSample = (gainSample < -1.0) ? -1.0 : (gainSample > 1.0) ? 1.0 : gainSample;
/*
This thing here is a little helper to shape our incoming wave.
The sound gets pretty warm and better and the noise is reduced a lot.
Feel free to outcomment this line and here again.
You can see here what happens here http://silentmatt.com/javascript-function-plotter/
Copy this to the command line and hit enter: plot y=(1.5*x)-0.5*x*x*x
*/
gainSample = (1.5 * gainSample) - 0.5 * gainSample * gainSample * gainSample;
// multiply the new signal back to short
gainSample = gainSample * 32767.0;
// write calculate sample back to the buffer
editBuffer[nb] = (SInt16)gainSample;
}
}
}
记住此功能只应叫当有一个增益变化,否则保存CPU资源..
0
首先,问你的队列其kAudioQueueProperty_CurrentDevice
,这是它的读取设备的标识字符串。
接下来,您需要打开该设备。这是比它应该做的更多的工作,因为Core Audio的设计人员通过通用的“GetProperty”和“SetProperty”功能相信所有事情都做得很好。这里所说:
- 创建包含一个指向包含设备标识符和一个指向您希望
AudioDeviceID
变量的变量的AudioValueTranslation
结构。 - 使用
AudioHardwareGetProperty
或未被弃用,但更通用的AudioObjectGetProperty
得到kAudioHardwarePropertyDeviceForUID
,将指针传递给结构。 HAL将查找设备,并通过放置在结构中的指针将其返回给您。
如果这没有返回错误,您现在有一个设备。
最后一步是设置其增益。我认为这是显示为kAudioDevicePropertyVolumeScalar
上的输入范围,但我不是100%确定。无论如何,你会修补AudioDeviceSetProperty
和/或AudioObjectSetProperty
,直到找到合适的组合。
相关问题
- 1. 如何使用speex编解码器的功能控制音频回声并降低话筒增益水平?
- 2. Rpart改进得分与信息增益
- 3. 编码随机1bit增益/损失
- 4. c#aforge模拟摄像头ISP RGB增益寄存器更改
- 5. 的Django 1.9 - 更新或创建,增加收益/编辑ID
- 6. android audiomanager更改收益
- 7. 权限更改在OSX
- 8. 以最大增益顺序跳转 - 动态编程
- 9. Weka使用增益比和信息增益(ID3&C4.5(J48))
- 10. 网络音频API增益
- 11. C++/CLI性能增益
- 12. 声音平底锅增益?
- 13. 信息增益的负值
- 14. 增益蟒蛇y轴值
- 15. 性能增益属性
- 16. 更改超编程
- 17. 十进制收益增加数在MySQL
- 18. 在OpenAL中发现最大增益
- 19. 更改目标C中音频数据的增益会导致波形混乱
- 20. ALSA - 使用alsa api(linux)更改c代码中的麦克风增益
- 21. 如何更改相机参数(自动曝光,快门速度,增益)?
- 22. 如何在Mac OSX上更改mysql $ PATH?
- 23. 通过Python在OSX中更改ActiveApplication
- 24. mysql增量更改
- 25. 以编程方式更改ASP.NET会话超时
- 26. 如何以编程方式更改对话框背景颜色?
- 27. 更改登录会话编程方式使用目标C
- 28. Android:编程式更改手机设置并致电话丢失
- 29. 以编程方式更改会话超时
- 30. Android - 更改EditTextPreference对话框的正向按钮文本编程
,非常感谢,我会试一试 – Amitg2k12 2013-02-28 03:47:54
我试过了,但我不能AudioObjectHasProperty总是返回麦克风错误,此外,我需要做它当AudioQueue运行:(,有一些解决方法张贴在这里... – Amitg2k12 2013-03-01 03:09:41