audioflinger中关于audioeffect的问题

hainei_ 2012-04-12 09:51:56
HI, 各位好, 没分了, 但是项目很急, 希望大家能多多指点.


现在需要对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可以指定成一样的吗?
...全文
361 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

80,351

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧