audioflinger中关于audioeffect的问题
HI, 各位好, 没分了, 但是项目很急, 希望大家能多多指点.
现在需要对android中audioeffect的AGC模块作改进, 要作改进, 首先就需要有一个能调到AGC的APK.
问题:
现在有一个JAVA层的APK, 这个APK主要实现创建AudioRecord录音, 并把采集到的PCM数据经过AGC模块增强有用信号.问题出现了, 这个APK在公司的板子上运行, 没有一点效果, 跟踪audioflinger的代码发现, 程序创建AGC成功了, 可是却没调到AGC模块中.
但是把这个APK放到Galaxy Nexus上能明显听到录下来的声音得到增强.
在这里贴上android中audioflinger中一段代码:
程序如果能调到mEffects[i]->process中, 就应该能调进AGC模块中, 现在LOG出来的信息发现doProcess是0, 程序是调不进去的.
1, 求高人指点, 怎样才能调进AGC模块.
还有, 关于AudioRecord和AudioTrack中sessionID的问题, 这两者的sessionID可以指定成一样的吗?
现在需要对android中audioeffect的AGC模块作改进, 要作改进, 首先就需要有一个能调到AGC的APK.
问题:
现在有一个JAVA层的APK, 这个APK主要实现创建AudioRecord录音, 并把采集到的PCM数据经过AGC模块增强有用信号.问题出现了, 这个APK在公司的板子上运行, 没有一点效果, 跟踪audioflinger的代码发现, 程序创建AGC成功了, 可是却没调到AGC模块中.
但是把这个APK放到Galaxy Nexus上能明显听到录下来的声音得到增强.
在这里贴上android中audioflinger中一段代码:
void AudioFlinger::EffectChain::process_l()
{
LOGD("##AudioFlinger::EffectChain::process_l---------------------------\n");
sp<ThreadBase> thread = mThread.promote();
if (thread == 0) {
LOGW("process_l(): cannot promote mixer thread");
return;
}
bool isGlobalSession = (mSessionId == AUDIO_SESSION_OUTPUT_MIX) ||
(mSessionId == AUDIO_SESSION_OUTPUT_STAGE);
// always process effects unless no more tracks are on the session and the effect tail
// has been rendered
LOGD("mSessionId=%d,isGlobalSession=%d, mTailBufferCount=%d, trackCont()=%d,", mSessionId, isGlobalSession, mTailBufferCount, trackCnt());
bool doProcess = true;
if (!isGlobalSession) {
bool tracksOnSession = (trackCnt() != 0);
if (!tracksOnSession && mTailBufferCount == 0) {
doProcess = false;
}
LOGD("tracksOnSession=%d, mTailBufferCount=%d,", tracksOnSession, mTailBufferCount);
if (activeTrackCnt() == 0) {
// if no track is active and the effect tail has not been rendered,
// the input buffer must be cleared here as the mixer process will not do it
if (tracksOnSession || mTailBufferCount > 0) {
size_t numSamples = thread->frameCount() * thread->channelCount();
memset(mInBuffer, 0, numSamples * sizeof(int16_t));
if (mTailBufferCount > 0) {
mTailBufferCount--;
}
}
}
}
size_t size = mEffects.size();
// doProcess = true;
LOGD("##AudioFlinger::EffectChain::process_l,size=%d,doProcess=%d,---------------------------\n",size, doProcess);
if (doProcess) {
for (size_t i = 0; i < size; i++) {
LOGD("effect %s,----------------------------------\n", mEffects[i]->mDescriptor.name);
mEffects[i]->process();
}
}
for (size_t i = 0; i < size; i++) {
mEffects[i]->updateState();
}
}
程序如果能调到mEffects[i]->process中, 就应该能调进AGC模块中, 现在LOG出来的信息发现doProcess是0, 程序是调不进去的.
1, 求高人指点, 怎样才能调进AGC模块.
还有, 关于AudioRecord和AudioTrack中sessionID的问题, 这两者的sessionID可以指定成一样的吗?
...全文
相关推荐
Android音效库实现解析[代码]
本文详细解析了Android底层AudioEffect的构造流程及音效库的实现方法。从Java层调用到JNI进入底层C/C++实现,通过AudioFlinger管理音效,EffectFactory读取配置文件创建音效实例。文章还介绍了音效库的配置文件audio_effects.conf的结构,以及如何通过Visualizer音效库的示例代码实现新的音效库。此外,还讨论了音效库的编译、中介类的编写、配置文件修改及在手机上使用新音效库的具体步骤。
Android音频ALSA.7z
Android audio 设计与实现,基于linux ALSA架构,内容介绍全面。
安卓Android源码——安卓Android电子麦克风.rar
安卓Android源码——安卓Android电子麦克风.rar
Android系统原理与开发要点详解】07_Android的Audio系统
Android系统原理与开发要点详解】07_Android的Audio系统
Jelly Bean AudioFlinger introduction
不错的介绍AudioFlinger Jelly Bean的资料


