am 7203272f: Merge "Fixed problems in audio effect volume control." into gingerbread
Merge commit '7203272f35e40bf9d4b76f1b2f9b0077738df118' into gingerbread-plus-aosp * commit '7203272f35e40bf9d4b76f1b2f9b0077738df118': Fixed problems in audio effect volume control.
This commit is contained in:
@@ -230,9 +230,6 @@ extern "C" int Visualizer_process(
|
|||||||
if (pContext == NULL) {
|
if (pContext == NULL) {
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
|
|
||||||
return -ENODATA;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (inBuffer == NULL || inBuffer->raw == NULL ||
|
if (inBuffer == NULL || inBuffer->raw == NULL ||
|
||||||
outBuffer == NULL || outBuffer->raw == NULL ||
|
outBuffer == NULL || outBuffer->raw == NULL ||
|
||||||
@@ -269,6 +266,9 @@ extern "C" int Visualizer_process(
|
|||||||
memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount * 2 * sizeof(int16_t));
|
memcpy(outBuffer->raw, inBuffer->raw, outBuffer->frameCount * 2 * sizeof(int16_t));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (pContext->mState != VISUALIZER_STATE_ACTIVE) {
|
||||||
|
return -ENODATA;
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
} // end Visualizer_process
|
} // end Visualizer_process
|
||||||
|
|
||||||
|
|||||||
@@ -2948,7 +2948,8 @@ bool AudioFlinger::PlaybackThread::Track::isReady() const {
|
|||||||
status_t AudioFlinger::PlaybackThread::Track::start()
|
status_t AudioFlinger::PlaybackThread::Track::start()
|
||||||
{
|
{
|
||||||
status_t status = NO_ERROR;
|
status_t status = NO_ERROR;
|
||||||
LOGV("start(%d), calling thread %d", mName, IPCThreadState::self()->getCallingPid());
|
LOGV("start(%d), calling thread %d session %d",
|
||||||
|
mName, IPCThreadState::self()->getCallingPid(), mSessionId);
|
||||||
sp<ThreadBase> thread = mThread.promote();
|
sp<ThreadBase> thread = mThread.promote();
|
||||||
if (thread != 0) {
|
if (thread != 0) {
|
||||||
Mutex::Autolock _l(thread->mLock);
|
Mutex::Autolock _l(thread->mLock);
|
||||||
@@ -5366,9 +5367,9 @@ status_t AudioFlinger::EffectModule::setVolume(uint32_t *left, uint32_t *right,
|
|||||||
|
|
||||||
// Send volume indication if EFFECT_FLAG_VOLUME_IND is set and read back altered volume
|
// Send volume indication if EFFECT_FLAG_VOLUME_IND is set and read back altered volume
|
||||||
// if controller flag is set (Note that controller == TRUE => EFFECT_FLAG_VOLUME_CTRL set)
|
// if controller flag is set (Note that controller == TRUE => EFFECT_FLAG_VOLUME_CTRL set)
|
||||||
if (isEnabled() &&
|
if ((mState >= ACTIVE) &&
|
||||||
(mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL ||
|
((mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL ||
|
||||||
(mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_IND) {
|
(mDescriptor.flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_IND)) {
|
||||||
status_t cmdStatus;
|
status_t cmdStatus;
|
||||||
uint32_t volume[2];
|
uint32_t volume[2];
|
||||||
uint32_t *pVolume = NULL;
|
uint32_t *pVolume = NULL;
|
||||||
@@ -5749,7 +5750,8 @@ void AudioFlinger::EffectHandle::dump(char* buffer, size_t size)
|
|||||||
AudioFlinger::EffectChain::EffectChain(const wp<ThreadBase>& wThread,
|
AudioFlinger::EffectChain::EffectChain(const wp<ThreadBase>& wThread,
|
||||||
int sessionId)
|
int sessionId)
|
||||||
: mThread(wThread), mSessionId(sessionId), mActiveTrackCnt(0), mOwnInBuffer(false),
|
: mThread(wThread), mSessionId(sessionId), mActiveTrackCnt(0), mOwnInBuffer(false),
|
||||||
mVolumeCtrlIdx(-1), mLeftVolume(0), mRightVolume(0)
|
mVolumeCtrlIdx(-1), mLeftVolume(0), mRightVolume(0),
|
||||||
|
mNewLeftVolume(0), mNewRightVolume(0)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -5980,25 +5982,34 @@ bool AudioFlinger::EffectChain::setVolume_l(uint32_t *left, uint32_t *right)
|
|||||||
|
|
||||||
// first update volume controller
|
// first update volume controller
|
||||||
for (size_t i = size; i > 0; i--) {
|
for (size_t i = size; i > 0; i--) {
|
||||||
if (mEffects[i - 1]->isEnabled() &&
|
if ((mEffects[i - 1]->state() >= EffectModule::ACTIVE) &&
|
||||||
(mEffects[i - 1]->desc().flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL) {
|
(mEffects[i - 1]->desc().flags & EFFECT_FLAG_VOLUME_MASK) == EFFECT_FLAG_VOLUME_CTRL) {
|
||||||
ctrlIdx = i - 1;
|
ctrlIdx = i - 1;
|
||||||
|
hasControl = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) {
|
if (ctrlIdx == mVolumeCtrlIdx && *left == mLeftVolume && *right == mRightVolume) {
|
||||||
return false;
|
if (hasControl) {
|
||||||
|
*left = mNewLeftVolume;
|
||||||
|
*right = mNewRightVolume;
|
||||||
|
}
|
||||||
|
return hasControl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mVolumeCtrlIdx != -1) {
|
||||||
|
hasControl = true;
|
||||||
|
}
|
||||||
mVolumeCtrlIdx = ctrlIdx;
|
mVolumeCtrlIdx = ctrlIdx;
|
||||||
mLeftVolume = *left;
|
mLeftVolume = newLeft;
|
||||||
mRightVolume = *right;
|
mRightVolume = newRight;
|
||||||
|
|
||||||
// second get volume update from volume controller
|
// second get volume update from volume controller
|
||||||
if (ctrlIdx >= 0) {
|
if (ctrlIdx >= 0) {
|
||||||
mEffects[ctrlIdx]->setVolume(&newLeft, &newRight, true);
|
mEffects[ctrlIdx]->setVolume(&newLeft, &newRight, true);
|
||||||
hasControl = true;
|
mNewLeftVolume = newLeft;
|
||||||
|
mNewRightVolume = newRight;
|
||||||
}
|
}
|
||||||
// then indicate volume to all other effects in chain.
|
// then indicate volume to all other effects in chain.
|
||||||
// Pass altered volume to effects before volume controller
|
// Pass altered volume to effects before volume controller
|
||||||
|
|||||||
@@ -1110,6 +1110,9 @@ private:
|
|||||||
int mVolumeCtrlIdx; // index of insert effect having control over volume
|
int mVolumeCtrlIdx; // index of insert effect having control over volume
|
||||||
uint32_t mLeftVolume; // previous volume on left channel
|
uint32_t mLeftVolume; // previous volume on left channel
|
||||||
uint32_t mRightVolume; // previous volume on right channel
|
uint32_t mRightVolume; // previous volume on right channel
|
||||||
|
uint32_t mNewLeftVolume; // new volume on left channel
|
||||||
|
uint32_t mNewRightVolume; // new volume on right channel
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
friend class RecordThread;
|
friend class RecordThread;
|
||||||
|
|||||||
Reference in New Issue
Block a user