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. 如何在運行期間改變Simulink中增益塊的增益值
- 3. 信息增益
- 4. 編碼隨機1bit增益/損失
- 5. Rpart改進得分與信息增益
- 6. 的Django 1.9 - 更新或創建,增加收益/編輯ID
- 7. 如何更改AVAudioSession的輸入增益? xcode
- 8. c#aforge模擬攝像頭ISP RGB增益寄存器更改
- 9. android audiomanager更改收益
- 10. 以最大增益順序跳轉 - 動態編程
- 11. 權限更改在OSX
- 12. 通過編程方式更改mac osx上的代理
- 13. Weka使用增益比和信息增益(ID3&C4.5(J48))
- 14. Java更改量OSX
- 15. 增加傳入音頻流的增益
- 16. 更改超編程
- 17. C++/CLI性能增益
- 18. 性能增益屬性
- 19. 聲音平底鍋增益?
- 20. Solr中的負增益
- 21. Web Audio Api,設置增益
- 22. 增益蟒蛇y軸值
- 23. 信息增益的負值
- 24. 網絡音頻API增益
- 25. 在OSX上將默認編譯器從llvm-g ++更改爲g ++
- 26. 十進制收益增加數在MySQL
- 27. 在OpenAL中發現最大增益
- 28. CLLocationManager正在計算仰角增益
- 29. 開始在OSX默認程序編程
- 30. OSX上的內存更改
,非常感謝,我會試一試 – Amitg2k12 2013-02-28 03:47:54
我試過了,但我不能AudioObjectHasProperty總是返回麥克風錯誤,此外,我需要做它當AudioQueue運行:(,有一些解決方法張貼在這裏... – Amitg2k12 2013-03-01 03:09:41