diff options
| author | Glenn Kasten <gkasten@google.com> | 2011-01-18 11:44:36 -0800 |
|---|---|---|
| committer | Glenn Kasten <gkasten@google.com> | 2011-01-19 10:33:52 -0800 |
| commit | bcc5c7225e3b7a1dbf2e9e830987f69167acf06f (patch) | |
| tree | 56591f6cd82a95ee1b26eb73ff1a01df84c82ce3 /src/itf | |
| parent | 4614db004f8992f7d710cb8d47550f66bce0a9d2 (diff) | |
| download | android_frameworks_wilhelm-bcc5c7225e3b7a1dbf2e9e830987f69167acf06f.tar.gz android_frameworks_wilhelm-bcc5c7225e3b7a1dbf2e9e830987f69167acf06f.tar.bz2 android_frameworks_wilhelm-bcc5c7225e3b7a1dbf2e9e830987f69167acf06f.zip | |
Rename class__ to clazz, this to thiz
The JNI naming conventions avoid conflict with C++ reserved words.
Change-Id: I93ad6920bf78c0a02ac4b2650a29c9e11252f731
Diffstat (limited to 'src/itf')
50 files changed, 1999 insertions, 1999 deletions
diff --git a/src/itf/I3DCommit.c b/src/itf/I3DCommit.c index 889878c..7ad4601 100644 --- a/src/itf/I3DCommit.c +++ b/src/itf/I3DCommit.c @@ -23,15 +23,15 @@ static SLresult I3DCommit_Commit(SL3DCommitItf self) { SL_ENTER_INTERFACE - I3DCommit *this = (I3DCommit *) self; - IObject *thisObject = InterfaceToIObject(this); + I3DCommit *thiz = (I3DCommit *) self; + IObject *thisObject = InterfaceToIObject(thiz); object_lock_exclusive(thisObject); - if (this->mDeferred) { - SLuint32 myGeneration = this->mGeneration; + if (thiz->mDeferred) { + SLuint32 myGeneration = thiz->mGeneration; do { - ++this->mWaiting; + ++thiz->mWaiting; object_cond_wait(thisObject); - } while (this->mGeneration == myGeneration); + } while (thiz->mGeneration == myGeneration); } object_unlock_exclusive(thisObject); result = SL_RESULT_SUCCESS; @@ -44,10 +44,10 @@ static SLresult I3DCommit_SetDeferred(SL3DCommitItf self, SLboolean deferred) { SL_ENTER_INTERFACE - I3DCommit *this = (I3DCommit *) self; - IObject *thisObject = InterfaceToIObject(this); + I3DCommit *thiz = (I3DCommit *) self; + IObject *thisObject = InterfaceToIObject(thiz); object_lock_exclusive(thisObject); - this->mDeferred = SL_BOOLEAN_FALSE != deferred; // normalize + thiz->mDeferred = SL_BOOLEAN_FALSE != deferred; // normalize object_unlock_exclusive(thisObject); result = SL_RESULT_SUCCESS; @@ -62,9 +62,9 @@ static const struct SL3DCommitItf_ I3DCommit_Itf = { void I3DCommit_init(void *self) { - I3DCommit *this = (I3DCommit *) self; - this->mItf = &I3DCommit_Itf; - this->mDeferred = SL_BOOLEAN_FALSE; - this->mGeneration = 0; - this->mWaiting = 0; + I3DCommit *thiz = (I3DCommit *) self; + thiz->mItf = &I3DCommit_Itf; + thiz->mDeferred = SL_BOOLEAN_FALSE; + thiz->mGeneration = 0; + thiz->mWaiting = 0; } diff --git a/src/itf/I3DDoppler.c b/src/itf/I3DDoppler.c index 5ae317e..8a20f81 100644 --- a/src/itf/I3DDoppler.c +++ b/src/itf/I3DDoppler.c @@ -26,12 +26,12 @@ static SLresult I3DDoppler_SetVelocityCartesian(SL3DDopplerItf self, const SLVec if (NULL == pVelocity) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DDoppler *this = (I3DDoppler *) self; + I3DDoppler *thiz = (I3DDoppler *) self; SLVec3D velocityCartesian = *pVelocity; - interface_lock_exclusive(this); - this->mVelocityCartesian = velocityCartesian; - this->mVelocityActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mVelocityCartesian = velocityCartesian; + thiz->mVelocityActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -44,13 +44,13 @@ static SLresult I3DDoppler_SetVelocitySpherical(SL3DDopplerItf self, { SL_ENTER_INTERFACE - I3DDoppler *this = (I3DDoppler *) self; - interface_lock_exclusive(this); - this->mVelocitySpherical.mAzimuth = azimuth; - this->mVelocitySpherical.mElevation = elevation; - this->mVelocitySpherical.mSpeed = speed; - this->mVelocityActive = CARTESIAN_UNKNOWN_SPHERICAL_SET; - interface_unlock_exclusive(this); + I3DDoppler *thiz = (I3DDoppler *) self; + interface_lock_exclusive(thiz); + thiz->mVelocitySpherical.mAzimuth = azimuth; + thiz->mVelocitySpherical.mElevation = elevation; + thiz->mVelocitySpherical.mSpeed = speed; + thiz->mVelocityActive = CARTESIAN_UNKNOWN_SPHERICAL_SET; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -64,35 +64,35 @@ static SLresult I3DDoppler_GetVelocityCartesian(SL3DDopplerItf self, SLVec3D *pV if (NULL == pVelocity) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DDoppler *this = (I3DDoppler *) self; - interface_lock_exclusive(this); + I3DDoppler *thiz = (I3DDoppler *) self; + interface_lock_exclusive(thiz); for (;;) { - enum CartesianSphericalActive velocityActive = this->mVelocityActive; + enum CartesianSphericalActive velocityActive = thiz->mVelocityActive; switch (velocityActive) { case CARTESIAN_COMPUTED_SPHERICAL_SET: case CARTESIAN_SET_SPHERICAL_COMPUTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_REQUESTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_UNKNOWN: { - SLVec3D velocityCartesian = this->mVelocityCartesian; - interface_unlock_exclusive(this); + SLVec3D velocityCartesian = thiz->mVelocityCartesian; + interface_unlock_exclusive(thiz); *pVelocity = velocityCartesian; } break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: - this->mVelocityActive = CARTESIAN_REQUESTED_SPHERICAL_SET; + thiz->mVelocityActive = CARTESIAN_REQUESTED_SPHERICAL_SET; // fall through case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 - interface_cond_wait(this); + interface_cond_wait(thiz); #else - this->mVelocityActive = CARTESIAN_COMPUTED_SPHERICAL_SET; + thiz->mVelocityActive = CARTESIAN_COMPUTED_SPHERICAL_SET; #endif continue; default: assert(SL_BOOLEAN_FALSE); - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); pVelocity->x = 0; pVelocity->y = 0; pVelocity->z = 0; @@ -111,10 +111,10 @@ static SLresult I3DDoppler_SetDopplerFactor(SL3DDopplerItf self, SLpermille dopp { SL_ENTER_INTERFACE - I3DDoppler *this = (I3DDoppler *) self; - interface_lock_poke(this); - this->mDopplerFactor = dopplerFactor; - interface_unlock_poke(this); + I3DDoppler *thiz = (I3DDoppler *) self; + interface_lock_poke(thiz); + thiz->mDopplerFactor = dopplerFactor; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -128,10 +128,10 @@ static SLresult I3DDoppler_GetDopplerFactor(SL3DDopplerItf self, SLpermille *pDo if (NULL == pDopplerFactor) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DDoppler *this = (I3DDoppler *) self; - interface_lock_peek(this); - SLpermille dopplerFactor = this->mDopplerFactor; - interface_unlock_peek(this); + I3DDoppler *thiz = (I3DDoppler *) self; + interface_lock_peek(thiz); + SLpermille dopplerFactor = thiz->mDopplerFactor; + interface_unlock_peek(thiz); *pDopplerFactor = dopplerFactor; result = SL_RESULT_SUCCESS; } @@ -150,12 +150,12 @@ static const struct SL3DDopplerItf_ I3DDoppler_Itf = { void I3DDoppler_init(void *self) { - I3DDoppler *this = (I3DDoppler *) self; - this->mItf = &I3DDoppler_Itf; - this->mVelocityCartesian.x = 0; - this->mVelocityCartesian.y = 0; - this->mVelocityCartesian.z = 0; - memset(&this->mVelocitySpherical, 0x55, sizeof(this->mVelocitySpherical)); - this->mVelocityActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; - this->mDopplerFactor = 1000; + I3DDoppler *thiz = (I3DDoppler *) self; + thiz->mItf = &I3DDoppler_Itf; + thiz->mVelocityCartesian.x = 0; + thiz->mVelocityCartesian.y = 0; + thiz->mVelocityCartesian.z = 0; + memset(&thiz->mVelocitySpherical, 0x55, sizeof(thiz->mVelocitySpherical)); + thiz->mVelocityActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; + thiz->mDopplerFactor = 1000; } diff --git a/src/itf/I3DGrouping.c b/src/itf/I3DGrouping.c index 9c45fbc..45172b3 100644 --- a/src/itf/I3DGrouping.c +++ b/src/itf/I3DGrouping.c @@ -34,15 +34,15 @@ static SLresult I3DGrouping_Set3DGroup(SL3DGroupingItf self, SLObjectItf group) // the new group is left unlocked, but it will be locked again below } if (SL_RESULT_SUCCESS == result) { - I3DGrouping *this = (I3DGrouping *) self; - IObject *thisObject = InterfaceToIObject(this); + I3DGrouping *thiz = (I3DGrouping *) self; + IObject *thisObject = InterfaceToIObject(thiz); unsigned id = thisObject->mInstanceID; assert(0 != id); // player object must be published by this point --id; assert(MAX_INSTANCE > id); unsigned mask = 1 << id; - interface_lock_exclusive(this); - C3DGroup *oldGroup = this->mGroup; + interface_lock_exclusive(thiz); + C3DGroup *oldGroup = thiz->mGroup; if (newGroup != oldGroup) { // remove this object from the old group's set of objects if (NULL != oldGroup) { @@ -63,9 +63,9 @@ static SLresult I3DGrouping_Set3DGroup(SL3DGroupingItf self, SLObjectItf group) newGroup->mMemberMask |= mask; object_unlock_exclusive(newGroupObject); } - this->mGroup = newGroup; + thiz->mGroup = newGroup; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -79,11 +79,11 @@ static SLresult I3DGrouping_Get3DGroup(SL3DGroupingItf self, SLObjectItf *pGroup if (NULL == pGroup) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DGrouping *this = (I3DGrouping *) self; - interface_lock_shared(this); - C3DGroup *group = this->mGroup; + I3DGrouping *thiz = (I3DGrouping *) self; + interface_lock_shared(thiz); + C3DGroup *group = thiz->mGroup; *pGroup = (NULL != group) ? &group->mObject.mItf : NULL; - interface_unlock_shared(this); + interface_unlock_shared(thiz); result = SL_RESULT_SUCCESS; } @@ -98,17 +98,17 @@ static const struct SL3DGroupingItf_ I3DGrouping_Itf = { void I3DGrouping_init(void *self) { - I3DGrouping *this = (I3DGrouping *) self; - this->mItf = &I3DGrouping_Itf; - this->mGroup = NULL; + I3DGrouping *thiz = (I3DGrouping *) self; + thiz->mItf = &I3DGrouping_Itf; + thiz->mGroup = NULL; } void I3DGrouping_deinit(void *self) { - I3DGrouping *this = (I3DGrouping *) self; - C3DGroup *group = this->mGroup; + I3DGrouping *thiz = (I3DGrouping *) self; + C3DGroup *group = thiz->mGroup; if (NULL != group) { - unsigned mask = 1 << (InterfaceToIObject(this)->mInstanceID - 1); + unsigned mask = 1 << (InterfaceToIObject(thiz)->mInstanceID - 1); IObject *groupObject = &group->mObject; object_lock_exclusive(groupObject); assert(group->mMemberMask & mask); diff --git a/src/itf/I3DLocation.c b/src/itf/I3DLocation.c index 635913d..c0eff3b 100644 --- a/src/itf/I3DLocation.c +++ b/src/itf/I3DLocation.c @@ -26,12 +26,12 @@ static SLresult I3DLocation_SetLocationCartesian(SL3DLocationItf self, const SLV if (NULL == pLocation) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; + I3DLocation *thiz = (I3DLocation *) self; SLVec3D locationCartesian = *pLocation; - interface_lock_exclusive(this); - this->mLocationCartesian = locationCartesian; - this->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mLocationCartesian = locationCartesian; + thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -49,13 +49,13 @@ static SLresult I3DLocation_SetLocationSpherical(SL3DLocationItf self, (0 <= distance) && (distance <= SL_MILLIMETER_MAX))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; - interface_lock_exclusive(this); - this->mLocationSpherical.mAzimuth = azimuth; - this->mLocationSpherical.mElevation = elevation; - this->mLocationSpherical.mDistance = distance; - this->mLocationActive = CARTESIAN_UNKNOWN_SPHERICAL_SET; - interface_unlock_exclusive(this); + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_exclusive(thiz); + thiz->mLocationSpherical.mAzimuth = azimuth; + thiz->mLocationSpherical.mElevation = elevation; + thiz->mLocationSpherical.mDistance = distance; + thiz->mLocationActive = CARTESIAN_UNKNOWN_SPHERICAL_SET; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -70,30 +70,30 @@ static SLresult I3DLocation_Move(SL3DLocationItf self, const SLVec3D *pMovement) if (NULL == pMovement) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; + I3DLocation *thiz = (I3DLocation *) self; SLVec3D movementCartesian = *pMovement; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); for (;;) { - enum CartesianSphericalActive locationActive = this->mLocationActive; + enum CartesianSphericalActive locationActive = thiz->mLocationActive; switch (locationActive) { case CARTESIAN_COMPUTED_SPHERICAL_SET: case CARTESIAN_SET_SPHERICAL_COMPUTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_REQUESTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_UNKNOWN: - this->mLocationCartesian.x += movementCartesian.x; - this->mLocationCartesian.y += movementCartesian.y; - this->mLocationCartesian.z += movementCartesian.z; - this->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; + thiz->mLocationCartesian.x += movementCartesian.x; + thiz->mLocationCartesian.y += movementCartesian.y; + thiz->mLocationCartesian.z += movementCartesian.z; + thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: - this->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; + thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; // fall through case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 - interface_cond_wait(this); + interface_cond_wait(thiz); #else - this->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET; + thiz->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET; #endif continue; default: @@ -102,7 +102,7 @@ static SLresult I3DLocation_Move(SL3DLocationItf self, const SLVec3D *pMovement) } break; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -117,35 +117,35 @@ static SLresult I3DLocation_GetLocationCartesian(SL3DLocationItf self, SLVec3D * if (NULL == pLocation) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; - interface_lock_exclusive(this); + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_exclusive(thiz); for (;;) { - enum CartesianSphericalActive locationActive = this->mLocationActive; + enum CartesianSphericalActive locationActive = thiz->mLocationActive; switch (locationActive) { case CARTESIAN_COMPUTED_SPHERICAL_SET: case CARTESIAN_SET_SPHERICAL_COMPUTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_REQUESTED: // not in 1.0.1 case CARTESIAN_SET_SPHERICAL_UNKNOWN: { - SLVec3D locationCartesian = this->mLocationCartesian; - interface_unlock_exclusive(this); + SLVec3D locationCartesian = thiz->mLocationCartesian; + interface_unlock_exclusive(thiz); *pLocation = locationCartesian; } break; case CARTESIAN_UNKNOWN_SPHERICAL_SET: - this->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; + thiz->mLocationActive = CARTESIAN_REQUESTED_SPHERICAL_SET; // fall through case CARTESIAN_REQUESTED_SPHERICAL_SET: // matched by cond_broadcast in case multiple requesters #if 0 - interface_cond_wait(this); + interface_cond_wait(thiz); #else - this->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET; + thiz->mLocationActive = CARTESIAN_COMPUTED_SPHERICAL_SET; #endif continue; default: assert(SL_BOOLEAN_FALSE); - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); pLocation->x = 0; pLocation->y = 0; pLocation->z = 0; @@ -171,13 +171,13 @@ static SLresult I3DLocation_SetOrientationVectors(SL3DLocationItf self, SLVec3D front = *pFront; SLVec3D above = *pAbove; // NTH Check for vectors close to zero or close to parallel - I3DLocation *this = (I3DLocation *) self; - interface_lock_exclusive(this); - this->mOrientationVectors.mFront = front; - this->mOrientationVectors.mAbove = above; - this->mOrientationActive = ANGLES_UNKNOWN_VECTORS_SET; - this->mRotatePending = SL_BOOLEAN_FALSE; - interface_unlock_exclusive(this); + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_exclusive(thiz); + thiz->mOrientationVectors.mFront = front; + thiz->mOrientationVectors.mAbove = above; + thiz->mOrientationActive = ANGLES_UNKNOWN_VECTORS_SET; + thiz->mRotatePending = SL_BOOLEAN_FALSE; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -195,14 +195,14 @@ static SLresult I3DLocation_SetOrientationAngles(SL3DLocationItf self, (-360000 <= roll) && (roll <= 360000))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; - interface_lock_exclusive(this); - this->mOrientationAngles.mHeading = heading; - this->mOrientationAngles.mPitch = pitch; - this->mOrientationAngles.mRoll = roll; - this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; - this->mRotatePending = SL_BOOLEAN_FALSE; - interface_unlock_exclusive(this); + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_exclusive(thiz); + thiz->mOrientationAngles.mHeading = heading; + thiz->mOrientationAngles.mPitch = pitch; + thiz->mOrientationAngles.mRoll = roll; + thiz->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; + thiz->mRotatePending = SL_BOOLEAN_FALSE; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -219,18 +219,18 @@ static SLresult I3DLocation_Rotate(SL3DLocationItf self, SLmillidegree theta, co } else { SLVec3D axis = *pAxis; // NTH Check that axis is not (close to) zero vector, length does not matter - I3DLocation *this = (I3DLocation *) self; - interface_lock_exclusive(this); - while (this->mRotatePending) + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_exclusive(thiz); + while (thiz->mRotatePending) #if 0 - interface_cond_wait(this); + interface_cond_wait(thiz); #else break; #endif - this->mTheta = theta; - this->mAxis = axis; - this->mRotatePending = SL_BOOLEAN_TRUE; - interface_unlock_exclusive(this); + thiz->mTheta = theta; + thiz->mAxis = axis; + thiz->mRotatePending = SL_BOOLEAN_TRUE; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -246,11 +246,11 @@ static SLresult I3DLocation_GetOrientationVectors(SL3DLocationItf self, if (NULL == pFront || NULL == pUp) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DLocation *this = (I3DLocation *) self; - interface_lock_shared(this); - SLVec3D front = this->mOrientationVectors.mFront; - SLVec3D up = this->mOrientationVectors.mUp; - interface_unlock_shared(this); + I3DLocation *thiz = (I3DLocation *) self; + interface_lock_shared(thiz); + SLVec3D front = thiz->mOrientationVectors.mFront; + SLVec3D up = thiz->mOrientationVectors.mUp; + interface_unlock_shared(thiz); *pFront = front; *pUp = up; result = SL_RESULT_SUCCESS; @@ -273,21 +273,21 @@ static const struct SL3DLocationItf_ I3DLocation_Itf = { void I3DLocation_init(void *self) { - I3DLocation *this = (I3DLocation *) self; - this->mItf = &I3DLocation_Itf; - this->mLocationCartesian.x = 0; - this->mLocationCartesian.y = 0; - this->mLocationCartesian.z = 0; - memset(&this->mLocationSpherical, 0x55, sizeof(this->mLocationSpherical)); - this->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; - this->mOrientationAngles.mHeading = 0; - this->mOrientationAngles.mPitch = 0; - this->mOrientationAngles.mRoll = 0; - memset(&this->mOrientationVectors, 0x55, sizeof(this->mOrientationVectors)); - this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; - this->mTheta = 0x55555555; - this->mAxis.x = 0x55555555; - this->mAxis.y = 0x55555555; - this->mAxis.z = 0x55555555; - this->mRotatePending = SL_BOOLEAN_FALSE; + I3DLocation *thiz = (I3DLocation *) self; + thiz->mItf = &I3DLocation_Itf; + thiz->mLocationCartesian.x = 0; + thiz->mLocationCartesian.y = 0; + thiz->mLocationCartesian.z = 0; + memset(&thiz->mLocationSpherical, 0x55, sizeof(thiz->mLocationSpherical)); + thiz->mLocationActive = CARTESIAN_SET_SPHERICAL_UNKNOWN; + thiz->mOrientationAngles.mHeading = 0; + thiz->mOrientationAngles.mPitch = 0; + thiz->mOrientationAngles.mRoll = 0; + memset(&thiz->mOrientationVectors, 0x55, sizeof(thiz->mOrientationVectors)); + thiz->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; + thiz->mTheta = 0x55555555; + thiz->mAxis.x = 0x55555555; + thiz->mAxis.y = 0x55555555; + thiz->mAxis.z = 0x55555555; + thiz->mRotatePending = SL_BOOLEAN_FALSE; } diff --git a/src/itf/I3DMacroscopic.c b/src/itf/I3DMacroscopic.c index 3330dbe..feb91e2 100644 --- a/src/itf/I3DMacroscopic.c +++ b/src/itf/I3DMacroscopic.c @@ -29,12 +29,12 @@ static SLresult I3DMacroscopic_SetSize(SL3DMacroscopicItf self, (0 <= depth) && (depth <= SL_MILLIMETER_MAX))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DMacroscopic *this = (I3DMacroscopic *) self; - interface_lock_exclusive(this); - this->mSize.mWidth = width; - this->mSize.mHeight = height; - this->mSize.mDepth = depth; - interface_unlock_exclusive(this); + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + interface_lock_exclusive(thiz); + thiz->mSize.mWidth = width; + thiz->mSize.mHeight = height; + thiz->mSize.mDepth = depth; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -50,12 +50,12 @@ static SLresult I3DMacroscopic_GetSize(SL3DMacroscopicItf self, if (NULL == pWidth || NULL == pHeight || NULL == pDepth) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DMacroscopic *this = (I3DMacroscopic *) self; - interface_lock_shared(this); - SLmillimeter width = this->mSize.mWidth; - SLmillimeter height = this->mSize.mHeight; - SLmillimeter depth = this->mSize.mDepth; - interface_unlock_shared(this); + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + interface_lock_shared(thiz); + SLmillimeter width = thiz->mSize.mWidth; + SLmillimeter height = thiz->mSize.mHeight; + SLmillimeter depth = thiz->mSize.mDepth; + interface_unlock_shared(thiz); *pWidth = width; *pHeight = height; *pDepth = depth; @@ -76,15 +76,15 @@ static SLresult I3DMacroscopic_SetOrientationAngles(SL3DMacroscopicItf self, (-360000 <= roll) && (roll <= 360000))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DMacroscopic *this = (I3DMacroscopic *) self; - interface_lock_exclusive(this); - this->mOrientationAngles.mHeading = heading; - this->mOrientationAngles.mPitch = pitch; - this->mOrientationAngles.mRoll = roll; - this->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; - this->mRotatePending = SL_BOOLEAN_FALSE; - // ++this->mGeneration; - interface_unlock_exclusive(this); + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + interface_lock_exclusive(thiz); + thiz->mOrientationAngles.mHeading = heading; + thiz->mOrientationAngles.mPitch = pitch; + thiz->mOrientationAngles.mRoll = roll; + thiz->mOrientationActive = ANGLES_SET_VECTORS_UNKNOWN; + thiz->mRotatePending = SL_BOOLEAN_FALSE; + // ++thiz->mGeneration; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -100,17 +100,17 @@ static SLresult I3DMacroscopic_SetOrientationVectors(SL3DMacroscopicItf self, if (NULL == pFront || NULL == pAbove) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DMacroscopic *this = (I3DMacroscopic *) self; + I3DMacroscopic *thiz = (I3DMacroscopic *) self; SLVec3D front = *pFront; SLVec3D above = *pAbove; // NTH Check for vectors close to zero or close to parallel - interface_lock_exclusive(this); - this->mOrientationVectors.mFront = front; - this->mOrientationVectors.mAbove = above; - this->mOrientationVectors.mUp = above; // wrong - this->mOrientationActive = ANGLES_UNKNOWN_VECTORS_SET; - this->mRotatePending = SL_BOOLEAN_FALSE; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mOrientationVectors.mFront = front; + thiz->mOrientationVectors.mAbove = above; + thiz->mOrientationVectors.mUp = above; // wrong + thiz->mOrientationActive = ANGLES_UNKNOWN_VECTORS_SET; + thiz->mRotatePending = SL_BOOLEAN_FALSE; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -128,14 +128,14 @@ static SLresult I3DMacroscopic_Rotate(SL3DMacroscopicItf self, } else { SLVec3D axis = *pAxis; // NTH Check that axis is not (close to) zero vector, length does not matter - I3DMacroscopic *this = (I3DMacroscopic *) self; - interface_lock_exclusive(this); - while (this->mRotatePending) - interface_cond_wait(this); - this->mTheta = theta; - this->mAxis = axis; - this->mRotatePending = SL_BOOLEAN_TRUE; - interface_unlock_exclusive(this); + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + interface_lock_exclusive(thiz); + while (thiz->mRotatePending) + interface_cond_wait(thiz); + thiz->mTheta = theta; + thiz->mAxis = axis; + thiz->mRotatePending = SL_BOOLEAN_TRUE; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -151,36 +151,36 @@ static SLresult I3DMacroscopic_GetOrientationVectors(SL3DMacroscopicItf self, if (NULL == pFront || NULL == pUp) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DMacroscopic *this = (I3DMacroscopic *) self; - interface_lock_exclusive(this); + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + interface_lock_exclusive(thiz); for (;;) { - enum AnglesVectorsActive orientationActive = this->mOrientationActive; + enum AnglesVectorsActive orientationActive = thiz->mOrientationActive; switch (orientationActive) { case ANGLES_COMPUTED_VECTORS_SET: // not in 1.0.1 case ANGLES_REQUESTED_VECTORS_SET: // not in 1.0.1 case ANGLES_UNKNOWN_VECTORS_SET: case ANGLES_SET_VECTORS_COMPUTED: { - SLVec3D front = this->mOrientationVectors.mFront; - SLVec3D up = this->mOrientationVectors.mUp; - interface_unlock_exclusive(this); + SLVec3D front = thiz->mOrientationVectors.mFront; + SLVec3D up = thiz->mOrientationVectors.mUp; + interface_unlock_exclusive(thiz); *pFront = front; *pUp = up; } break; case ANGLES_SET_VECTORS_UNKNOWN: - this->mOrientationActive = ANGLES_SET_VECTORS_REQUESTED; + thiz->mOrientationActive = ANGLES_SET_VECTORS_REQUESTED; // fall through case ANGLES_SET_VECTORS_REQUESTED: // matched by cond_broadcast in case multiple requesters #if 0 - interface_cond_wait(this); + interface_cond_wait(thiz); #else - this->mOrientationActive = ANGLES_SET_VECTORS_COMPUTED; + thiz->mOrientationActive = ANGLES_SET_VECTORS_COMPUTED; #endif continue; default: - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); assert(SL_BOOLEAN_FALSE); pFront->x = 0; pFront->y = 0; @@ -210,28 +210,28 @@ static const struct SL3DMacroscopicItf_ I3DMacroscopic_Itf = { void I3DMacroscopic_init(void *self) { - I3DMacroscopic *this = (I3DMacroscopic *) self; - this->mItf = &I3DMacroscopic_Itf; - this->mSize.mWidth = 0; - this->mSize.mHeight = 0; - this->mSize.mDepth = 0; - this->mOrientationAngles.mHeading = 0; - this->mOrientationAngles.mPitch = 0; - this->mOrientationAngles.mRoll = 0; - memset(&this->mOrientationVectors, 0x55, sizeof(this->mOrientationVectors)); - this->mOrientationVectors.mFront.x = 0; - this->mOrientationVectors.mFront.y = 0; - this->mOrientationVectors.mFront.z = -1000; - this->mOrientationVectors.mUp.x = 0; - this->mOrientationVectors.mUp.y = 1000; - this->mOrientationVectors.mUp.z = 0; - this->mOrientationVectors.mAbove.x = 0; - this->mOrientationVectors.mAbove.y = 0; - this->mOrientationVectors.mAbove.z = 0; - this->mOrientationActive = ANGLES_SET_VECTORS_COMPUTED; - this->mTheta = 0x55555555; - this->mAxis.x = 0x55555555; - this->mAxis.y = 0x55555555; - this->mAxis.z = 0x55555555; - this->mRotatePending = SL_BOOLEAN_FALSE; + I3DMacroscopic *thiz = (I3DMacroscopic *) self; + thiz->mItf = &I3DMacroscopic_Itf; + thiz->mSize.mWidth = 0; + thiz->mSize.mHeight = 0; + thiz->mSize.mDepth = 0; + thiz->mOrientationAngles.mHeading = 0; + thiz->mOrientationAngles.mPitch = 0; + thiz->mOrientationAngles.mRoll = 0; + memset(&thiz->mOrientationVectors, 0x55, sizeof(thiz->mOrientationVectors)); + thiz->mOrientationVectors.mFront.x = 0; + thiz->mOrientationVectors.mFront.y = 0; + thiz->mOrientationVectors.mFront.z = -1000; + thiz->mOrientationVectors.mUp.x = 0; + thiz->mOrientationVectors.mUp.y = 1000; + thiz->mOrientationVectors.mUp.z = 0; + thiz->mOrientationVectors.mAbove.x = 0; + thiz->mOrientationVectors.mAbove.y = 0; + thiz->mOrientationVectors.mAbove.z = 0; + thiz->mOrientationActive = ANGLES_SET_VECTORS_COMPUTED; + thiz->mTheta = 0x55555555; + thiz->mAxis.x = 0x55555555; + thiz->mAxis.y = 0x55555555; + thiz->mAxis.z = 0x55555555; + thiz->mRotatePending = SL_BOOLEAN_FALSE; } diff --git a/src/itf/I3DSource.c b/src/itf/I3DSource.c index bc08a4e..fdc7d36 100644 --- a/src/itf/I3DSource.c +++ b/src/itf/I3DSource.c @@ -23,10 +23,10 @@ static SLresult I3DSource_SetHeadRelative(SL3DSourceItf self, SLboolean headRela { SL_ENTER_INTERFACE - I3DSource *this = (I3DSource *) self; - interface_lock_poke(this); - this->mHeadRelative = SL_BOOLEAN_FALSE != headRelative; // normalize - interface_unlock_poke(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_poke(thiz); + thiz->mHeadRelative = SL_BOOLEAN_FALSE != headRelative; // normalize + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -40,10 +40,10 @@ static SLresult I3DSource_GetHeadRelative(SL3DSourceItf self, SLboolean *pHeadRe if (NULL == pHeadRelative) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_peek(this); - SLboolean headRelative = this->mHeadRelative; - interface_unlock_peek(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_peek(thiz); + SLboolean headRelative = thiz->mHeadRelative; + interface_unlock_peek(thiz); *pHeadRelative = headRelative; result = SL_RESULT_SUCCESS; } @@ -61,11 +61,11 @@ static SLresult I3DSource_SetRolloffDistances(SL3DSourceItf self, (minDistance <= maxDistance) && (maxDistance <= SL_MILLIMETER_MAX))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_exclusive(this); - this->mMinDistance = minDistance; - this->mMaxDistance = maxDistance; - interface_unlock_exclusive(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_exclusive(thiz); + thiz->mMinDistance = minDistance; + thiz->mMaxDistance = maxDistance; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -81,10 +81,10 @@ static SLresult I3DSource_GetRolloffDistances(SL3DSourceItf self, if (NULL == pMinDistance || NULL == pMaxDistance) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; interface_lock_shared(this); - SLmillimeter minDistance = this->mMinDistance; - SLmillimeter maxDistance = this->mMaxDistance; - interface_unlock_shared(this); + I3DSource *thiz = (I3DSource *) self; interface_lock_shared(thiz); + SLmillimeter minDistance = thiz->mMinDistance; + SLmillimeter maxDistance = thiz->mMaxDistance; + interface_unlock_shared(thiz); *pMinDistance = minDistance; *pMaxDistance = maxDistance; result = SL_RESULT_SUCCESS; @@ -98,10 +98,10 @@ static SLresult I3DSource_SetRolloffMaxDistanceMute(SL3DSourceItf self, SLboolea { SL_ENTER_INTERFACE - I3DSource *this = (I3DSource *) self; - interface_lock_poke(this); - this->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE != mute; // normalize - interface_unlock_poke(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_poke(thiz); + thiz->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE != mute; // normalize + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -115,10 +115,10 @@ static SLresult I3DSource_GetRolloffMaxDistanceMute(SL3DSourceItf self, SLboolea if (NULL == pMute) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_peek(this); - SLboolean mute = this->mRolloffMaxDistanceMute; - interface_unlock_peek(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_peek(thiz); + SLboolean mute = thiz->mRolloffMaxDistanceMute; + interface_unlock_peek(thiz); *pMute = mute; result = SL_RESULT_SUCCESS; } @@ -134,10 +134,10 @@ static SLresult I3DSource_SetRolloffFactor(SL3DSourceItf self, SLpermille rollof if (!((0 <= rolloffFactor) && (rolloffFactor <= 10000))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_poke(this); - this->mRolloffFactor = rolloffFactor; - interface_unlock_poke(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_poke(thiz); + thiz->mRolloffFactor = rolloffFactor; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -149,10 +149,10 @@ static SLresult I3DSource_GetRolloffFactor(SL3DSourceItf self, SLpermille *pRoll { SL_ENTER_INTERFACE - I3DSource *this = (I3DSource *) self; - interface_lock_peek(this); - SLpermille rolloffFactor = this->mRolloffFactor; - interface_unlock_peek(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_peek(thiz); + SLpermille rolloffFactor = thiz->mRolloffFactor; + interface_unlock_peek(thiz); *pRolloffFactor = rolloffFactor; result = SL_RESULT_SUCCESS; @@ -167,10 +167,10 @@ static SLresult I3DSource_SetRoomRolloffFactor(SL3DSourceItf self, SLpermille ro if (!((0 <= roomRolloffFactor) && (roomRolloffFactor <= 10000))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_poke(this); - this->mRoomRolloffFactor = roomRolloffFactor; - interface_unlock_poke(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_poke(thiz); + thiz->mRoomRolloffFactor = roomRolloffFactor; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -182,10 +182,10 @@ static SLresult I3DSource_GetRoomRolloffFactor(SL3DSourceItf self, SLpermille *p { SL_ENTER_INTERFACE - I3DSource *this = (I3DSource *) self; - interface_lock_peek(this); - SLpermille roomRolloffFactor = this->mRoomRolloffFactor; - interface_unlock_peek(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_peek(thiz); + SLpermille roomRolloffFactor = thiz->mRoomRolloffFactor; + interface_unlock_peek(thiz); *pRoomRolloffFactor = roomRolloffFactor; result = SL_RESULT_SUCCESS; @@ -201,10 +201,10 @@ static SLresult I3DSource_SetRolloffModel(SL3DSourceItf self, SLuint8 model) case SL_ROLLOFFMODEL_LINEAR: case SL_ROLLOFFMODEL_EXPONENTIAL: { - I3DSource *this = (I3DSource *) self; - interface_lock_poke(this); - this->mDistanceModel = model; - interface_unlock_poke(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_poke(thiz); + thiz->mDistanceModel = model; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } break; @@ -221,10 +221,10 @@ static SLresult I3DSource_GetRolloffModel(SL3DSourceItf self, SLuint8 *pModel) { SL_ENTER_INTERFACE - I3DSource *this = (I3DSource *) self; - interface_lock_peek(this); - SLuint8 model = this->mDistanceModel; - interface_unlock_peek(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_peek(thiz); + SLuint8 model = thiz->mDistanceModel; + interface_unlock_peek(thiz); *pModel = model; result = SL_RESULT_SUCCESS; @@ -242,12 +242,12 @@ static SLresult I3DSource_SetCone(SL3DSourceItf self, SLmillidegree innerAngle, (SL_MILLIBEL_MIN <= outerLevel) && (outerLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_exclusive(this); - this->mConeInnerAngle = innerAngle; - this->mConeOuterAngle = outerAngle; - this->mConeOuterLevel = outerLevel; - interface_unlock_exclusive(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_exclusive(thiz); + thiz->mConeInnerAngle = innerAngle; + thiz->mConeOuterAngle = outerAngle; + thiz->mConeOuterLevel = outerLevel; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -263,12 +263,12 @@ static SLresult I3DSource_GetCone(SL3DSourceItf self, SLmillidegree *pInnerAngle if (NULL == pInnerAngle || NULL == pOuterAngle || NULL == pOuterLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - I3DSource *this = (I3DSource *) self; - interface_lock_shared(this); - SLmillidegree innerAngle = this->mConeInnerAngle; - SLmillidegree outerAngle = this->mConeOuterAngle; - SLmillibel outerLevel = this->mConeOuterLevel; - interface_unlock_shared(this); + I3DSource *thiz = (I3DSource *) self; + interface_lock_shared(thiz); + SLmillidegree innerAngle = thiz->mConeInnerAngle; + SLmillidegree outerAngle = thiz->mConeOuterAngle; + SLmillibel outerLevel = thiz->mConeOuterLevel; + interface_unlock_shared(thiz); *pInnerAngle = innerAngle; *pOuterAngle = outerAngle; *pOuterLevel = outerLevel; @@ -298,16 +298,16 @@ static const struct SL3DSourceItf_ I3DSource_Itf = { void I3DSource_init(void *self) { - I3DSource *this = (I3DSource *) self; - this->mItf = &I3DSource_Itf; - this->mHeadRelative = SL_BOOLEAN_FALSE; - this->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE; - this->mMaxDistance = SL_MILLIMETER_MAX; - this->mMinDistance = 1000; - this->mConeInnerAngle = 360000; - this->mConeOuterAngle = 360000; - this->mConeOuterLevel = 0; - this->mRolloffFactor = 1000; - this->mRoomRolloffFactor = 0; - this->mDistanceModel = SL_ROLLOFFMODEL_EXPONENTIAL; + I3DSource *thiz = (I3DSource *) self; + thiz->mItf = &I3DSource_Itf; + thiz->mHeadRelative = SL_BOOLEAN_FALSE; + thiz->mRolloffMaxDistanceMute = SL_BOOLEAN_FALSE; + thiz->mMaxDistance = SL_MILLIMETER_MAX; + thiz->mMinDistance = 1000; + thiz->mConeInnerAngle = 360000; + thiz->mConeOuterAngle = 360000; + thiz->mConeOuterLevel = 0; + thiz->mRolloffFactor = 1000; + thiz->mRoomRolloffFactor = 0; + thiz->mDistanceModel = SL_ROLLOFFMODEL_EXPONENTIAL; } diff --git a/src/itf/IAndroidBufferQueue.c b/src/itf/IAndroidBufferQueue.c index 6ec1e33..4bc5e5e 100644 --- a/src/itf/IAndroidBufferQueue.c +++ b/src/itf/IAndroidBufferQueue.c @@ -23,25 +23,25 @@ SLresult IAndroidBufferQueue_RegisterCallback(SLAndroidBufferQueueItf self, { SL_ENTER_INTERFACE - IAndroidBufferQueue *this = (IAndroidBufferQueue *) self; + IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); // verify pre-condition that media object is in the SL_PLAYSTATE_STOPPED state // FIXME PRIORITY 1 check play state - //if (SL_PLAYSTATE_STOPPED == ((CAudioPlayer*) this->mThis)->mPlay.mState) { - this->mCallback = callback; - this->mContext = pContext; + //if (SL_PLAYSTATE_STOPPED == ((CAudioPlayer*) thiz->mThis)->mPlay.mState) { + thiz->mCallback = callback; + thiz->mContext = pContext; - switch (InterfaceToObjectID(this)) { + switch (InterfaceToObjectID(thiz)) { case SL_OBJECTID_AUDIOPLAYER: result = SL_RESULT_SUCCESS; - android_audioPlayer_androidBufferQueue_registerCallback_l((CAudioPlayer*) this->mThis); + android_audioPlayer_androidBufferQueue_registerCallback_l((CAudioPlayer*) thiz->mThis); break; case XA_OBJECTID_MEDIAPLAYER: SL_LOGI("IAndroidBufferQueue_RegisterCallback()"); result = SL_RESULT_SUCCESS; - android_Player_androidBufferQueue_registerCallback_l((CMediaPlayer*) this->mThis); + android_Player_androidBufferQueue_registerCallback_l((CMediaPlayer*) thiz->mThis); break; default: result = SL_RESULT_PARAMETER_INVALID; @@ -52,7 +52,7 @@ SLresult IAndroidBufferQueue_RegisterCallback(SLAndroidBufferQueueItf self, // result = SL_RESULT_PRECONDITIONS_VIOLATED; //} - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -62,15 +62,15 @@ SLresult IAndroidBufferQueue_Clear(SLAndroidBufferQueueItf self) { SL_ENTER_INTERFACE - IAndroidBufferQueue *this = (IAndroidBufferQueue *) self; + IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); // FIXME return value? result = SL_RESULT_SUCCESS; - android_audioPlayer_androidBufferQueue_clear_l((CAudioPlayer*) this->mThis); + android_audioPlayer_androidBufferQueue_clear_l((CAudioPlayer*) thiz->mThis); - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -84,22 +84,22 @@ SLresult IAndroidBufferQueue_Enqueue(SLAndroidBufferQueueItf self, { SL_ENTER_INTERFACE - IAndroidBufferQueue *this = (IAndroidBufferQueue *) self; + IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); // FIXME return value? of particular interest: error is length is larger than size received // in callback - switch (InterfaceToObjectID(this)) { + switch (InterfaceToObjectID(thiz)) { case SL_OBJECTID_AUDIOPLAYER: result = SL_RESULT_SUCCESS; - android_audioPlayer_androidBufferQueue_enqueue_l((CAudioPlayer*) this->mThis, + android_audioPlayer_androidBufferQueue_enqueue_l((CAudioPlayer*) thiz->mThis, bufferId, length, event, pData); break; case XA_OBJECTID_MEDIAPLAYER: //SL_LOGV("IAndroidBufferQueue_Enqueue()"); result = SL_RESULT_SUCCESS; - android_Player_androidBufferQueue_enqueue_l((CMediaPlayer*) this->mThis, + android_Player_androidBufferQueue_enqueue_l((CMediaPlayer*) thiz->mThis, bufferId, length, event, pData); break; default: @@ -107,7 +107,7 @@ SLresult IAndroidBufferQueue_Enqueue(SLAndroidBufferQueueItf self, break; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -121,9 +121,9 @@ static const struct SLAndroidBufferQueueItf_ IAndroidBufferQueue_Itf = { void IAndroidBufferQueue_init(void *self) { - IAndroidBufferQueue *this = (IAndroidBufferQueue *) self; - this->mItf = &IAndroidBufferQueue_Itf; + IAndroidBufferQueue *thiz = (IAndroidBufferQueue *) self; + thiz->mItf = &IAndroidBufferQueue_Itf; - this->mCallback = NULL; - this->mContext = NULL; + thiz->mCallback = NULL; + thiz->mContext = NULL; } diff --git a/src/itf/IAndroidConfiguration.c b/src/itf/IAndroidConfiguration.c index 42e1aae..c96ef9a 100644 --- a/src/itf/IAndroidConfiguration.c +++ b/src/itf/IAndroidConfiguration.c @@ -26,26 +26,26 @@ static SLresult IAndroidConfiguration_SetConfiguration(SLAndroidConfigurationItf { SL_ENTER_INTERFACE - IAndroidConfiguration *this = (IAndroidConfiguration *) self; + IAndroidConfiguration *thiz = (IAndroidConfiguration *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); // route configuration to the appropriate object - if (SL_OBJECTID_AUDIORECORDER == IObjectToObjectID((this)->mThis)) { + if (SL_OBJECTID_AUDIORECORDER == IObjectToObjectID((thiz)->mThis)) { SL_LOGV("SetConfiguration issued for AudioRecorder key=%s valueSize=%lu", configKey, valueSize); - result = android_audioRecorder_setConfig((CAudioRecorder *) this->mThis, configKey, + result = android_audioRecorder_setConfig((CAudioRecorder *) thiz->mThis, configKey, pConfigValue, valueSize); - } else if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID((this)->mThis)) { + } else if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID((thiz)->mThis)) { SL_LOGV("SetConfiguration issued for AudioPlayer key=%s valueSize=%lu", configKey, valueSize); - result = android_audioPlayer_setConfig((CAudioPlayer *) this->mThis, configKey, + result = android_audioPlayer_setConfig((CAudioPlayer *) thiz->mThis, configKey, pConfigValue, valueSize); } else { result = SL_RESULT_PARAMETER_INVALID; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -63,22 +63,22 @@ static SLresult IAndroidConfiguration_GetConfiguration(SLAndroidConfigurationItf if (NULL == pValueSize) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidConfiguration *this = (IAndroidConfiguration *) self; + IAndroidConfiguration *thiz = (IAndroidConfiguration *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); // route configuration request to the appropriate object - if (SL_OBJECTID_AUDIORECORDER == IObjectToObjectID((this)->mThis)) { - result = android_audioRecorder_getConfig((CAudioRecorder *) this->mThis, configKey, + if (SL_OBJECTID_AUDIORECORDER == IObjectToObjectID((thiz)->mThis)) { + result = android_audioRecorder_getConfig((CAudioRecorder *) thiz->mThis, configKey, pValueSize, pConfigValue); - } else if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID((this)->mThis)) { - result = android_audioPlayer_getConfig((CAudioPlayer *) this->mThis, configKey, + } else if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID((thiz)->mThis)) { + result = android_audioPlayer_getConfig((CAudioPlayer *) thiz->mThis, configKey, pValueSize, pConfigValue); } else { result = SL_RESULT_PARAMETER_INVALID; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -92,6 +92,6 @@ static const struct SLAndroidConfigurationItf_ IAndroidConfiguration_Itf = { void IAndroidConfiguration_init(void *self) { - IAndroidConfiguration *this = (IAndroidConfiguration *) self; - this->mItf = &IAndroidConfiguration_Itf; + IAndroidConfiguration *thiz = (IAndroidConfiguration *) self; + thiz->mItf = &IAndroidConfiguration_Itf; } diff --git a/src/itf/IAndroidEffect.cpp b/src/itf/IAndroidEffect.cpp index b934c15..6bdb300 100644 --- a/src/itf/IAndroidEffect.cpp +++ b/src/itf/IAndroidEffect.cpp @@ -24,16 +24,16 @@ static SLresult IAndroidEffect_CreateEffect(SLAndroidEffectItf self, SL_ENTER_INTERFACE - IAndroidEffect *this = (IAndroidEffect *) self; - if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID(this->mThis)) { - CAudioPlayer *ap = (CAudioPlayer *)this->mThis; + IAndroidEffect *thiz = (IAndroidEffect *) self; + if (SL_OBJECTID_AUDIOPLAYER == IObjectToObjectID(thiz->mThis)) { + CAudioPlayer *ap = (CAudioPlayer *)thiz->mThis; if (NULL != ap->mAudioTrack) { - result = android_genericFx_createEffect(this, effectImplementationId, ap->mSessionId); + result = android_genericFx_createEffect(thiz, effectImplementationId, ap->mSessionId); } else { result = SL_RESULT_RESOURCE_ERROR; } - } else if (SL_OBJECTID_OUTPUTMIX == IObjectToObjectID(this->mThis)) { - result = android_genericFx_createEffect(this, effectImplementationId, + } else if (SL_OBJECTID_OUTPUTMIX == IObjectToObjectID(thiz->mThis)) { + result = android_genericFx_createEffect(thiz, effectImplementationId, android::AudioSystem::SESSION_OUTPUT_MIX); } else { // the interface itself is invalid because it is not attached to an AudioPlayer or @@ -50,8 +50,8 @@ static SLresult IAndroidEffect_ReleaseEffect(SLAndroidEffectItf self, SL_ENTER_INTERFACE - IAndroidEffect *this = (IAndroidEffect *) self; - result = android_genericFx_releaseEffect(this, effectImplementationId); + IAndroidEffect *thiz = (IAndroidEffect *) self; + result = android_genericFx_releaseEffect(thiz, effectImplementationId); SL_LEAVE_INTERFACE } @@ -62,8 +62,8 @@ static SLresult IAndroidEffect_SetEnabled(SLAndroidEffectItf self, SL_ENTER_INTERFACE - IAndroidEffect *this = (IAndroidEffect *) self; - result = android_genericFx_setEnabled(this, effectImplementationId, enabled); + IAndroidEffect *thiz = (IAndroidEffect *) self; + result = android_genericFx_setEnabled(thiz, effectImplementationId, enabled); SL_LEAVE_INTERFACE } @@ -74,8 +74,8 @@ static SLresult IAndroidEffect_IsEnabled(SLAndroidEffectItf self, SL_ENTER_INTERFACE - IAndroidEffect *this = (IAndroidEffect *) self; - result = android_genericFx_isEnabled(this, effectImplementationId, pEnabled); + IAndroidEffect *thiz = (IAndroidEffect *) self; + result = android_genericFx_isEnabled(thiz, effectImplementationId, pEnabled); SL_LEAVE_INTERFACE } @@ -87,8 +87,8 @@ static SLresult IAndroidEffect_SendCommand(SLAndroidEffectItf self, SL_ENTER_INTERFACE - IAndroidEffect *this = (IAndroidEffect *) self; - result = android_genericFx_sendCommand(this, effectImplementationId, command, commandSize, + IAndroidEffect *thiz = (IAndroidEffect *) self; + result = android_genericFx_sendCommand(thiz, effectImplementationId, command, commandSize, pCommand, replySize, pReply); SL_LEAVE_INTERFACE @@ -105,26 +105,26 @@ static const struct SLAndroidEffectItf_ IAndroidEffect_Itf = { void IAndroidEffect_init(void *self) { - IAndroidEffect *this = (IAndroidEffect *) self; - this->mItf = &IAndroidEffect_Itf; + IAndroidEffect *thiz = (IAndroidEffect *) self; + thiz->mItf = &IAndroidEffect_Itf; #ifndef TARGET_SIMULATOR - this->mEffects = new android::KeyedVector<SLuint32, android::AudioEffect* >(); + thiz->mEffects = new android::KeyedVector<SLuint32, android::AudioEffect* >(); #endif } void IAndroidEffect_deinit(void *self) { - IAndroidEffect *this = (IAndroidEffect *) self; + IAndroidEffect *thiz = (IAndroidEffect *) self; #ifndef TARGET_SIMULATOR - if (NULL != this->mEffects) { - if (!this->mEffects->isEmpty()) { - for (size_t i = 0 ; i < this->mEffects->size() ; i++) { - delete this->mEffects->valueAt(i); + if (NULL != thiz->mEffects) { + if (!thiz->mEffects->isEmpty()) { + for (size_t i = 0 ; i < thiz->mEffects->size() ; i++) { + delete thiz->mEffects->valueAt(i); } - this->mEffects->clear(); + thiz->mEffects->clear(); } - delete this->mEffects; - this->mEffects = NULL; + delete thiz->mEffects; + thiz->mEffects = NULL; } #endif } diff --git a/src/itf/IAndroidEffectCapabilities.c b/src/itf/IAndroidEffectCapabilities.c index 816e5b2..86c7064 100644 --- a/src/itf/IAndroidEffectCapabilities.c +++ b/src/itf/IAndroidEffectCapabilities.c @@ -27,13 +27,13 @@ static SLresult IAndroidEffectCapabilities_QueryNumEffects(SLAndroidEffectCapabi if (NULL == pNumSupportedAudioEffects) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectCapabilities *this = (IAndroidEffectCapabilities *) self; - interface_lock_peek(this); + IAndroidEffectCapabilities *thiz = (IAndroidEffectCapabilities *) self; + interface_lock_peek(thiz); - *pNumSupportedAudioEffects = this->mNumFx; + *pNumSupportedAudioEffects = thiz->mNumFx; result = SL_RESULT_SUCCESS; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -46,24 +46,24 @@ static SLresult IAndroidEffectCapabilities_QueryEffect(SLAndroidEffectCapabiliti SL_ENTER_INTERFACE - IAndroidEffectCapabilities *this = (IAndroidEffectCapabilities *) self; - if (index > this->mNumFx) { + IAndroidEffectCapabilities *thiz = (IAndroidEffectCapabilities *) self; + if (index > thiz->mNumFx) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_peek(this); + interface_lock_peek(thiz); if (NULL != pEffectType) { - *pEffectType = (SLInterfaceID) &this->mFxDescriptors[index].type; + *pEffectType = (SLInterfaceID) &thiz->mFxDescriptors[index].type; } if (NULL != pEffectImplementation) { - *pEffectImplementation = (SLInterfaceID) &this->mFxDescriptors[index].uuid; + *pEffectImplementation = (SLInterfaceID) &thiz->mFxDescriptors[index].uuid; } if ((NULL != pName) && (0 < *pNameSize)) { - int len = strlen(this->mFxDescriptors[index].name); - strncpy((char*)pName, this->mFxDescriptors[index].name, + int len = strlen(thiz->mFxDescriptors[index].name); + strncpy((char*)pName, thiz->mFxDescriptors[index].name, *pNameSize > len ? len : *pNameSize ); *pNameSize = len; } - interface_unlock_peek(this); + interface_unlock_peek(thiz); result = SL_RESULT_SUCCESS; } @@ -78,30 +78,30 @@ static const struct SLAndroidEffectCapabilitiesItf_ IAndroidEffectCapabilities_I void IAndroidEffectCapabilities_init(void *self) { - IAndroidEffectCapabilities *this = (IAndroidEffectCapabilities *) self; - this->mItf = &IAndroidEffectCapabilities_Itf; + IAndroidEffectCapabilities *thiz = (IAndroidEffectCapabilities *) self; + thiz->mItf = &IAndroidEffectCapabilities_Itf; // This is the default initialization; fields will be updated when interface is exposed - this->mNumFx = 0; - this->mFxDescriptors = NULL; + thiz->mNumFx = 0; + thiz->mFxDescriptors = NULL; } bool IAndroidEffectCapabilities_Expose(void *self) { - IAndroidEffectCapabilities *this = (IAndroidEffectCapabilities *) self; + IAndroidEffectCapabilities *thiz = (IAndroidEffectCapabilities *) self; SLuint32 numEffects = 0; SLresult result = android_genericFx_queryNumEffects(&numEffects); if (SL_RESULT_SUCCESS != result) { SL_LOGE("android_genericFx_queryNumEffects %lu", result); return false; } - this->mNumFx = numEffects; - SL_LOGV("Effect Capabilities has %ld effects", this->mNumFx); - if (this->mNumFx > 0) { - this->mFxDescriptors = (effect_descriptor_t*) new effect_descriptor_t[this->mNumFx]; - for (SLuint32 i = 0 ; i < this->mNumFx ; i++) { + thiz->mNumFx = numEffects; + SL_LOGV("Effect Capabilities has %ld effects", thiz->mNumFx); + if (thiz->mNumFx > 0) { + thiz->mFxDescriptors = (effect_descriptor_t*) new effect_descriptor_t[thiz->mNumFx]; + for (SLuint32 i = 0 ; i < thiz->mNumFx ; i++) { SLresult result2; - result2 = android_genericFx_queryEffect(i, &this->mFxDescriptors[i]); + result2 = android_genericFx_queryEffect(i, &thiz->mFxDescriptors[i]); if (SL_RESULT_SUCCESS != result2) { SL_LOGE("Error (SLresult is %ld) querying effect %ld", result2, i); // Remember the first failing result code, but keep going @@ -111,17 +111,17 @@ bool IAndroidEffectCapabilities_Expose(void *self) } else { SL_LOGV("effect %ld: type=%08x-%04x-%04x-%04x-%02x%02x%02x%02x%02x%02x name=%s", i, - this->mFxDescriptors[i].type.timeLow, - this->mFxDescriptors[i].type.timeMid, - this->mFxDescriptors[i].type.timeHiAndVersion, - this->mFxDescriptors[i].type.clockSeq, - this->mFxDescriptors[i].type.node[0], - this->mFxDescriptors[i].type.node[1], - this->mFxDescriptors[i].type.node[2], - this->mFxDescriptors[i].type.node[3], - this->mFxDescriptors[i].type.node[4], - this->mFxDescriptors[i].type.node[5], - this->mFxDescriptors[i].name); + thiz->mFxDescriptors[i].type.timeLow, + thiz->mFxDescriptors[i].type.timeMid, + thiz->mFxDescriptors[i].type.timeHiAndVersion, + thiz->mFxDescriptors[i].type.clockSeq, + thiz->mFxDescriptors[i].type.node[0], + thiz->mFxDescriptors[i].type.node[1], + thiz->mFxDescriptors[i].type.node[2], + thiz->mFxDescriptors[i].type.node[3], + thiz->mFxDescriptors[i].type.node[4], + thiz->mFxDescriptors[i].type.node[5], + thiz->mFxDescriptors[i].name); } } } @@ -130,10 +130,10 @@ bool IAndroidEffectCapabilities_Expose(void *self) void IAndroidEffectCapabilities_deinit(void *self) { - IAndroidEffectCapabilities *this = (IAndroidEffectCapabilities *) self; + IAndroidEffectCapabilities *thiz = (IAndroidEffectCapabilities *) self; // free effect library data - if (NULL != this->mFxDescriptors) { - delete[] this->mFxDescriptors; - this->mFxDescriptors = NULL; + if (NULL != thiz->mFxDescriptors) { + delete[] thiz->mFxDescriptors; + thiz->mFxDescriptors = NULL; } } diff --git a/src/itf/IAndroidEffectSend.c b/src/itf/IAndroidEffectSend.c index 448816a..06f9a37 100644 --- a/src/itf/IAndroidEffectSend.c +++ b/src/itf/IAndroidEffectSend.c @@ -27,11 +27,11 @@ static SLresult IAndroidEffectSend_EnableEffectSend(SLAndroidEffectSendItf self, if (!((SL_MILLIBEL_MIN <= initialLevel) && (initialLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_exclusive(this); + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_exclusive(thiz); // is SLAndroidEffectSendItf on an AudioPlayer? - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL == ap) { SL_LOGE("invalid interface: not attached to an AudioPlayer"); result = SL_RESULT_PARAMETER_INVALID; @@ -44,11 +44,11 @@ static SLresult IAndroidEffectSend_EnableEffectSend(SLAndroidEffectSendItf self, if (SL_RESULT_SUCCESS == result) { // there currently is support for only one send bus, so there is a single send // level and a single enable flag - this->mSendLevel = initialLevel; - this->mEnabled = enable; + thiz->mSendLevel = initialLevel; + thiz->mEnabled = enable; } } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -63,11 +63,11 @@ static SLresult IAndroidEffectSend_IsEnabled(SLAndroidEffectSendItf self, if (NULL == pEnable) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_shared(this); + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_shared(thiz); // there currently is support for only one send bus, so there is a single enable flag - SLboolean enable = this->mEnabled; - interface_unlock_shared(this); + SLboolean enable = thiz->mEnabled; + interface_unlock_shared(thiz); *pEnable = enable; result = SL_RESULT_SUCCESS; } @@ -84,22 +84,22 @@ static SLresult IAndroidEffectSend_SetDirectLevel(SLAndroidEffectSendItf self, if (!((SL_MILLIBEL_MIN <= directLevel) && (directLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_exclusive(this); - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_exclusive(thiz); + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { SLmillibel oldDirectLevel = ap->mDirectLevel; if (oldDirectLevel != directLevel) { ap->mDirectLevel = directLevel; ap->mAmplFromDirectLevel = sles_to_android_amplification(directLevel); - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LOGE("invalid interface: not attached to an AudioPlayer"); result = SL_RESULT_PARAMETER_INVALID; } @@ -117,10 +117,10 @@ static SLresult IAndroidEffectSend_GetDirectLevel(SLAndroidEffectSendItf self, if (NULL == pDirectLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_peek(this); - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_peek(thiz); + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { *pDirectLevel = ap->mDirectLevel; result = SL_RESULT_SUCCESS; @@ -128,7 +128,7 @@ static SLresult IAndroidEffectSend_GetDirectLevel(SLAndroidEffectSendItf self, SL_LOGE("invalid interface: not attached to an AudioPlayer"); result = SL_RESULT_PARAMETER_INVALID; } - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -143,11 +143,11 @@ static SLresult IAndroidEffectSend_SetSendLevel(SLAndroidEffectSendItf self, if (!((SL_MILLIBEL_MIN <= sendLevel) && (sendLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_exclusive(this); + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_exclusive(thiz); // is SLAndroidEffectSendItf on an AudioPlayer? - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL == ap) { SL_LOGE("invalid interface: not attached to an AudioPlayer"); result = SL_RESULT_PARAMETER_INVALID; @@ -164,10 +164,10 @@ static SLresult IAndroidEffectSend_SetSendLevel(SLAndroidEffectSendItf self, if (SL_RESULT_SUCCESS == result) { // there currently is support for only one send bus, so there is a single send // level - this->mSendLevel = sendLevel; + thiz->mSendLevel = sendLevel; } } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -182,11 +182,11 @@ static SLresult IAndroidEffectSend_GetSendLevel(SLAndroidEffectSendItf self, if (NULL == pSendLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - interface_lock_exclusive(this); + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + interface_lock_exclusive(thiz); // is SLAndroidEffectSendItf on an AudioPlayer? - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL == ap) { SL_LOGE("invalid interface: not attached to an AudioPlayer"); result = SL_RESULT_PARAMETER_INVALID; @@ -202,10 +202,10 @@ OutputMix"); if (SL_RESULT_SUCCESS == result) { // there currently is support for only one send bus, so there is a single send // level - *pSendLevel = this->mSendLevel; + *pSendLevel = thiz->mSendLevel; } } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -223,8 +223,8 @@ static const struct SLAndroidEffectSendItf_ IAndroidEffectSend_Itf = { void IAndroidEffectSend_init(void *self) { - IAndroidEffectSend *this = (IAndroidEffectSend *) self; - this->mItf = &IAndroidEffectSend_Itf; - this->mEnabled = SL_BOOLEAN_FALSE; - this->mSendLevel = SL_MILLIBEL_MIN; + IAndroidEffectSend *thiz = (IAndroidEffectSend *) self; + thiz->mItf = &IAndroidEffectSend_Itf; + thiz->mEnabled = SL_BOOLEAN_FALSE; + thiz->mSendLevel = SL_MILLIBEL_MIN; } diff --git a/src/itf/IAudioDecoderCapabilities.c b/src/itf/IAudioDecoderCapabilities.c index 2a38ca7..6586e65 100644 --- a/src/itf/IAudioDecoderCapabilities.c +++ b/src/itf/IAudioDecoderCapabilities.c @@ -61,6 +61,6 @@ static const struct SLAudioDecoderCapabilitiesItf_ IAudioDecoderCapabilities_Itf void IAudioDecoderCapabilities_init(void *self) { - IAudioDecoderCapabilities *this = (IAudioDecoderCapabilities *) self; - this->mItf = &IAudioDecoderCapabilities_Itf; + IAudioDecoderCapabilities *thiz = (IAudioDecoderCapabilities *) self; + thiz->mItf = &IAudioDecoderCapabilities_Itf; } diff --git a/src/itf/IAudioEncoder.c b/src/itf/IAudioEncoder.c index c7b167a..511a008 100644 --- a/src/itf/IAudioEncoder.c +++ b/src/itf/IAudioEncoder.c @@ -27,11 +27,11 @@ static SLresult IAudioEncoder_SetEncoderSettings(SLAudioEncoderItf self, if (NULL == pSettings) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAudioEncoder *this = (IAudioEncoder *) self; + IAudioEncoder *thiz = (IAudioEncoder *) self; SLAudioEncoderSettings settings = *pSettings; - interface_lock_exclusive(this); - this->mSettings = settings; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mSettings = settings; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -47,10 +47,10 @@ static SLresult IAudioEncoder_GetEncoderSettings(SLAudioEncoderItf self, if (NULL == pSettings) { result = SL_RESULT_PARAMETER_INVALID; } else { - IAudioEncoder *this = (IAudioEncoder *) self; - interface_lock_shared(this); - SLAudioEncoderSettings settings = this->mSettings; - interface_unlock_shared(this); + IAudioEncoder *thiz = (IAudioEncoder *) self; + interface_lock_shared(thiz); + SLAudioEncoderSettings settings = thiz->mSettings; + interface_unlock_shared(thiz); *pSettings = settings; result = SL_RESULT_SUCCESS; } @@ -66,7 +66,7 @@ static const struct SLAudioEncoderItf_ IAudioEncoder_Itf = { void IAudioEncoder_init(void *self) { - IAudioEncoder *this = (IAudioEncoder *) self; - this->mItf = &IAudioEncoder_Itf; - memset(&this->mSettings, 0, sizeof(SLAudioEncoderSettings)); + IAudioEncoder *thiz = (IAudioEncoder *) self; + thiz->mItf = &IAudioEncoder_Itf; + memset(&thiz->mSettings, 0, sizeof(SLAudioEncoderSettings)); } diff --git a/src/itf/IAudioEncoderCapabilities.c b/src/itf/IAudioEncoderCapabilities.c index d983150..f91763b 100644 --- a/src/itf/IAudioEncoderCapabilities.c +++ b/src/itf/IAudioEncoderCapabilities.c @@ -62,6 +62,6 @@ static const struct SLAudioEncoderCapabilitiesItf_ IAudioEncoderCapabilities_Itf void IAudioEncoderCapabilities_init(void *self) { - IAudioEncoderCapabilities *this = (IAudioEncoderCapabilities *) self; - this->mItf = &IAudioEncoderCapabilities_Itf; + IAudioEncoderCapabilities *thiz = (IAudioEncoderCapabilities *) self; + thiz->mItf = &IAudioEncoderCapabilities_Itf; } diff --git a/src/itf/IAudioIODeviceCapabilities.c b/src/itf/IAudioIODeviceCapabilities.c index 23a68ac..e95f4f2 100644 --- a/src/itf/IAudioIODeviceCapabilities.c +++ b/src/itf/IAudioIODeviceCapabilities.c @@ -74,10 +74,10 @@ static SLresult IAudioIODeviceCapabilities_RegisterAvailableAudioInputsChangedCa SL_ENTER_INTERFACE IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self; - interface_lock_exclusive(this); - this->mAvailableAudioInputsChangedCallback = callback; - this->mAvailableAudioInputsChangedContext = pContext; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mAvailableAudioInputsChangedCallback = callback; + thiz->mAvailableAudioInputsChangedContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -144,10 +144,10 @@ static SLresult IAudioIODeviceCapabilities_RegisterAvailableAudioOutputsChangedC SL_ENTER_INTERFACE IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self; - interface_lock_exclusive(this); - this->mAvailableAudioOutputsChangedCallback = callback; - this->mAvailableAudioOutputsChangedContext = pContext; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mAvailableAudioOutputsChangedCallback = callback; + thiz->mAvailableAudioOutputsChangedContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -161,10 +161,10 @@ static SLresult IAudioIODeviceCapabilities_RegisterDefaultDeviceIDMapChangedCall SL_ENTER_INTERFACE IAudioIODeviceCapabilities * this = (IAudioIODeviceCapabilities *) self; - interface_lock_exclusive(this); - this->mDefaultDeviceIDMapChangedCallback = callback; - this->mDefaultDeviceIDMapChangedContext = pContext; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mDefaultDeviceIDMapChangedCallback = callback; + thiz->mDefaultDeviceIDMapChangedContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -312,12 +312,12 @@ static const struct SLAudioIODeviceCapabilitiesItf_ IAudioIODeviceCapabilities_I void IAudioIODeviceCapabilities_init(void *self) { - IAudioIODeviceCapabilities *this = (IAudioIODeviceCapabilities *) self; - this->mItf = &IAudioIODeviceCapabilities_Itf; - this->mAvailableAudioInputsChangedCallback = NULL; - this->mAvailableAudioInputsChangedContext = NULL; - this->mAvailableAudioOutputsChangedCallback = NULL; - this->mAvailableAudioOutputsChangedContext = NULL; - this->mDefaultDeviceIDMapChangedCallback = NULL; - this->mDefaultDeviceIDMapChangedContext = NULL; + IAudioIODeviceCapabilities *thiz = (IAudioIODeviceCapabilities *) self; + thiz->mItf = &IAudioIODeviceCapabilities_Itf; + thiz->mAvailableAudioInputsChangedCallback = NULL; + thiz->mAvailableAudioInputsChangedContext = NULL; + thiz->mAvailableAudioOutputsChangedCallback = NULL; + thiz->mAvailableAudioOutputsChangedContext = NULL; + thiz->mDefaultDeviceIDMapChangedCallback = NULL; + thiz->mDefaultDeviceIDMapChangedContext = NULL; } diff --git a/src/itf/IBassBoost.c b/src/itf/IBassBoost.c index 1b8032d..a5a55d7 100644 --- a/src/itf/IBassBoost.c +++ b/src/itf/IBassBoost.c @@ -36,20 +36,20 @@ static SLresult IBassBoost_SetEnabled(SLBassBoostItf self, SLboolean enabled) { SL_ENTER_INTERFACE - IBassBoost *this = (IBassBoost *) self; - interface_lock_exclusive(this); - this->mEnabled = (SLboolean) enabled; + IBassBoost *thiz = (IBassBoost *) self; + interface_lock_exclusive(thiz); + thiz->mEnabled = (SLboolean) enabled; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_BASSBOOST(this)) { + if (NO_BASSBOOST(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = this->mBassBoostEffect->setEnabled((bool) this->mEnabled); + android::status_t status = thiz->mBassBoostEffect->setEnabled((bool) thiz->mEnabled); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -62,21 +62,21 @@ static SLresult IBassBoost_IsEnabled(SLBassBoostItf self, SLboolean *pEnabled) if (NULL == pEnabled) { result = SL_RESULT_PARAMETER_INVALID; } else { - IBassBoost *this = (IBassBoost *) self; - interface_lock_exclusive(this); - SLboolean enabled = this->mEnabled; + IBassBoost *thiz = (IBassBoost *) self; + interface_lock_exclusive(thiz); + SLboolean enabled = thiz->mEnabled; #if !defined(ANDROID) *pEnabled = enabled; result = SL_RESULT_SUCCESS; #else - if (NO_BASSBOOST(this)) { + if (NO_BASSBOOST(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - *pEnabled = (SLboolean) this->mBassBoostEffect->getEnabled(); + *pEnabled = (SLboolean) thiz->mBassBoostEffect->getEnabled(); result = SL_RESULT_SUCCESS; } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -90,21 +90,21 @@ static SLresult IBassBoost_SetStrength(SLBassBoostItf self, SLpermille strength) if ((BASSBOOST_STRENGTH_MIN > strength) || (BASSBOOST_STRENGTH_MAX < strength)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IBassBoost *this = (IBassBoost *) self; - interface_lock_exclusive(this); + IBassBoost *thiz = (IBassBoost *) self; + interface_lock_exclusive(thiz); #if !defined(ANDROID) - this->mStrength = strength; + thiz->mStrength = strength; result = SL_RESULT_SUCCESS; #else - if (NO_BASSBOOST(this)) { + if (NO_BASSBOOST(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_bb_setParam(this->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH, &strength); + android_bb_setParam(thiz->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH, &strength); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -118,21 +118,21 @@ static SLresult IBassBoost_GetRoundedStrength(SLBassBoostItf self, SLpermille *p if (NULL == pStrength) { result = SL_RESULT_PARAMETER_INVALID; } else { - IBassBoost *this = (IBassBoost *) self; - interface_lock_exclusive(this); - SLpermille strength = this->mStrength;; + IBassBoost *thiz = (IBassBoost *) self; + interface_lock_exclusive(thiz); + SLpermille strength = thiz->mStrength;; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_BASSBOOST(this)) { + if (NO_BASSBOOST(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_bb_getParam(this->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH, &strength); + android_bb_getParam(thiz->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH, &strength); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); *pStrength = strength; } @@ -151,18 +151,18 @@ static SLresult IBassBoost_IsStrengthSupported(SLBassBoostItf self, SLboolean *p *pSupported = SL_BOOLEAN_TRUE; result = SL_RESULT_SUCCESS; #else - IBassBoost *this = (IBassBoost *) self; + IBassBoost *thiz = (IBassBoost *) self; int32_t supported = 0; - interface_lock_exclusive(this); - if (NO_BASSBOOST(this)) { + interface_lock_exclusive(thiz); + if (NO_BASSBOOST(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_bb_getParam(this->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH_SUPPORTED, + android_bb_getParam(thiz->mBassBoostEffect, BASSBOOST_PARAM_STRENGTH_SUPPORTED, &supported); result = android_fx_statusToResult(status); } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); *pSupported = (SLboolean) (supported != 0); #endif } @@ -181,31 +181,31 @@ static const struct SLBassBoostItf_ IBassBoost_Itf = { void IBassBoost_init(void *self) { - IBassBoost *this = (IBassBoost *) self; - this->mItf = &IBassBoost_Itf; - this->mEnabled = SL_BOOLEAN_FALSE; - this->mStrength = 0; + IBassBoost *thiz = (IBassBoost *) self; + thiz->mItf = &IBassBoost_Itf; + thiz->mEnabled = SL_BOOLEAN_FALSE; + thiz->mStrength = 0; #if defined(ANDROID) - memset(&this->mBassBoostDescriptor, 0, sizeof(effect_descriptor_t)); + memset(&thiz->mBassBoostDescriptor, 0, sizeof(effect_descriptor_t)); // placement new (explicit constructor) - (void) new (&this->mBassBoostEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mBassBoostEffect) android::sp<android::AudioEffect>(); #endif } void IBassBoost_deinit(void *self) { #if defined(ANDROID) - IBassBoost *this = (IBassBoost *) self; + IBassBoost *thiz = (IBassBoost *) self; // explicit destructor - this->mBassBoostEffect.~sp(); + thiz->mBassBoostEffect.~sp(); #endif } bool IBassBoost_Expose(void *self) { #if defined(ANDROID) - IBassBoost *this = (IBassBoost *) self; - if (!android_fx_initEffectDescriptor(SL_IID_BASSBOOST, &this->mBassBoostDescriptor)) { + IBassBoost *thiz = (IBassBoost *) self; + if (!android_fx_initEffectDescriptor(SL_IID_BASSBOOST, &thiz->mBassBoostDescriptor)) { SL_LOGE("BassBoost initialization failed."); return false; } diff --git a/src/itf/IBufferQueue.c b/src/itf/IBufferQueue.c index a93888c..fe368e2 100644 --- a/src/itf/IBufferQueue.c +++ b/src/itf/IBufferQueue.c @@ -23,15 +23,15 @@ * Note that PLAYSTATE and RECORDSTATE values are equivalent (where PLAYING == RECORDING). */ -static SLuint32 getAssociatedState(IBufferQueue *this) +static SLuint32 getAssociatedState(IBufferQueue *thiz) { SLuint32 state; - switch (InterfaceToObjectID(this)) { + switch (InterfaceToObjectID(thiz)) { case SL_OBJECTID_AUDIOPLAYER: - state = ((CAudioPlayer *) this->mThis)->mPlay.mState; + state = ((CAudioPlayer *) thiz->mThis)->mPlay.mState; break; case SL_OBJECTID_AUDIORECORDER: - state = ((CAudioRecorder *) this->mThis)->mRecord.mState; + state = ((CAudioRecorder *) thiz->mThis)->mRecord.mState; break; default: // unreachable, but just in case we will assume it is stopped @@ -53,24 +53,24 @@ SLresult IBufferQueue_Enqueue(SLBufferQueueItf self, const void *pBuffer, SLuint if (NULL == pBuffer || 0 == size) { result = SL_RESULT_PARAMETER_INVALID; } else { - IBufferQueue *this = (IBufferQueue *) self; - interface_lock_exclusive(this); - BufferHeader *oldRear = this->mRear, *newRear; - if ((newRear = oldRear + 1) == &this->mArray[this->mNumBuffers + 1]) { - newRear = this->mArray; + IBufferQueue *thiz = (IBufferQueue *) self; + interface_lock_exclusive(thiz); + BufferHeader *oldRear = thiz->mRear, *newRear; + if ((newRear = oldRear + 1) == &thiz->mArray[thiz->mNumBuffers + 1]) { + newRear = thiz->mArray; } - if (newRear == this->mFront) { + if (newRear == thiz->mFront) { result = SL_RESULT_BUFFER_INSUFFICIENT; } else { oldRear->mBuffer = pBuffer; oldRear->mSize = size; - this->mRear = newRear; - ++this->mState.count; + thiz->mRear = newRear; + ++thiz->mState.count; result = SL_RESULT_SUCCESS; } // set enqueue attribute if state is PLAYING and the first buffer is enqueued - interface_unlock_exclusive_attributes(this, ((SL_RESULT_SUCCESS == result) && - (1 == this->mState.count) && (SL_PLAYSTATE_PLAYING == getAssociatedState(this))) ? + interface_unlock_exclusive_attributes(thiz, ((SL_RESULT_SUCCESS == result) && + (1 == thiz->mState.count) && (SL_PLAYSTATE_PLAYING == getAssociatedState(thiz))) ? ATTR_ENQUEUE : ATTR_NONE); } SL_LEAVE_INTERFACE @@ -82,20 +82,20 @@ SLresult IBufferQueue_Clear(SLBufferQueueItf self) SL_ENTER_INTERFACE result = SL_RESULT_SUCCESS; - IBufferQueue *this = (IBufferQueue *) self; - interface_lock_exclusive(this); + IBufferQueue *thiz = (IBufferQueue *) self; + interface_lock_exclusive(thiz); #ifdef ANDROID - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { - CAudioPlayer *audioPlayer = (CAudioPlayer *) this->mThis; + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { + CAudioPlayer *audioPlayer = (CAudioPlayer *) thiz->mThis; // flush associated audio player result = android_audioPlayer_bufferQueue_onClear(audioPlayer); if (SL_RESULT_SUCCESS == result) { - this->mFront = &this->mArray[0]; - this->mRear = &this->mArray[0]; - this->mState.count = 0; - this->mState.playIndex = 0; - this->mSizeConsumed = 0; + thiz->mFront = &thiz->mArray[0]; + thiz->mRear = &thiz->mArray[0]; + thiz->mState.count = 0; + thiz->mState.playIndex = 0; + thiz->mSizeConsumed = 0; } } #endif @@ -103,13 +103,13 @@ SLresult IBufferQueue_Clear(SLBufferQueueItf self) #ifdef USE_OUTPUTMIXEXT // mixer might be reading from the front buffer, so tread carefully here // NTH asynchronous cancel instead of blocking until mixer acknowledges - this->mClearRequested = SL_BOOLEAN_TRUE; + thiz->mClearRequested = SL_BOOLEAN_TRUE; do { - interface_cond_wait(this); - } while (this->mClearRequested); + interface_cond_wait(thiz); + } while (thiz->mClearRequested); #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -124,16 +124,16 @@ static SLresult IBufferQueue_GetState(SLBufferQueueItf self, SLBufferQueueState if (NULL == pState) { result = SL_RESULT_PARAMETER_INVALID; } else { - IBufferQueue *this = (IBufferQueue *) self; + IBufferQueue *thiz = (IBufferQueue *) self; SLBufferQueueState state; - interface_lock_shared(this); + interface_lock_shared(thiz); #ifdef __cplusplus // FIXME Is this a compiler bug? - state.count = this->mState.count; - state.playIndex = this->mState.playIndex; + state.count = thiz->mState.count; + state.playIndex = thiz->mState.playIndex; #else - state = this->mState; + state = thiz->mState; #endif - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pState = state; result = SL_RESULT_SUCCESS; } @@ -147,17 +147,17 @@ SLresult IBufferQueue_RegisterCallback(SLBufferQueueItf self, { SL_ENTER_INTERFACE - IBufferQueue *this = (IBufferQueue *) self; - interface_lock_exclusive(this); + IBufferQueue *thiz = (IBufferQueue *) self; + interface_lock_exclusive(thiz); // verify pre-condition that media object is in the SL_PLAYSTATE_STOPPED state - if (SL_PLAYSTATE_STOPPED == getAssociatedState(this)) { - this->mCallback = callback; - this->mContext = pContext; + if (SL_PLAYSTATE_STOPPED == getAssociatedState(thiz)) { + thiz->mCallback = callback; + thiz->mContext = pContext; result = SL_RESULT_SUCCESS; } else { result = SL_RESULT_PRECONDITIONS_VIOLATED; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -172,21 +172,21 @@ static const struct SLBufferQueueItf_ IBufferQueue_Itf = { void IBufferQueue_init(void *self) { - IBufferQueue *this = (IBufferQueue *) self; - this->mItf = &IBufferQueue_Itf; - this->mState.count = 0; - this->mState.playIndex = 0; - this->mCallback = NULL; - this->mContext = NULL; - this->mNumBuffers = 0; - this->mClearRequested = SL_BOOLEAN_FALSE; - this->mArray = NULL; - this->mFront = NULL; - this->mRear = NULL; + IBufferQueue *thiz = (IBufferQueue *) self; + thiz->mItf = &IBufferQueue_Itf; + thiz->mState.count = 0; + thiz->mState.playIndex = 0; + thiz->mCallback = NULL; + thiz->mContext = NULL; + thiz->mNumBuffers = 0; + thiz->mClearRequested = SL_BOOLEAN_FALSE; + thiz->mArray = NULL; + thiz->mFront = NULL; + thiz->mRear = NULL; #ifdef ANDROID - this->mSizeConsumed = 0; + thiz->mSizeConsumed = 0; #endif - BufferHeader *bufferHeader = this->mTypical; + BufferHeader *bufferHeader = thiz->mTypical; unsigned i; for (i = 0; i < BUFFER_HEADER_TYPICAL+1; ++i, ++bufferHeader) { bufferHeader->mBuffer = NULL; @@ -201,9 +201,9 @@ void IBufferQueue_init(void *self) void IBufferQueue_deinit(void *self) { - IBufferQueue *this = (IBufferQueue *) self; - if ((NULL != this->mArray) && (this->mArray != this->mTypical)) { - free(this->mArray); - this->mArray = NULL; + IBufferQueue *thiz = (IBufferQueue *) self; + if ((NULL != thiz->mArray) && (thiz->mArray != thiz->mTypical)) { + free(thiz->mArray); + thiz->mArray = NULL; } } diff --git a/src/itf/IDeviceVolume.c b/src/itf/IDeviceVolume.c index 346e5d8..bd9f0be 100644 --- a/src/itf/IDeviceVolume.c +++ b/src/itf/IDeviceVolume.c @@ -59,10 +59,10 @@ static SLresult IDeviceVolume_SetVolume(SLDeviceVolumeItf self, SLuint32 deviceI case SL_DEFAULTDEVICEID_AUDIOINPUT: case SL_DEFAULTDEVICEID_AUDIOOUTPUT: { - IDeviceVolume *this = (IDeviceVolume *) self; - interface_lock_poke(this); - this->mVolume[~deviceID] = volume; - interface_unlock_poke(this); + IDeviceVolume *thiz = (IDeviceVolume *) self; + interface_lock_poke(thiz); + thiz->mVolume[~deviceID] = volume; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } break; @@ -91,10 +91,10 @@ static SLresult IDeviceVolume_GetVolume(SLDeviceVolumeItf self, SLuint32 deviceI case SL_DEFAULTDEVICEID_AUDIOINPUT: case SL_DEFAULTDEVICEID_AUDIOOUTPUT: { - IDeviceVolume *this = (IDeviceVolume *) self; - interface_lock_peek(this); - SLint32 volume = this->mVolume[~deviceID]; - interface_unlock_peek(this); + IDeviceVolume *thiz = (IDeviceVolume *) self; + interface_lock_peek(thiz); + SLint32 volume = thiz->mVolume[~deviceID]; + interface_unlock_peek(thiz); *pVolume = volume; result = SL_RESULT_SUCCESS; } @@ -117,10 +117,10 @@ static const struct SLDeviceVolumeItf_ IDeviceVolume_Itf = { void IDeviceVolume_init(void *self) { - IDeviceVolume *this = (IDeviceVolume *) self; - this->mItf = &IDeviceVolume_Itf; + IDeviceVolume *thiz = (IDeviceVolume *) self; + thiz->mItf = &IDeviceVolume_Itf; unsigned i; for (i = 0; i < MAX_DEVICE; ++i) { - this->mVolume[i] = 10; + thiz->mVolume[i] = 10; } } diff --git a/src/itf/IDynamicInterfaceManagement.c b/src/itf/IDynamicInterfaceManagement.c index 6a4037f..3d44eba 100644 --- a/src/itf/IDynamicInterfaceManagement.c +++ b/src/itf/IDynamicInterfaceManagement.c @@ -26,15 +26,15 @@ static void HandleAdd(void *self, int MPH) { // validate input parameters - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - assert(NULL != this); - IObject *thisObject = InterfaceToIObject(this); + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + assert(NULL != thiz); + IObject *thisObject = InterfaceToIObject(thiz); assert(NULL != thisObject); assert(0 <= MPH && MPH < MPH_MAX); - const ClassTable *class__ = thisObject->mClass; - assert(NULL != class__); - int index = class__->mMPH_to_index[MPH]; - assert(0 <= index && index < (int) class__->mInterfaceCount); + const ClassTable *clazz = thisObject->mClass; + assert(NULL != clazz); + int index = clazz->mMPH_to_index[MPH]; + assert(0 <= index && index < (int) clazz->mInterfaceCount); SLuint8 *interfaceStateP = &thisObject->mInterfaceStates[index]; SLresult result; @@ -50,7 +50,7 @@ static void HandleAdd(void *self, int MPH) object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - const struct iid_vtable *x = &class__->mInterfaces[index]; + const struct iid_vtable *x = &clazz->mInterfaces[index]; size_t offset = x->mOffset; void *thisItf = (char *) thisObject + offset; BoolHook expose = MPH_init_table[MPH].mExpose; @@ -89,14 +89,14 @@ static void HandleAdd(void *self, int MPH) *interfaceStateP = state; // Make a copy of these, so we can call the callback with mutex unlocked - slDynamicInterfaceManagementCallback callback = this->mCallback; - void *context = this->mContext; + slDynamicInterfaceManagementCallback callback = thiz->mCallback; + void *context = thiz->mContext; object_unlock_exclusive(thisObject); // Note that the mutex is unlocked during the callback if (NULL != callback) { const SLInterfaceID iid = &SL_IID_array[MPH]; // equal but not == to the original IID - (*callback)(&this->mItf, context, SL_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, result, iid); + (*callback)(&thiz->mItf, context, SL_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, result, iid); } } @@ -111,17 +111,17 @@ static SLresult IDynamicInterfaceManagement_AddInterface(SLDynamicInterfaceManag if (NULL == iid) { result = SL_RESULT_PARAMETER_INVALID; } else { - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - IObject *thisObject = InterfaceToIObject(this); - const ClassTable *class__ = thisObject->mClass; + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + IObject *thisObject = InterfaceToIObject(thiz); + const ClassTable *clazz = thisObject->mClass; int MPH, index; if ((0 > (MPH = IID_to_MPH(iid))) || // no need to check for an initialization hook // (NULL == MPH_init_table[MPH].mInit) || - (0 > (index = class__->mMPH_to_index[MPH]))) { + (0 > (index = clazz->mMPH_to_index[MPH]))) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { - assert(index < (int) class__->mInterfaceCount); + assert(index < (int) clazz->mInterfaceCount); SLuint8 *interfaceStateP = &thisObject->mInterfaceStates[index]; // check interface state @@ -135,7 +135,7 @@ static SLresult IDynamicInterfaceManagement_AddInterface(SLDynamicInterfaceManag object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - result = ThreadPool_add(&thisObject->mEngine->mThreadPool, HandleAdd, this, + result = ThreadPool_add(&thisObject->mEngine->mThreadPool, HandleAdd, thiz, MPH); if (SL_RESULT_SUCCESS != result) { // Engine was destroyed during add, or insufficient memory, @@ -158,7 +158,7 @@ static SLresult IDynamicInterfaceManagement_AddInterface(SLDynamicInterfaceManag object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - const struct iid_vtable *x = &class__->mInterfaces[index]; + const struct iid_vtable *x = &clazz->mInterfaces[index]; size_t offset = x->mOffset; void *thisItf = (char *) thisObject + offset; // call the optional expose hook @@ -208,14 +208,14 @@ static SLresult IDynamicInterfaceManagement_RemoveInterface( if (NULL == iid) { result = SL_RESULT_PARAMETER_INVALID; } else { - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - IObject *thisObject = InterfaceToIObject(this); - const ClassTable *class__ = thisObject->mClass; + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + IObject *thisObject = InterfaceToIObject(thiz); + const ClassTable *clazz = thisObject->mClass; int MPH, index; if ((0 > (MPH = IID_to_MPH(iid))) || // no need to check for an initialization hook // (NULL == MPH_init_table[MPH].mInit) || - (0 > (index = class__->mMPH_to_index[MPH]))) { + (0 > (index = clazz->mMPH_to_index[MPH]))) { result = SL_RESULT_PRECONDITIONS_VIOLATED; } else { SLuint8 *interfaceStateP = &thisObject->mInterfaceStates[index]; @@ -228,7 +228,7 @@ static SLresult IDynamicInterfaceManagement_RemoveInterface( case INTERFACE_SUSPENDED: { // Compute address of the interface - const struct iid_vtable *x = &class__->mInterfaces[index]; + const struct iid_vtable *x = &clazz->mInterfaces[index]; size_t offset = x->mOffset; void *thisItf = (char *) thisObject + offset; @@ -283,15 +283,15 @@ static void HandleResume(void *self, int MPH) { // validate input parameters - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - assert(NULL != this); - IObject *thisObject = InterfaceToIObject(this); + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + assert(NULL != thiz); + IObject *thisObject = InterfaceToIObject(thiz); assert(NULL != thisObject); assert(0 <= MPH && MPH < MPH_MAX); - const ClassTable *class__ = thisObject->mClass; - assert(NULL != class__); - int index = class__->mMPH_to_index[MPH]; - assert(0 <= index && index < (int) class__->mInterfaceCount); + const ClassTable *clazz = thisObject->mClass; + assert(NULL != clazz); + int index = clazz->mMPH_to_index[MPH]; + assert(0 <= index && index < (int) clazz->mInterfaceCount); SLuint8 *interfaceStateP = &thisObject->mInterfaceStates[index]; SLresult result; @@ -307,7 +307,7 @@ static void HandleResume(void *self, int MPH) object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - const struct iid_vtable *x = &class__->mInterfaces[index]; + const struct iid_vtable *x = &clazz->mInterfaces[index]; size_t offset = x->mOffset; void *thisItf = (char *) thisObject + offset; VoidHook resume = MPH_init_table[MPH].mResume; @@ -339,14 +339,14 @@ static void HandleResume(void *self, int MPH) *interfaceStateP = state; // Make a copy of these, so we can call the callback with mutex unlocked - slDynamicInterfaceManagementCallback callback = this->mCallback; - void *context = this->mContext; + slDynamicInterfaceManagementCallback callback = thiz->mCallback; + void *context = thiz->mContext; object_unlock_exclusive(thisObject); // Note that the mutex is unlocked during the callback if (NULL != callback) { const SLInterfaceID iid = &SL_IID_array[MPH]; // equal but not == to the original IID - (*callback)(&this->mItf, context, SL_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, result, iid); + (*callback)(&thiz->mItf, context, SL_DYNAMIC_ITF_EVENT_ASYNC_TERMINATION, result, iid); } } @@ -360,17 +360,17 @@ static SLresult IDynamicInterfaceManagement_ResumeInterface(SLDynamicInterfaceMa if (NULL == iid) { result = SL_RESULT_PARAMETER_INVALID; } else { - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - IObject *thisObject = InterfaceToIObject(this); - const ClassTable *class__ = thisObject->mClass; + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + IObject *thisObject = InterfaceToIObject(thiz); + const ClassTable *clazz = thisObject->mClass; int MPH, index; if ((0 > (MPH = IID_to_MPH(iid))) || // no need to check for an initialization hook // (NULL == MPH_init_table[MPH].mInit) || - (0 > (index = class__->mMPH_to_index[MPH]))) { + (0 > (index = clazz->mMPH_to_index[MPH]))) { result = SL_RESULT_PRECONDITIONS_VIOLATED; } else { - assert(index < (int) class__->mInterfaceCount); + assert(index < (int) clazz->mInterfaceCount); SLuint8 *interfaceStateP = &thisObject->mInterfaceStates[index]; // check interface state @@ -384,7 +384,7 @@ static SLresult IDynamicInterfaceManagement_ResumeInterface(SLDynamicInterfaceMa object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - result = ThreadPool_add(&thisObject->mEngine->mThreadPool, HandleResume, this, + result = ThreadPool_add(&thisObject->mEngine->mThreadPool, HandleResume, thiz, MPH); if (SL_RESULT_SUCCESS != result) { // Engine was destroyed during resume, or insufficient memory, @@ -407,9 +407,9 @@ static SLresult IDynamicInterfaceManagement_ResumeInterface(SLDynamicInterfaceMa object_unlock_exclusive(thisObject); // this section runs with mutex unlocked - const struct iid_vtable *x = &class__->mInterfaces[index]; + const struct iid_vtable *x = &clazz->mInterfaces[index]; size_t offset = x->mOffset; - void *thisItf = (char *) this + offset; + void *thisItf = (char *) thiz + offset; VoidHook resume = MPH_init_table[MPH].mResume; if (NULL != resume) { (*resume)(thisItf); @@ -443,11 +443,11 @@ static SLresult IDynamicInterfaceManagement_RegisterCallback(SLDynamicInterfaceM { SL_ENTER_INTERFACE - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - IObject *thisObject = InterfaceToIObject(this); + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + IObject *thisObject = InterfaceToIObject(thiz); object_lock_exclusive(thisObject); - this->mCallback = callback; - this->mContext = pContext; + thiz->mCallback = callback; + thiz->mContext = pContext; object_unlock_exclusive(thisObject); result = SL_RESULT_SUCCESS; @@ -464,8 +464,8 @@ static const struct SLDynamicInterfaceManagementItf_ IDynamicInterfaceManagement void IDynamicInterfaceManagement_init(void *self) { - IDynamicInterfaceManagement *this = (IDynamicInterfaceManagement *) self; - this->mItf = &IDynamicInterfaceManagement_Itf; - this->mCallback = NULL; - this->mContext = NULL; + IDynamicInterfaceManagement *thiz = (IDynamicInterfaceManagement *) self; + thiz->mItf = &IDynamicInterfaceManagement_Itf; + thiz->mCallback = NULL; + thiz->mContext = NULL; } diff --git a/src/itf/IDynamicSource.c b/src/itf/IDynamicSource.c index d25bc52..8a97e52 100644 --- a/src/itf/IDynamicSource.c +++ b/src/itf/IDynamicSource.c @@ -26,7 +26,7 @@ static SLresult IDynamicSource_SetSource(SLDynamicSourceItf self, SLDataSource * if (NULL == pDataSource) { result = SL_RESULT_PARAMETER_INVALID; } else { - IDynamicSource *this = (IDynamicSource *) self; + IDynamicSource *thiz = (IDynamicSource *) self; #if 0 DataLocatorFormat myDataSource; SLresult result; @@ -35,10 +35,10 @@ static SLresult IDynamicSource_SetSource(SLDynamicSourceItf self, SLDataSource * // handle result here #endif // need to lock the object, as a change to source can impact most of object - IObject *thisObject = InterfaceToIObject(this); + IObject *thisObject = InterfaceToIObject(thiz); object_lock_exclusive(thisObject); // a bit of a simplification to say the least! (see Khronos bug 6728) - this->mDataSource = pDataSource; + thiz->mDataSource = pDataSource; object_unlock_exclusive(thisObject); result = SL_RESULT_FEATURE_UNSUPPORTED; } @@ -53,8 +53,8 @@ static const struct SLDynamicSourceItf_ IDynamicSource_Itf = { void IDynamicSource_init(void *self) { - IDynamicSource *this = (IDynamicSource *) self; - this->mItf = &IDynamicSource_Itf; + IDynamicSource *thiz = (IDynamicSource *) self; + thiz->mItf = &IDynamicSource_Itf; // mDataSource will be re-initialized later in the containing object constructor - this->mDataSource = NULL; + thiz->mDataSource = NULL; } diff --git a/src/itf/IEffectSend.c b/src/itf/IEffectSend.c index 51f09b7..64a5aa0 100644 --- a/src/itf/IEffectSend.c +++ b/src/itf/IEffectSend.c @@ -36,11 +36,11 @@ static const unsigned char AUX_to_MPH[AUX_MAX] = { * - interface was "gotten" with Object::GetInterface */ -static struct EnableLevel *getEnableLevel(IEffectSend *this, const void *pAuxEffect) +static struct EnableLevel *getEnableLevel(IEffectSend *thiz, const void *pAuxEffect) { // Make sure this effect send is on an audio player, not a MIDI player - CAudioPlayer *audioPlayer = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *audioPlayer = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL == audioPlayer) { return NULL; } @@ -78,7 +78,7 @@ static struct EnableLevel *getEnableLevel(IEffectSend *this, const void *pAuxEff case INTERFACE_RESUMING_1: case INTERFACE_RESUMING_2: if (mask) { - return &this->mEnableLevels[aux]; + return &thiz->mEnableLevels[aux]; } SL_LOGE("EffectSend no GetInterface yet"); break; @@ -116,20 +116,20 @@ static SLresult IEffectSend_EnableEffectSend(SLEffectSendItf self, if (!((SL_MILLIBEL_MIN <= initialLevel) && (initialLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect); + IEffectSend *thiz = (IEffectSend *) self; + struct EnableLevel *enableLevel = getEnableLevel(thiz, pAuxEffect); if (NULL == enableLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); enableLevel->mEnable = SL_BOOLEAN_FALSE != enable; // normalize enableLevel->mSendLevel = initialLevel; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else // TODO do not repeat querying of CAudioPlayer, done inside getEnableLevel() - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; // note that if this was a MIDI player, getEnableLevel would have returned NULL assert(NULL != ap); // check which effect the send is attached to, attach and set level @@ -149,7 +149,7 @@ static SLresult IEffectSend_EnableEffectSend(SLEffectSendItf self, result = SL_RESULT_PARAMETER_INVALID; } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } } @@ -165,15 +165,15 @@ static SLresult IEffectSend_IsEnabled(SLEffectSendItf self, if (NULL == pEnable) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect); + IEffectSend *thiz = (IEffectSend *) self; + struct EnableLevel *enableLevel = getEnableLevel(thiz, pAuxEffect); if (NULL == enableLevel) { *pEnable = SL_BOOLEAN_FALSE; result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_shared(this); + interface_lock_shared(thiz); SLboolean enable = enableLevel->mEnable; - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pEnable = enable; result = SL_RESULT_SUCCESS; } @@ -190,26 +190,26 @@ static SLresult IEffectSend_SetDirectLevel(SLEffectSendItf self, SLmillibel dire if (!((SL_MILLIBEL_MIN <= directLevel) && (directLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - interface_lock_exclusive(this); - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + IEffectSend *thiz = (IEffectSend *) self; + interface_lock_exclusive(thiz); + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { SLmillibel oldDirectLevel = ap->mDirectLevel; if (oldDirectLevel != directLevel) { ap->mDirectLevel = directLevel; #if defined(ANDROID) ap->mAmplFromDirectLevel = sles_to_android_amplification(directLevel); - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); #else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); #endif } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } } else { // MIDI player is silently not supported - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; } @@ -225,17 +225,17 @@ static SLresult IEffectSend_GetDirectLevel(SLEffectSendItf self, SLmillibel *pDi if (NULL == pDirectLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - interface_lock_shared(this); - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + IEffectSend *thiz = (IEffectSend *) self; + interface_lock_shared(thiz); + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { *pDirectLevel = ap->mDirectLevel; } else { // MIDI player is silently not supported *pDirectLevel = 0; } - interface_unlock_shared(this); + interface_unlock_shared(thiz); result = SL_RESULT_SUCCESS; } @@ -251,25 +251,25 @@ static SLresult IEffectSend_SetSendLevel(SLEffectSendItf self, const void *pAuxE if (!((SL_MILLIBEL_MIN <= sendLevel) && (sendLevel <= 0))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect); + IEffectSend *thiz = (IEffectSend *) self; + struct EnableLevel *enableLevel = getEnableLevel(thiz, pAuxEffect); if (NULL == enableLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { result = SL_RESULT_SUCCESS; // EnableEffectSend is exclusive, so this has to be also - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); enableLevel->mSendLevel = sendLevel; #if defined(ANDROID) - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { // the send level set here is the total energy on the aux bus, so it must take // into account the player volume level result = android_fxSend_setSendLevel(ap, sendLevel + ap->mVolume.mLevel); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } } @@ -286,14 +286,14 @@ static SLresult IEffectSend_GetSendLevel(SLEffectSendItf self, const void *pAuxE if (NULL == pSendLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEffectSend *this = (IEffectSend *) self; - struct EnableLevel *enableLevel = getEnableLevel(this, pAuxEffect); + IEffectSend *thiz = (IEffectSend *) self; + struct EnableLevel *enableLevel = getEnableLevel(thiz, pAuxEffect); if (NULL == enableLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_shared(this); + interface_lock_shared(thiz); SLmillibel sendLevel = enableLevel->mSendLevel; - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pSendLevel = sendLevel; result = SL_RESULT_SUCCESS; } @@ -314,9 +314,9 @@ static const struct SLEffectSendItf_ IEffectSend_Itf = { void IEffectSend_init(void *self) { - IEffectSend *this = (IEffectSend *) self; - this->mItf = &IEffectSend_Itf; - struct EnableLevel *enableLevel = this->mEnableLevels; + IEffectSend *thiz = (IEffectSend *) self; + thiz->mItf = &IEffectSend_Itf; + struct EnableLevel *enableLevel = thiz->mEnableLevels; unsigned aux; for (aux = 0; aux < AUX_MAX; ++aux, ++enableLevel) { enableLevel->mEnable = SL_BOOLEAN_FALSE; diff --git a/src/itf/IEngine.c b/src/itf/IEngine.c index af23a84..7e86073 100644 --- a/src/itf/IEngine.c +++ b/src/itf/IEngine.c @@ -38,14 +38,14 @@ static SLresult IEngine_CreateLEDDevice(SLEngineItf self, SLObjectItf *pDevice, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - CLEDDevice *this = (CLEDDevice *) construct(pCLEDDevice_class, exposedMask, self); - if (NULL == this) { + CLEDDevice *thiz = (CLEDDevice *) construct(pCLEDDevice_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { - this->mDeviceID = deviceID; - IObject_Publish(&this->mObject); + thiz->mDeviceID = deviceID; + IObject_Publish(&thiz->mObject); // return the new LED object - *pDevice = &this->mObject.mItf; + *pDevice = &thiz->mObject.mItf; } } } @@ -76,14 +76,14 @@ static SLresult IEngine_CreateVibraDevice(SLEngineItf self, SLObjectItf *pDevice pInterfaceIds, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - CVibraDevice *this = (CVibraDevice *) construct(pCVibraDevice_class, exposedMask, self); - if (NULL == this) { + CVibraDevice *thiz = (CVibraDevice *) construct(pCVibraDevice_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { - this->mDeviceID = deviceID; - IObject_Publish(&this->mObject); + thiz->mDeviceID = deviceID; + IObject_Publish(&thiz->mObject); // return the new vibra object - *pDevice = &this->mObject.mItf; + *pDevice = &thiz->mObject.mItf; } } } @@ -113,8 +113,8 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer if (SL_RESULT_SUCCESS == result) { // Construct our new AudioPlayer instance - CAudioPlayer *this = (CAudioPlayer *) construct(pCAudioPlayer_class, exposedMask, self); - if (NULL == this) { + CAudioPlayer *thiz = (CAudioPlayer *) construct(pCAudioPlayer_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { @@ -123,53 +123,53 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer // Initialize private fields not associated with an interface // Default data source in case of failure in checkDataSource - this->mDataSource.mLocator.mLocatorType = SL_DATALOCATOR_NULL; - this->mDataSource.mFormat.mFormatType = SL_DATAFORMAT_NULL; + thiz->mDataSource.mLocator.mLocatorType = SL_DATALOCATOR_NULL; + thiz->mDataSource.mFormat.mFormatType = SL_DATAFORMAT_NULL; // Default data sink in case of failure in checkDataSink - this->mDataSink.mLocator.mLocatorType = SL_DATALOCATOR_NULL; - this->mDataSink.mFormat.mFormatType = SL_DATAFORMAT_NULL; + thiz->mDataSink.mLocator.mLocatorType = SL_DATALOCATOR_NULL; + thiz->mDataSink.mFormat.mFormatType = SL_DATAFORMAT_NULL; // Default is no per-channel mute or solo - this->mMuteMask = 0; - this->mSoloMask = 0; + thiz->mMuteMask = 0; + thiz->mSoloMask = 0; // Will be set soon for PCM buffer queues, or later by platform-specific code // during Realize or Prefetch - this->mNumChannels = 0; - this->mSampleRateMilliHz = 0; + thiz->mNumChannels = 0; + thiz->mSampleRateMilliHz = 0; // More default values, in case destructor needs to be called early - this->mDirectLevel = 0; + thiz->mDirectLevel = 0; #ifdef USE_OUTPUTMIXEXT - this->mTrack = NULL; - this->mGains[0] = 1.0f; - this->mGains[1] = 1.0f; - this->mDestroyRequested = SL_BOOLEAN_FALSE; + thiz->mTrack = NULL; + thiz->mGains[0] = 1.0f; + thiz->mGains[1] = 1.0f; + thiz->mDestroyRequested = SL_BOOLEAN_FALSE; #endif #ifdef USE_SNDFILE - this->mSndFile.mPathname = NULL; - this->mSndFile.mSNDFILE = NULL; - memset(&this->mSndFile.mSfInfo, 0, sizeof(SF_INFO)); - memset(&this->mSndFile.mMutex, 0, sizeof(pthread_mutex_t)); - this->mSndFile.mEOF = SL_BOOLEAN_FALSE; - this->mSndFile.mWhich = 0; - memset(this->mSndFile.mBuffer, 0, sizeof(this->mSndFile.mBuffer)); + thiz->mSndFile.mPathname = NULL; + thiz->mSndFile.mSNDFILE = NULL; + memset(&thiz->mSndFile.mSfInfo, 0, sizeof(SF_INFO)); + memset(&thiz->mSndFile.mMutex, 0, sizeof(pthread_mutex_t)); + thiz->mSndFile.mEOF = SL_BOOLEAN_FALSE; + thiz->mSndFile.mWhich = 0; + memset(thiz->mSndFile.mBuffer, 0, sizeof(thiz->mSndFile.mBuffer)); #endif #ifdef ANDROID // extra safe initializations of pointers, in case of incomplete construction - this->mpLock = NULL; - this->mAudioTrack = NULL; + thiz->mpLock = NULL; + thiz->mAudioTrack = NULL; // placement new (explicit constructor) - (void) new (&this->mSfPlayer) android::sp<android::SfPlayer>(); - (void) new (&this->mAuxEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mSfPlayer) android::sp<android::SfPlayer>(); + (void) new (&thiz->mAuxEffect) android::sp<android::AudioEffect>(); #endif // Check the source and sink parameters against generic constraints, // and make a local copy of all parameters in case other application threads // change memory concurrently. - result = checkDataSource("pAudioSrc", pAudioSrc, &this->mDataSource, + result = checkDataSource("pAudioSrc", pAudioSrc, &thiz->mDataSource, DATALOCATOR_MASK_URI | DATALOCATOR_MASK_ADDRESS | DATALOCATOR_MASK_BUFFERQUEUE #ifdef ANDROID @@ -182,7 +182,7 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer break; } - result = checkDataSink("pAudioSnk", pAudioSnk, &this->mDataSink, + result = checkDataSink("pAudioSnk", pAudioSnk, &thiz->mDataSink, DATALOCATOR_MASK_OUTPUTMIX, DATAFORMAT_MASK_NULL); if (SL_RESULT_SUCCESS != result) { break; @@ -193,7 +193,7 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer pAudioSnk = NULL; // Check that the requested interfaces are compatible with the data source - result = checkSourceFormatVsInterfacesCompatibility(&this->mDataSource, + result = checkSourceFormatVsInterfacesCompatibility(&thiz->mDataSource, pCAudioPlayer_class, exposedMask); if (SL_RESULT_SUCCESS != result) { break; @@ -202,39 +202,39 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer // copy the buffer queue count from source locator to the buffer queue interface // we have already range-checked the value down to a smaller width - switch (this->mDataSource.mLocator.mLocatorType) { + switch (thiz->mDataSource.mLocator.mLocatorType) { case SL_DATALOCATOR_BUFFERQUEUE: #ifdef ANDROID case SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE: #endif - this->mBufferQueue.mNumBuffers = - (SLuint16) this->mDataSource.mLocator.mBufferQueue.numBuffers; - assert(SL_DATAFORMAT_PCM == this->mDataSource.mFormat.mFormatType); - this->mNumChannels = this->mDataSource.mFormat.mPCM.numChannels; - this->mSampleRateMilliHz = this->mDataSource.mFormat.mPCM.samplesPerSec; + thiz->mBufferQueue.mNumBuffers = + (SLuint16) thiz->mDataSource.mLocator.mBufferQueue.numBuffers; + assert(SL_DATAFORMAT_PCM == thiz->mDataSource.mFormat.mFormatType); + thiz->mNumChannels = thiz->mDataSource.mFormat.mPCM.numChannels; + thiz->mSampleRateMilliHz = thiz->mDataSource.mFormat.mPCM.samplesPerSec; break; default: - this->mBufferQueue.mNumBuffers = 0; + thiz->mBufferQueue.mNumBuffers = 0; break; } // check the audio source and sink parameters against platform support #ifdef ANDROID - result = android_audioPlayer_checkSourceSink(this); + result = android_audioPlayer_checkSourceSink(thiz); if (SL_RESULT_SUCCESS != result) { break; } #endif #ifdef USE_SNDFILE - result = SndFile_checkAudioPlayerSourceSink(this); + result = SndFile_checkAudioPlayerSourceSink(thiz); if (SL_RESULT_SUCCESS != result) { break; } #endif #ifdef USE_OUTPUTMIXEXT - result = IOutputMixExt_checkAudioPlayerSourceSink(this); + result = IOutputMixExt_checkAudioPlayerSourceSink(thiz); if (SL_RESULT_SUCCESS != result) { break; } @@ -242,45 +242,45 @@ static SLresult IEngine_CreateAudioPlayer(SLEngineItf self, SLObjectItf *pPlayer // Allocate memory for buffer queue - //if (0 != this->mBufferQueue.mNumBuffers) { + //if (0 != thiz->mBufferQueue.mNumBuffers) { // inline allocation of circular mArray, up to a typical max - if (BUFFER_HEADER_TYPICAL >= this->mBufferQueue.mNumBuffers) { - this->mBufferQueue.mArray = this->mBufferQueue.mTypical; + if (BUFFER_HEADER_TYPICAL >= thiz->mBufferQueue.mNumBuffers) { + thiz->mBufferQueue.mArray = thiz->mBufferQueue.mTypical; } else { // Avoid possible integer overflow during multiplication; this arbitrary // maximum is big enough to not interfere with real applications, but // small enough to not overflow. - if (this->mBufferQueue.mNumBuffers >= 256) { + if (thiz->mBufferQueue.mNumBuffers >= 256) { result = SL_RESULT_MEMORY_FAILURE; break; } - this->mBufferQueue.mArray = (BufferHeader *) malloc((this->mBufferQueue. + thiz->mBufferQueue.mArray = (BufferHeader *) malloc((thiz->mBufferQueue. mNumBuffers + 1) * sizeof(BufferHeader)); - if (NULL == this->mBufferQueue.mArray) { + if (NULL == thiz->mBufferQueue.mArray) { result = SL_RESULT_MEMORY_FAILURE; break; } } - this->mBufferQueue.mFront = this->mBufferQueue.mArray; - this->mBufferQueue.mRear = this->mBufferQueue.mArray; + thiz->mBufferQueue.mFront = thiz->mBufferQueue.mArray; + thiz->mBufferQueue.mRear = thiz->mBufferQueue.mArray; //} // used to store the data source of our audio player - this->mDynamicSource.mDataSource = &this->mDataSource.u.mSource; + thiz->mDynamicSource.mDataSource = &thiz->mDataSource.u.mSource; // platform-specific initialization #ifdef ANDROID - android_audioPlayer_create(this); + android_audioPlayer_create(thiz); #endif } while (0); if (SL_RESULT_SUCCESS != result) { - IObject_Destroy(&this->mObject.mItf); + IObject_Destroy(&thiz->mObject.mItf); } else { - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); // return the new audio player object - *pPlayer = &this->mObject.mItf; + *pPlayer = &thiz->mObject.mItf; } } @@ -315,9 +315,9 @@ static SLresult IEngine_CreateAudioRecorder(SLEngineItf self, SLObjectItf *pReco if (SL_RESULT_SUCCESS == result) { // Construct our new AudioRecorder instance - CAudioRecorder *this = (CAudioRecorder *) construct(pCAudioRecorder_class, exposedMask, + CAudioRecorder *thiz = (CAudioRecorder *) construct(pCAudioRecorder_class, exposedMask, self); - if (NULL == this) { + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { @@ -326,30 +326,30 @@ static SLresult IEngine_CreateAudioRecorder(SLEngineItf self, SLObjectItf *pReco // Initialize fields not associated with any interface // Default data source in case of failure in checkDataSource - this->mDataSource.mLocator.mLocatorType = SL_DATALOCATOR_NULL; - this->mDataSource.mFormat.mFormatType = SL_DATAFORMAT_NULL; + thiz->mDataSource.mLocator.mLocatorType = SL_DATALOCATOR_NULL; + thiz->mDataSource.mFormat.mFormatType = SL_DATAFORMAT_NULL; // Default data sink in case of failure in checkDataSink - this->mDataSink.mLocator.mLocatorType = SL_DATALOCATOR_NULL; - this->mDataSink.mFormat.mFormatType = SL_DATAFORMAT_NULL; + thiz->mDataSink.mLocator.mLocatorType = SL_DATALOCATOR_NULL; + thiz->mDataSink.mFormat.mFormatType = SL_DATAFORMAT_NULL; // These fields are set to real values by // android_audioRecorder_checkSourceSinkSupport. Note that the data sink is // always PCM buffer queue, so we know the channel count and sample rate early. - this->mNumChannels = 0; - this->mSampleRateMilliHz = 0; + thiz->mNumChannels = 0; + thiz->mSampleRateMilliHz = 0; #ifdef ANDROID - this->mAudioRecord = NULL; - this->mRecordSource = android::AUDIO_SOURCE_DEFAULT; + thiz->mAudioRecord = NULL; + thiz->mRecordSource = android::AUDIO_SOURCE_DEFAULT; #endif // Check the source and sink parameters, and make a local copy of all parameters - result = checkDataSource("pAudioSrc", pAudioSrc, &this->mDataSource, + result = checkDataSource("pAudioSrc", pAudioSrc, &thiz->mDataSource, DATALOCATOR_MASK_IODEVICE, DATAFORMAT_MASK_NULL); if (SL_RESULT_SUCCESS != result) { break; } - result = checkDataSink("pAudioSnk", pAudioSnk, &this->mDataSink, + result = checkDataSink("pAudioSnk", pAudioSnk, &thiz->mDataSink, DATALOCATOR_MASK_URI #ifdef ANDROID | DATALOCATOR_MASK_ANDROIDSIMPLEBUFFERQUEUE @@ -366,7 +366,7 @@ static SLresult IEngine_CreateAudioRecorder(SLEngineItf self, SLObjectItf *pReco // check the audio source and sink parameters against platform support #ifdef ANDROID - result = android_audioRecorder_checkSourceSinkSupport(this); + result = android_audioRecorder_checkSourceSinkSupport(thiz); if (SL_RESULT_SUCCESS != result) { SL_LOGE("Cannot create AudioRecorder: invalid source or sink"); break; @@ -375,46 +375,46 @@ static SLresult IEngine_CreateAudioRecorder(SLEngineItf self, SLObjectItf *pReco #ifdef ANDROID // Allocate memory for buffer queue - SLuint32 locatorType = this->mDataSink.mLocator.mLocatorType; + SLuint32 locatorType = thiz->mDataSink.mLocator.mLocatorType; if (locatorType == SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE) { - this->mBufferQueue.mNumBuffers = - this->mDataSink.mLocator.mBufferQueue.numBuffers; + thiz->mBufferQueue.mNumBuffers = + thiz->mDataSink.mLocator.mBufferQueue.numBuffers; // inline allocation of circular Buffer Queue mArray, up to a typical max - if (BUFFER_HEADER_TYPICAL >= this->mBufferQueue.mNumBuffers) { - this->mBufferQueue.mArray = this->mBufferQueue.mTypical; + if (BUFFER_HEADER_TYPICAL >= thiz->mBufferQueue.mNumBuffers) { + thiz->mBufferQueue.mArray = thiz->mBufferQueue.mTypical; } else { // Avoid possible integer overflow during multiplication; this arbitrary // maximum is big enough to not interfere with real applications, but // small enough to not overflow. - if (this->mBufferQueue.mNumBuffers >= 256) { + if (thiz->mBufferQueue.mNumBuffers >= 256) { result = SL_RESULT_MEMORY_FAILURE; break; } - this->mBufferQueue.mArray = (BufferHeader *) malloc((this->mBufferQueue. + thiz->mBufferQueue.mArray = (BufferHeader *) malloc((thiz->mBufferQueue. mNumBuffers + 1) * sizeof(BufferHeader)); - if (NULL == this->mBufferQueue.mArray) { + if (NULL == thiz->mBufferQueue.mArray) { result = SL_RESULT_MEMORY_FAILURE; break; } } - this->mBufferQueue.mFront = this->mBufferQueue.mArray; - this->mBufferQueue.mRear = this->mBufferQueue.mArray; + thiz->mBufferQueue.mFront = thiz->mBufferQueue.mArray; + thiz->mBufferQueue.mRear = thiz->mBufferQueue.mArray; } #endif // platform-specific initialization #ifdef ANDROID - android_audioRecorder_create(this); + android_audioRecorder_create(thiz); #endif } while (0); if (SL_RESULT_SUCCESS != result) { - IObject_Destroy(&this->mObject.mItf); + IObject_Destroy(&thiz->mObject.mItf); } else { - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); // return the new audio recorder object - *pRecorder = &this->mObject.mItf; + *pRecorder = &thiz->mObject.mItf; } } @@ -450,8 +450,8 @@ static SLresult IEngine_CreateMidiPlayer(SLEngineItf self, SLObjectItf *pPlayer, pInterfaceIds, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - CMidiPlayer *this = (CMidiPlayer *) construct(pCMidiPlayer_class, exposedMask, self); - if (NULL == this) { + CMidiPlayer *thiz = (CMidiPlayer *) construct(pCMidiPlayer_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { #if 0 @@ -462,10 +462,10 @@ static SLresult IEngine_CreateMidiPlayer(SLEngineItf self, SLObjectItf *pPlayer, "pLEDArray", pLEDArray, NULL | IODEVICE, NULL #endif // a fake value - why not use value from IPlay_init? what does CT check for? - this->mPlay.mDuration = 0; - IObject_Publish(&this->mObject); + thiz->mPlay.mDuration = 0; + IObject_Publish(&thiz->mObject); // return the new MIDI player object - *pPlayer = &this->mObject.mItf; + *pPlayer = &thiz->mObject.mItf; } } } @@ -496,13 +496,13 @@ static SLresult IEngine_CreateListener(SLEngineItf self, SLObjectItf *pListener, pInterfaceIds, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - CListener *this = (CListener *) construct(pCListener_class, exposedMask, self); - if (NULL == this) { + CListener *thiz = (CListener *) construct(pCListener_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); // return the new 3D listener object - *pListener = &this->mObject.mItf; + *pListener = &thiz->mObject.mItf; } } } @@ -533,14 +533,14 @@ static SLresult IEngine_Create3DGroup(SLEngineItf self, SLObjectItf *pGroup, SLu pInterfaceIds, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - C3DGroup *this = (C3DGroup *) construct(pC3DGroup_class, exposedMask, self); - if (NULL == this) { + C3DGroup *thiz = (C3DGroup *) construct(pC3DGroup_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { - this->mMemberMask = 0; - IObject_Publish(&this->mObject); + thiz->mMemberMask = 0; + IObject_Publish(&thiz->mObject); // return the new 3D group object - *pGroup = &this->mObject.mItf; + *pGroup = &thiz->mObject.mItf; } } } @@ -567,24 +567,24 @@ static SLresult IEngine_CreateOutputMix(SLEngineItf self, SLObjectItf *pMix, SLu result = checkInterfaces(pCOutputMix_class, numInterfaces, pInterfaceIds, pInterfaceRequired, &exposedMask); if (SL_RESULT_SUCCESS == result) { - COutputMix *this = (COutputMix *) construct(pCOutputMix_class, exposedMask, self); - if (NULL == this) { + COutputMix *thiz = (COutputMix *) construct(pCOutputMix_class, exposedMask, self); + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { #ifdef ANDROID - android_outputMix_create(this); + android_outputMix_create(thiz); #endif #ifdef USE_SDL - IEngine *thisEngine = &this->mObject.mEngine->mEngine; + IEngine *thisEngine = &thiz->mObject.mEngine->mEngine; interface_lock_exclusive(thisEngine); bool unpause = false; if (NULL == thisEngine->mOutputMix) { - thisEngine->mOutputMix = this; + thisEngine->mOutputMix = thiz; unpause = true; } interface_unlock_exclusive(thisEngine); #endif - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); #ifdef USE_SDL if (unpause) { // Enable SDL_callback to be called periodically by SDL's internal thread @@ -592,7 +592,7 @@ static SLresult IEngine_CreateOutputMix(SLEngineItf self, SLObjectItf *pMix, SLu } #endif // return the new output mix object - *pMix = &this->mObject.mItf; + *pMix = &thiz->mObject.mItf; } } } @@ -622,17 +622,17 @@ static SLresult IEngine_CreateMetadataExtractor(SLEngineItf self, SLObjectItf *p pInterfaceIds, pInterfaceRequired, &exposedMask); } if (SL_RESULT_SUCCESS == result) { - CMetadataExtractor *this = (CMetadataExtractor *) + CMetadataExtractor *thiz = (CMetadataExtractor *) construct(pCMetadataExtractor_class, exposedMask, self); - if (NULL == this) { + if (NULL == thiz) { result = SL_RESULT_MEMORY_FAILURE; } else { #if 0 "pDataSource", pDataSource, NONE, NONE #endif - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); // return the new metadata extractor object - *pMetadataExtractor = &this->mObject.mItf; + *pMetadataExtractor = &thiz->mObject.mItf; result = SL_RESULT_SUCCESS; } } @@ -670,14 +670,14 @@ static SLresult IEngine_QueryNumSupportedInterfaces(SLEngineItf self, if (NULL == pNumSupportedInterfaces) { result = SL_RESULT_PARAMETER_INVALID; } else { - const ClassTable *class__ = objectIDtoClass(objectID); - if (NULL == class__) { + const ClassTable *clazz = objectIDtoClass(objectID); + if (NULL == clazz) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { SLuint32 count = 0; SLuint32 i; - for (i = 0; i < class__->mInterfaceCount; ++i) { - switch (class__->mInterfaces[i].mInterface) { + for (i = 0; i < clazz->mInterfaceCount; ++i) { + switch (clazz->mInterfaces[i].mInterface) { case INTERFACE_IMPLICIT: case INTERFACE_IMPLICIT_PREREALIZE: case INTERFACE_EXPLICIT: @@ -710,14 +710,14 @@ static SLresult IEngine_QuerySupportedInterfaces(SLEngineItf self, result = SL_RESULT_PARAMETER_INVALID; } else { *pInterfaceId = NULL; - const ClassTable *class__ = objectIDtoClass(objectID); - if (NULL == class__) { + const ClassTable *clazz = objectIDtoClass(objectID); + if (NULL == clazz) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { result = SL_RESULT_PARAMETER_INVALID; // will be reset later SLuint32 i; - for (i = 0; i < class__->mInterfaceCount; ++i) { - switch (class__->mInterfaces[i].mInterface) { + for (i = 0; i < clazz->mInterfaceCount; ++i) { + switch (clazz->mInterfaces[i].mInterface) { case INTERFACE_IMPLICIT: case INTERFACE_IMPLICIT_PREREALIZE: case INTERFACE_EXPLICIT: @@ -731,7 +731,7 @@ static SLresult IEngine_QuerySupportedInterfaces(SLEngineItf self, break; } if (index == 0) { - *pInterfaceId = &SL_IID_array[class__->mInterfaces[i].mMPH]; + *pInterfaceId = &SL_IID_array[clazz->mInterfaces[i].mMPH]; result = SL_RESULT_SUCCESS; break; } @@ -859,21 +859,21 @@ static const struct SLEngineItf_ IEngine_Itf = { void IEngine_init(void *self) { - IEngine *this = (IEngine *) self; - this->mItf = &IEngine_Itf; + IEngine *thiz = (IEngine *) self; + thiz->mItf = &IEngine_Itf; // mLossOfControlGlobal is initialized in slCreateEngine #ifdef USE_SDL - this->mOutputMix = NULL; + thiz->mOutputMix = NULL; #endif - this->mInstanceCount = 1; // ourself - this->mInstanceMask = 0; - this->mChangedMask = 0; + thiz->mInstanceCount = 1; // ourself + thiz->mInstanceMask = 0; + thiz->mChangedMask = 0; unsigned i; for (i = 0; i < MAX_INSTANCE; ++i) { - this->mInstances[i] = NULL; + thiz->mInstances[i] = NULL; } - this->mShutdown = SL_BOOLEAN_FALSE; - this->mShutdownAck = SL_BOOLEAN_FALSE; + thiz->mShutdown = SL_BOOLEAN_FALSE; + thiz->mShutdownAck = SL_BOOLEAN_FALSE; } void IEngine_deinit(void *self) @@ -890,7 +890,7 @@ static XAresult IEngine_CreateCameraDevice(XAEngineItf self, XAObjectItf *pDevic { XA_ENTER_INTERFACE - //IXAEngine *this = (IXAEngine *) self; + //IXAEngine *thiz = (IXAEngine *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; XA_LEAVE_INTERFACE @@ -903,7 +903,7 @@ static XAresult IEngine_CreateRadioDevice(XAEngineItf self, XAObjectItf *pDevice { XA_ENTER_INTERFACE - //IXAEngine *this = (IXAEngine *) self; + //IXAEngine *thiz = (IXAEngine *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; XA_LEAVE_INTERFACE @@ -952,9 +952,9 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer if (XA_RESULT_SUCCESS == result) { // Construct our new MediaPlayer instance - CMediaPlayer *this = (CMediaPlayer *) construct(pCMediaPlayer_class, exposedMask, + CMediaPlayer *thiz = (CMediaPlayer *) construct(pCMediaPlayer_class, exposedMask, &((CEngine *) ((IXAEngine *) self)->mThis)->mEngine.mItf); - if (NULL == this) { + if (NULL == thiz) { result = XA_RESULT_MEMORY_FAILURE; } else { @@ -969,7 +969,7 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer // Check the source and sink parameters against generic constraints result = checkDataSource("pDataSrc", (const SLDataSource *) pDataSrc, - &this->mDataSource, DATALOCATOR_MASK_URI + &thiz->mDataSource, DATALOCATOR_MASK_URI #ifdef ANDROID | DATALOCATOR_MASK_ANDROIDFD | DATALOCATOR_MASK_ANDROIDBUFFERQUEUE @@ -980,26 +980,26 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer } result = checkDataSource("pBankSrc", (const SLDataSource *) pBankSrc, - &this->mBankSource, DATALOCATOR_MASK_NULL | DATALOCATOR_MASK_URI | + &thiz->mBankSource, DATALOCATOR_MASK_NULL | DATALOCATOR_MASK_URI | DATALOCATOR_MASK_ADDRESS, DATAFORMAT_MASK_NULL); if (XA_RESULT_SUCCESS != result) { break; } result = checkDataSink("pAudioSnk", (const SLDataSink *) pAudioSnk, - &this->mAudioSink, DATALOCATOR_MASK_OUTPUTMIX, DATAFORMAT_MASK_NULL); + &thiz->mAudioSink, DATALOCATOR_MASK_OUTPUTMIX, DATAFORMAT_MASK_NULL); if (XA_RESULT_SUCCESS != result) { break; } result = checkDataSink("pImageVideoSnk", (const SLDataSink *) pImageVideoSnk, - &this->mImageVideoSink, DATALOCATOR_MASK_NATIVEDISPLAY, + &thiz->mImageVideoSink, DATALOCATOR_MASK_NATIVEDISPLAY, DATAFORMAT_MASK_NULL); if (XA_RESULT_SUCCESS != result) { break; } - result = checkDataSink("pVibra", (const SLDataSink *) pVibra, &this->mVibraSink, + result = checkDataSink("pVibra", (const SLDataSink *) pVibra, &thiz->mVibraSink, DATALOCATOR_MASK_NULL | DATALOCATOR_MASK_IODEVICE, DATAFORMAT_MASK_NULL); if (XA_RESULT_SUCCESS != result) { @@ -1007,7 +1007,7 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer } result = checkDataSink("pLEDArray", (const SLDataSink *) pLEDArray, - &this->mLEDArraySink, DATALOCATOR_MASK_NULL | DATALOCATOR_MASK_IODEVICE, + &thiz->mLEDArraySink, DATALOCATOR_MASK_NULL | DATALOCATOR_MASK_IODEVICE, DATAFORMAT_MASK_NULL); if (XA_RESULT_SUCCESS != result) { break; @@ -1026,7 +1026,7 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer // check the source and sink parameters against platform support #ifdef ANDROID - // result = android_mediaPlayer_checkSourceSink(this); + // result = android_mediaPlayer_checkSourceSink(thiz); if (XA_RESULT_SUCCESS != result) { break; } @@ -1034,17 +1034,17 @@ static XAresult IEngine_CreateMediaPlayer(XAEngineItf self, XAObjectItf *pPlayer // platform-specific initialization #ifdef ANDROID - android_Player_create(this); + android_Player_create(thiz); #endif } while (0); if (XA_RESULT_SUCCESS != result) { - IObject_Destroy(&this->mObject.mItf); + IObject_Destroy(&thiz->mObject.mItf); } else { - IObject_Publish(&this->mObject); + IObject_Publish(&thiz->mObject); // return the new media player object - *pPlayer = (XAObjectItf) &this->mObject.mItf; + *pPlayer = (XAObjectItf) &thiz->mObject.mItf; } } @@ -1063,7 +1063,7 @@ static XAresult IEngine_CreateMediaRecorder(XAEngineItf self, XAObjectItf *pReco { XA_ENTER_INTERFACE - //IXAEngine *this = (IXAEngine *) self; + //IXAEngine *thiz = (IXAEngine *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; #if 0 @@ -1114,7 +1114,7 @@ static XAresult IEngine_GetImplementationInfo(XAEngineItf self, XAuint32 *pMajor { XA_ENTER_INTERFACE - //IXAEngine *this = (IXAEngine *) self; + //IXAEngine *thiz = (IXAEngine *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; XA_LEAVE_INTERFACE @@ -1236,6 +1236,6 @@ static const struct XAEngineItf_ IXAEngine_Itf = { void IXAEngine_init(void *self) { - IXAEngine *this = (IXAEngine *) self; - this->mItf = &IXAEngine_Itf; + IXAEngine *thiz = (IXAEngine *) self; + thiz->mItf = &IXAEngine_Itf; } diff --git a/src/itf/IEngineCapabilities.c b/src/itf/IEngineCapabilities.c index dbb0533..681d82d 100644 --- a/src/itf/IEngineCapabilities.c +++ b/src/itf/IEngineCapabilities.c @@ -104,14 +104,14 @@ SLresult IEngineCapabilities_QueryLEDCapabilities(SLEngineCapabilitiesItf self, { SL_ENTER_INTERFACE - IEngineCapabilities *this = (IEngineCapabilities *) self; + IEngineCapabilities *thiz = (IEngineCapabilities *) self; const struct LED_id_descriptor *id_descriptor; SLuint32 index; if (NULL != pIndex) { result = SL_RESULT_SUCCESS; if (NULL != pLEDDeviceID || NULL != pDescriptor) { index = *pIndex; - if (index >= this->mMaxIndexLED) { + if (index >= thiz->mMaxIndexLED) { result = SL_RESULT_PARAMETER_INVALID; } else { id_descriptor = &LED_id_descriptors[index]; @@ -121,12 +121,12 @@ SLresult IEngineCapabilities_QueryLEDCapabilities(SLEngineCapabilitiesItf self, *pDescriptor = *id_descriptor->descriptor; } } - *pIndex = this->mMaxIndexLED; + *pIndex = thiz->mMaxIndexLED; } else { result = SL_RESULT_PARAMETER_INVALID; if (NULL != pLEDDeviceID && NULL != pDescriptor) { SLuint32 id = *pLEDDeviceID; - for (index = 0; index < this->mMaxIndexLED; ++index) { + for (index = 0; index < thiz->mMaxIndexLED; ++index) { id_descriptor = &LED_id_descriptors[index]; if (id == id_descriptor->id) { *pDescriptor = *id_descriptor->descriptor; @@ -146,14 +146,14 @@ SLresult IEngineCapabilities_QueryVibraCapabilities(SLEngineCapabilitiesItf self { SL_ENTER_INTERFACE - IEngineCapabilities *this = (IEngineCapabilities *) self; + IEngineCapabilities *thiz = (IEngineCapabilities *) self; const struct Vibra_id_descriptor *id_descriptor; SLuint32 index; if (NULL != pIndex) { result = SL_RESULT_SUCCESS; if (NULL != pVibraDeviceID || NULL != pDescriptor) { index = *pIndex; - if (index >= this->mMaxIndexVibra) { + if (index >= thiz->mMaxIndexVibra) { result = SL_RESULT_PARAMETER_INVALID; } else { id_descriptor = &Vibra_id_descriptors[index]; @@ -163,12 +163,12 @@ SLresult IEngineCapabilities_QueryVibraCapabilities(SLEngineCapabilitiesItf self *pDescriptor = *id_descriptor->descriptor; } } - *pIndex = this->mMaxIndexVibra; + *pIndex = thiz->mMaxIndexVibra; } else { result = SL_RESULT_PARAMETER_INVALID; if (NULL != pVibraDeviceID && NULL != pDescriptor) { SLuint32 id = *pVibraDeviceID; - for (index = 0; index < this->mMaxIndexVibra; ++index) { + for (index = 0; index < thiz->mMaxIndexVibra; ++index) { id_descriptor = &Vibra_id_descriptors[index]; if (id == id_descriptor->id) { *pDescriptor = *id_descriptor->descriptor; @@ -191,8 +191,8 @@ static SLresult IEngineCapabilities_IsThreadSafe(SLEngineCapabilitiesItf self, if (NULL == pIsThreadSafe) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEngineCapabilities *this = (IEngineCapabilities *) self; - *pIsThreadSafe = this->mThreadSafe; + IEngineCapabilities *thiz = (IEngineCapabilities *) self; + *pIsThreadSafe = thiz->mThreadSafe; result = SL_RESULT_SUCCESS; } @@ -212,15 +212,15 @@ static const struct SLEngineCapabilitiesItf_ IEngineCapabilities_Itf = { void IEngineCapabilities_init(void *self) { - IEngineCapabilities *this = (IEngineCapabilities *) self; - this->mItf = &IEngineCapabilities_Itf; + IEngineCapabilities *thiz = (IEngineCapabilities *) self; + thiz->mItf = &IEngineCapabilities_Itf; // mThreadSafe is initialized in slCreateEngine const struct LED_id_descriptor *id_descriptor_LED = LED_id_descriptors; while (NULL != id_descriptor_LED->descriptor) ++id_descriptor_LED; - this->mMaxIndexLED = id_descriptor_LED - LED_id_descriptors; + thiz->mMaxIndexLED = id_descriptor_LED - LED_id_descriptors; const struct Vibra_id_descriptor *id_descriptor_Vibra = Vibra_id_descriptors; while (NULL != id_descriptor_Vibra->descriptor) ++id_descriptor_Vibra; - this->mMaxIndexVibra = id_descriptor_Vibra - Vibra_id_descriptors; + thiz->mMaxIndexVibra = id_descriptor_Vibra - Vibra_id_descriptors; } diff --git a/src/itf/IEnvironmentalReverb.c b/src/itf/IEnvironmentalReverb.c index d1094e8..3202167 100644 --- a/src/itf/IEnvironmentalReverb.c +++ b/src/itf/IEnvironmentalReverb.c @@ -42,21 +42,21 @@ static SLresult IEnvironmentalReverb_SetRoomLevel(SLEnvironmentalReverbItf self, if (!(SL_MILLIBEL_MIN <= room && room <= 0)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.roomLevel = room; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.roomLevel = room; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_ROOM_LEVEL, &room); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -70,22 +70,22 @@ static SLresult IEnvironmentalReverb_GetRoomLevel(SLEnvironmentalReverbItf self, if (NULL == pRoom) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_ROOM_LEVEL, &this->mProperties.roomLevel); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_ROOM_LEVEL, &thiz->mProperties.roomLevel); result = android_fx_statusToResult(status); } #endif - *pRoom = this->mProperties.roomLevel; + *pRoom = thiz->mProperties.roomLevel; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } @@ -101,21 +101,21 @@ static SLresult IEnvironmentalReverb_SetRoomHFLevel( if (!(SL_MILLIBEL_MIN <= roomHF && roomHF <= 0)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.roomHFLevel = roomHF; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.roomHFLevel = roomHF; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_ROOM_HF_LEVEL, &roomHF); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -130,22 +130,22 @@ static SLresult IEnvironmentalReverb_GetRoomHFLevel( if (NULL == pRoomHF) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_ROOM_HF_LEVEL, &this->mProperties.roomHFLevel); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_ROOM_HF_LEVEL, &thiz->mProperties.roomHFLevel); result = android_fx_statusToResult(status); } #endif - *pRoomHF = this->mProperties.roomHFLevel; + *pRoomHF = thiz->mProperties.roomHFLevel; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -160,21 +160,21 @@ static SLresult IEnvironmentalReverb_SetDecayTime( if (!(100 <= decayTime && decayTime <= 20000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.decayTime = decayTime; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.decayTime = decayTime; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_DECAY_TIME, &decayTime); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -189,22 +189,22 @@ static SLresult IEnvironmentalReverb_GetDecayTime( if (NULL == pDecayTime) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_DECAY_TIME, &this->mProperties.decayTime); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_DECAY_TIME, &thiz->mProperties.decayTime); result = android_fx_statusToResult(status); } #endif - *pDecayTime = this->mProperties.decayTime; + *pDecayTime = thiz->mProperties.decayTime; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -219,21 +219,21 @@ static SLresult IEnvironmentalReverb_SetDecayHFRatio( if (!(100 <= decayHFRatio && decayHFRatio <= 2000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.decayHFRatio = decayHFRatio; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.decayHFRatio = decayHFRatio; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_DECAY_HF_RATIO, &decayHFRatio); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -248,22 +248,22 @@ static SLresult IEnvironmentalReverb_GetDecayHFRatio( if (NULL == pDecayHFRatio) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_DECAY_HF_RATIO, &this->mProperties.decayHFRatio); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_DECAY_HF_RATIO, &thiz->mProperties.decayHFRatio); result = android_fx_statusToResult(status); } #endif - *pDecayHFRatio = this->mProperties.decayHFRatio; + *pDecayHFRatio = thiz->mProperties.decayHFRatio; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -278,21 +278,21 @@ static SLresult IEnvironmentalReverb_SetReflectionsLevel( if (!(SL_MILLIBEL_MIN <= reflectionsLevel && reflectionsLevel <= 1000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.reflectionsLevel = reflectionsLevel; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.reflectionsLevel = reflectionsLevel; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_REFLECTIONS_LEVEL, &reflectionsLevel); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -307,22 +307,22 @@ static SLresult IEnvironmentalReverb_GetReflectionsLevel( if (NULL == pReflectionsLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_REFLECTIONS_LEVEL, &this->mProperties.reflectionsLevel); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_REFLECTIONS_LEVEL, &thiz->mProperties.reflectionsLevel); result = android_fx_statusToResult(status); } #endif - *pReflectionsLevel = this->mProperties.reflectionsLevel; + *pReflectionsLevel = thiz->mProperties.reflectionsLevel; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -337,21 +337,21 @@ static SLresult IEnvironmentalReverb_SetReflectionsDelay( if (!(/* 0 <= reflectionsDelay && */ reflectionsDelay <= 300)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.reflectionsDelay = reflectionsDelay; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.reflectionsDelay = reflectionsDelay; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_REFLECTIONS_DELAY, &reflectionsDelay); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -366,22 +366,22 @@ static SLresult IEnvironmentalReverb_GetReflectionsDelay( if (NULL == pReflectionsDelay) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_REFLECTIONS_DELAY, &this->mProperties.reflectionsDelay); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_REFLECTIONS_DELAY, &thiz->mProperties.reflectionsDelay); result = android_fx_statusToResult(status); } #endif - *pReflectionsDelay = this->mProperties.reflectionsDelay; + *pReflectionsDelay = thiz->mProperties.reflectionsDelay; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -396,21 +396,21 @@ static SLresult IEnvironmentalReverb_SetReverbLevel( if (!(SL_MILLIBEL_MIN <= reverbLevel && reverbLevel <= 2000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.reverbLevel = reverbLevel; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.reverbLevel = reverbLevel; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_REVERB_LEVEL, &reverbLevel); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -425,22 +425,22 @@ static SLresult IEnvironmentalReverb_GetReverbLevel( if (NULL == pReverbLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_REVERB_LEVEL, &this->mProperties.reverbLevel); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_REVERB_LEVEL, &thiz->mProperties.reverbLevel); result = android_fx_statusToResult(status); } #endif - *pReverbLevel = this->mProperties.reverbLevel; + *pReverbLevel = thiz->mProperties.reverbLevel; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -455,21 +455,21 @@ static SLresult IEnvironmentalReverb_SetReverbDelay( if (!(/* 0 <= reverbDelay && */ reverbDelay <= 100)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.reverbDelay = reverbDelay; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.reverbDelay = reverbDelay; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_REVERB_DELAY, &reverbDelay); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -484,22 +484,22 @@ static SLresult IEnvironmentalReverb_GetReverbDelay( if (NULL == pReverbDelay) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_REVERB_DELAY, &this->mProperties.reverbDelay); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_REVERB_DELAY, &thiz->mProperties.reverbDelay); result = android_fx_statusToResult(status); } #endif - *pReverbDelay = this->mProperties.reverbDelay; + *pReverbDelay = thiz->mProperties.reverbDelay; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -514,21 +514,21 @@ static SLresult IEnvironmentalReverb_SetDiffusion( if (!(0 <= diffusion && diffusion <= 1000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties.diffusion = diffusion; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties.diffusion = diffusion; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_DIFFUSION, &diffusion); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -543,22 +543,22 @@ static SLresult IEnvironmentalReverb_GetDiffusion(SLEnvironmentalReverbItf self, if (NULL == pDiffusion) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_DIFFUSION, &this->mProperties.diffusion); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_DIFFUSION, &thiz->mProperties.diffusion); result = android_fx_statusToResult(status); } #endif - *pDiffusion = this->mProperties.diffusion; + *pDiffusion = thiz->mProperties.diffusion; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -573,20 +573,20 @@ static SLresult IEnvironmentalReverb_SetDensity(SLEnvironmentalReverbItf self, if (!(0 <= density && density <= 1000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_DENSITY, &density); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -601,22 +601,22 @@ static SLresult IEnvironmentalReverb_GetDensity(SLEnvironmentalReverbItf self, if (NULL == pDensity) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_peek(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_peek(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_DENSITY, &this->mProperties.density); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_DENSITY, &thiz->mProperties.density); result = android_fx_statusToResult(status); } #endif - *pDensity = this->mProperties.density; + *pDensity = thiz->mProperties.density; - interface_unlock_peek(this); + interface_unlock_peek(thiz); } SL_LEAVE_INTERFACE @@ -654,21 +654,21 @@ static SLresult IEnvironmentalReverb_SetEnvironmentalReverbProperties(SLEnvironm break; if (!(0 <= properties.density && properties.density <= 1000)) break; - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_exclusive(this); - this->mProperties = properties; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_exclusive(thiz); + thiz->mProperties = properties; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_setParam(this->mEnvironmentalReverbEffect, + android::status_t status = android_erev_setParam(thiz->mEnvironmentalReverbEffect, REVERB_PARAM_PROPERTIES, &properties); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } while (0); SL_LEAVE_INTERFACE @@ -683,22 +683,22 @@ static SLresult IEnvironmentalReverb_GetEnvironmentalReverbProperties( if (NULL == pProperties) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - interface_lock_shared(this); + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + interface_lock_shared(thiz); #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_ENVREVERB(this)) { + if (NO_ENVREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_erev_getParam(this->mEnvironmentalReverbEffect, - REVERB_PARAM_PROPERTIES, &this->mProperties); + android::status_t status = android_erev_getParam(thiz->mEnvironmentalReverbEffect, + REVERB_PARAM_PROPERTIES, &thiz->mProperties); result = android_fx_statusToResult(status); } #endif - *pProperties = this->mProperties; + *pProperties = thiz->mProperties; - interface_unlock_shared(this); + interface_unlock_shared(thiz); } SL_LEAVE_INTERFACE @@ -745,31 +745,31 @@ static const SLEnvironmentalReverbSettings IEnvironmentalReverb_default = { void IEnvironmentalReverb_init(void *self) { - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; - this->mItf = &IEnvironmentalReverb_Itf; - this->mProperties = IEnvironmentalReverb_default; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; + thiz->mItf = &IEnvironmentalReverb_Itf; + thiz->mProperties = IEnvironmentalReverb_default; #if defined(ANDROID) - memset(&this->mEnvironmentalReverbDescriptor, 0, sizeof(effect_descriptor_t)); + memset(&thiz->mEnvironmentalReverbDescriptor, 0, sizeof(effect_descriptor_t)); // placement new (explicit constructor) - (void) new (&this->mEnvironmentalReverbEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mEnvironmentalReverbEffect) android::sp<android::AudioEffect>(); #endif } void IEnvironmentalReverb_deinit(void *self) { #if defined(ANDROID) - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; // explicit destructor - this->mEnvironmentalReverbEffect.~sp(); + thiz->mEnvironmentalReverbEffect.~sp(); #endif } bool IEnvironmentalReverb_Expose(void *self) { #if defined(ANDROID) - IEnvironmentalReverb *this = (IEnvironmentalReverb *) self; + IEnvironmentalReverb *thiz = (IEnvironmentalReverb *) self; if (!android_fx_initEffectDescriptor(SL_IID_ENVIRONMENTALREVERB, - &this->mEnvironmentalReverbDescriptor)) { + &thiz->mEnvironmentalReverbDescriptor)) { SL_LOGE("EnvironmentalReverb initialization failed."); return false; } diff --git a/src/itf/IEqualizer.c b/src/itf/IEqualizer.c index ba1c49e..e8459b3 100644 --- a/src/itf/IEqualizer.c +++ b/src/itf/IEqualizer.c @@ -53,21 +53,21 @@ static SLresult IEqualizer_SetEnabled(SLEqualizerItf self, SLboolean enabled) { SL_ENTER_INTERFACE - IEqualizer *this = (IEqualizer *) self; - interface_lock_exclusive(this); - this->mEnabled = (SLboolean) enabled; + IEqualizer *thiz = (IEqualizer *) self; + interface_lock_exclusive(thiz); + thiz->mEnabled = (SLboolean) enabled; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - this->mEqEffect->setEnabled((bool) this->mEnabled); + thiz->mEqEffect->setEnabled((bool) thiz->mEnabled); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -80,21 +80,21 @@ static SLresult IEqualizer_IsEnabled(SLEqualizerItf self, SLboolean *pEnabled) if (NULL == pEnabled) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; - interface_lock_exclusive(this); - SLboolean enabled = this->mEnabled; + IEqualizer *thiz = (IEqualizer *) self; + interface_lock_exclusive(thiz); + SLboolean enabled = thiz->mEnabled; #if !defined(ANDROID) *pEnabled = enabled; result = SL_RESULT_SUCCESS; #else - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - *pEnabled = (SLboolean) this->mEqEffect->getEnabled(); + *pEnabled = (SLboolean) thiz->mEqEffect->getEnabled(); result = SL_RESULT_SUCCESS; } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -108,9 +108,9 @@ static SLresult IEqualizer_GetNumberOfBands(SLEqualizerItf self, SLuint16 *pNumB if (NULL == pNumBands) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; // Note: no lock, but OK because it is const - *pNumBands = this->mNumBands; + *pNumBands = thiz->mNumBands; result = SL_RESULT_SUCCESS; } @@ -126,12 +126,12 @@ static SLresult IEqualizer_GetBandLevelRange(SLEqualizerItf self, SLmillibel *pM if (NULL == pMin && NULL == pMax) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; // Note: no lock, but OK because it is const if (NULL != pMin) - *pMin = this->mBandLevelRangeMin; + *pMin = thiz->mBandLevelRangeMin; if (NULL != pMax) - *pMax = this->mBandLevelRangeMax; + *pMax = thiz->mBandLevelRangeMax; result = SL_RESULT_SUCCESS; } @@ -143,26 +143,26 @@ static SLresult IEqualizer_SetBandLevel(SLEqualizerItf self, SLuint16 band, SLmi { SL_ENTER_INTERFACE - IEqualizer *this = (IEqualizer *) self; - if (!(this->mBandLevelRangeMin <= level && level <= this->mBandLevelRangeMax) || - (band >= this->mNumBands)) { + IEqualizer *thiz = (IEqualizer *) self; + if (!(thiz->mBandLevelRangeMin <= level && level <= thiz->mBandLevelRangeMax) || + (band >= thiz->mNumBands)) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); #if !defined(ANDROID) - this->mLevels[band] = level; - this->mPreset = SL_EQUALIZER_UNDEFINED; + thiz->mLevels[band] = level; + thiz->mPreset = SL_EQUALIZER_UNDEFINED; result = SL_RESULT_SUCCESS; #else - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_setParam(this->mEqEffect, EQ_PARAM_BAND_LEVEL, band, &level); + android_eq_setParam(thiz->mEqEffect, EQ_PARAM_BAND_LEVEL, band, &level); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -176,26 +176,26 @@ static SLresult IEqualizer_GetBandLevel(SLEqualizerItf self, SLuint16 band, SLmi if (NULL == pLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; // const, no lock needed - if (band >= this->mNumBands) { + if (band >= thiz->mNumBands) { result = SL_RESULT_PARAMETER_INVALID; } else { SLmillibel level = 0; - interface_lock_shared(this); + interface_lock_shared(thiz); #if !defined(ANDROID) - level = this->mLevels[band]; + level = thiz->mLevels[band]; result = SL_RESULT_SUCCESS; #else - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_getParam(this->mEqEffect, EQ_PARAM_BAND_LEVEL, band, &level); + android_eq_getParam(thiz->mEqEffect, EQ_PARAM_BAND_LEVEL, band, &level); result = android_fx_statusToResult(status); } #endif - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pLevel = level; } } @@ -211,25 +211,25 @@ static SLresult IEqualizer_GetCenterFreq(SLEqualizerItf self, SLuint16 band, SLm if (NULL == pCenter) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; - if (band >= this->mNumBands) { + IEqualizer *thiz = (IEqualizer *) self; + if (band >= thiz->mNumBands) { result = SL_RESULT_PARAMETER_INVALID; } else { #if !defined(ANDROID) // Note: no lock, but OK because it is const - *pCenter = this->mBands[band].mCenter; + *pCenter = thiz->mBands[band].mCenter; result = SL_RESULT_SUCCESS; #else SLmilliHertz center = 0; - interface_lock_shared(this); - if (NO_EQ(this)) { + interface_lock_shared(thiz); + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_getParam(this->mEqEffect, EQ_PARAM_CENTER_FREQ, band, ¢er); + android_eq_getParam(thiz->mEqEffect, EQ_PARAM_CENTER_FREQ, band, ¢er); result = android_fx_statusToResult(status); } - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pCenter = center; #endif } @@ -247,28 +247,28 @@ static SLresult IEqualizer_GetBandFreqRange(SLEqualizerItf self, SLuint16 band, if (NULL == pMin && NULL == pMax) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; - if (band >= this->mNumBands) { + IEqualizer *thiz = (IEqualizer *) self; + if (band >= thiz->mNumBands) { result = SL_RESULT_PARAMETER_INVALID; } else { #if !defined(ANDROID) // Note: no lock, but OK because it is const if (NULL != pMin) - *pMin = this->mBands[band].mMin; + *pMin = thiz->mBands[band].mMin; if (NULL != pMax) - *pMax = this->mBands[band].mMax; + *pMax = thiz->mBands[band].mMax; result = SL_RESULT_SUCCESS; #else SLmilliHertz range[2] = {0, 0}; // SLmilliHertz is SLuint32 - interface_lock_shared(this); - if (NO_EQ(this)) { + interface_lock_shared(thiz); + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_getParam(this->mEqEffect, EQ_PARAM_BAND_FREQ_RANGE, band, range); + android_eq_getParam(thiz->mEqEffect, EQ_PARAM_BAND_FREQ_RANGE, band, range); result = android_fx_statusToResult(status); } - interface_unlock_shared(this); + interface_unlock_shared(thiz); if (NULL != pMin) { *pMin = range[0]; } @@ -290,7 +290,7 @@ static SLresult IEqualizer_GetBand(SLEqualizerItf self, SLmilliHertz frequency, if (NULL == pBand) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; #if !defined(ANDROID) // search for band whose center frequency has the closest ratio to 1.0 // assumes bands are unsorted (a pessimistic assumption) @@ -300,7 +300,7 @@ static SLresult IEqualizer_GetBand(SLEqualizerItf self, SLmilliHertz frequency, float floatFreq = (float) frequency; float bestRatio = 0.0; SLuint16 bestBand = SL_EQUALIZER_UNDEFINED; - for (band = this->mBands; band < &this->mBands[this->mNumBands]; ++band) { + for (band = thiz->mBands; band < &thiz->mBands[thiz->mNumBands]; ++band) { if (!(band->mMin <= frequency && frequency <= band->mMax)) continue; assert(band->mMin <= band->mCenter && band->mCenter <= band->mMax); @@ -309,22 +309,22 @@ static SLresult IEqualizer_GetBand(SLEqualizerItf self, SLmilliHertz frequency, floatFreq / band->mCenter : band->mCenter / floatFreq; if (ratio > bestRatio) { bestRatio = ratio; - bestBand = band - this->mBands; + bestBand = band - thiz->mBands; } } *pBand = bestBand; result = SL_RESULT_SUCCESS; #else uint16_t band = 0; - interface_lock_shared(this); - if (NO_EQ(this)) { + interface_lock_shared(thiz); + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_getParam(this->mEqEffect, EQ_PARAM_GET_BAND, frequency, &band); + android_eq_getParam(thiz->mEqEffect, EQ_PARAM_GET_BAND, frequency, &band); result = android_fx_statusToResult(status); } - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pBand = (SLuint16)band; #endif } @@ -340,23 +340,23 @@ static SLresult IEqualizer_GetCurrentPreset(SLEqualizerItf self, SLuint16 *pPres if (NULL == pPreset) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; - interface_lock_shared(this); + IEqualizer *thiz = (IEqualizer *) self; + interface_lock_shared(thiz); #if !defined(ANDROID) - SLuint16 preset = this->mPreset; - interface_unlock_shared(this); + SLuint16 preset = thiz->mPreset; + interface_unlock_shared(thiz); *pPreset = preset; result = SL_RESULT_SUCCESS; #else uint16_t preset = 0; - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_getParam(this->mEqEffect, EQ_PARAM_CUR_PRESET, 0, &preset); + android_eq_getParam(thiz->mEqEffect, EQ_PARAM_CUR_PRESET, 0, &preset); result = android_fx_statusToResult(status); } - interface_unlock_shared(this); + interface_unlock_shared(thiz); if (preset < 0) { *pPreset = SL_EQUALIZER_UNDEFINED; @@ -376,27 +376,27 @@ static SLresult IEqualizer_UsePreset(SLEqualizerItf self, SLuint16 index) SL_ENTER_INTERFACE SL_LOGV("Equalizer::UsePreset index=%u", index); - IEqualizer *this = (IEqualizer *) self; - if (index >= this->mNumPresets) { + IEqualizer *thiz = (IEqualizer *) self; + if (index >= thiz->mNumPresets) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); #if !defined(ANDROID) SLuint16 band; - for (band = 0; band < this->mNumBands; ++band) - this->mLevels[band] = EqualizerPresets[index].mLevels[band]; - this->mPreset = index; - interface_unlock_exclusive(this); + for (band = 0; band < thiz->mNumBands; ++band) + thiz->mLevels[band] = EqualizerPresets[index].mLevels[band]; + thiz->mPreset = index; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; #else - if (NO_EQ(this)) { + if (NO_EQ(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_eq_setParam(this->mEqEffect, EQ_PARAM_CUR_PRESET, 0, &index); + android_eq_setParam(thiz->mEqEffect, EQ_PARAM_CUR_PRESET, 0, &index); result = android_fx_statusToResult(status); } - interface_unlock_shared(this); + interface_unlock_shared(thiz); #endif } @@ -411,9 +411,9 @@ static SLresult IEqualizer_GetNumberOfPresets(SLEqualizerItf self, SLuint16 *pNu if (NULL == pNumPresets) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; // Note: no lock, but OK because it is const - *pNumPresets = this->mNumPresets; + *pNumPresets = thiz->mNumPresets; result = SL_RESULT_SUCCESS; } @@ -429,23 +429,23 @@ static SLresult IEqualizer_GetPresetName(SLEqualizerItf self, SLuint16 index, co if (NULL == ppName) { result = SL_RESULT_PARAMETER_INVALID; } else { - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; #if !defined(ANDROID) - if (index >= this->mNumPresets) { + if (index >= thiz->mNumPresets) { result = SL_RESULT_PARAMETER_INVALID; } else { - *ppName = (SLchar *) this->mPresets[index].mName; + *ppName = (SLchar *) thiz->mPresets[index].mName; result = SL_RESULT_SUCCESS; } #else - if (index >= this->mNumPresets) { + if (index >= thiz->mNumPresets) { result = SL_RESULT_PARAMETER_INVALID; } else { // FIXME query preset name rather than retrieve it from the engine. // In SL ES 1.0.1, the strings must exist for the lifetime of the engine. // Starting in 1.1, this will change and we don't need to hold onto the strings // for so long as they will copied into application space. - *ppName = (SLchar *) this->mThis->mEngine->mEqPresetNames[index]; + *ppName = (SLchar *) thiz->mThis->mEngine->mEqPresetNames[index]; result = SL_RESULT_SUCCESS; } #endif @@ -473,50 +473,50 @@ static const struct SLEqualizerItf_ IEqualizer_Itf = { void IEqualizer_init(void *self) { - IEqualizer *this = (IEqualizer *) self; - this->mItf = &IEqualizer_Itf; - this->mEnabled = SL_BOOLEAN_FALSE; - this->mPreset = SL_EQUALIZER_UNDEFINED; + IEqualizer *thiz = (IEqualizer *) self; + thiz->mItf = &IEqualizer_Itf; + thiz->mEnabled = SL_BOOLEAN_FALSE; + thiz->mPreset = SL_EQUALIZER_UNDEFINED; #if 0 < MAX_EQ_BANDS unsigned band; for (band = 0; band < MAX_EQ_BANDS; ++band) - this->mLevels[band] = 0; + thiz->mLevels[band] = 0; #endif // const fields - this->mNumPresets = 0; - this->mNumBands = 0; + thiz->mNumPresets = 0; + thiz->mNumBands = 0; #if !defined(ANDROID) - this->mBands = EqualizerBands; - this->mPresets = EqualizerPresets; + thiz->mBands = EqualizerBands; + thiz->mPresets = EqualizerPresets; #endif - this->mBandLevelRangeMin = 0; - this->mBandLevelRangeMax = 0; + thiz->mBandLevelRangeMin = 0; + thiz->mBandLevelRangeMax = 0; #if defined(ANDROID) - memset(&this->mEqDescriptor, 0, sizeof(effect_descriptor_t)); + memset(&thiz->mEqDescriptor, 0, sizeof(effect_descriptor_t)); // placement new (explicit constructor) - (void) new (&this->mEqEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mEqEffect) android::sp<android::AudioEffect>(); #endif } void IEqualizer_deinit(void *self) { #if defined(ANDROID) - IEqualizer *this = (IEqualizer *) self; + IEqualizer *thiz = (IEqualizer *) self; // explicit destructor - this->mEqEffect.~sp(); + thiz->mEqEffect.~sp(); #endif } bool IEqualizer_Expose(void *self) { #if defined(ANDROID) - IEqualizer *this = (IEqualizer *) self; - if (!android_fx_initEffectDescriptor(SL_IID_EQUALIZER, &this->mEqDescriptor)) { + IEqualizer *thiz = (IEqualizer *) self; + if (!android_fx_initEffectDescriptor(SL_IID_EQUALIZER, &thiz->mEqDescriptor)) { SL_LOGE("Equalizer initialization failed"); - this->mNumPresets = 0; - this->mNumBands = 0; - this->mBandLevelRangeMin = 0; - this->mBandLevelRangeMax = 0; + thiz->mNumPresets = 0; + thiz->mNumBands = 0; + thiz->mBandLevelRangeMin = 0; + thiz->mBandLevelRangeMax = 0; return false; } #endif diff --git a/src/itf/ILEDArray.c b/src/itf/ILEDArray.c index 46ac13b..4f6fa85 100644 --- a/src/itf/ILEDArray.c +++ b/src/itf/ILEDArray.c @@ -23,10 +23,10 @@ static SLresult ILEDArray_ActivateLEDArray(SLLEDArrayItf self, SLuint32 lightMas { SL_ENTER_INTERFACE - ILEDArray *this = (ILEDArray *) self; - interface_lock_poke(this); - this->mLightMask = lightMask; - interface_unlock_poke(this); + ILEDArray *thiz = (ILEDArray *) self; + interface_lock_poke(thiz); + thiz->mLightMask = lightMask; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -40,10 +40,10 @@ static SLresult ILEDArray_IsLEDArrayActivated(SLLEDArrayItf self, SLuint32 *pLig if (NULL == pLightMask) { result = SL_RESULT_PARAMETER_INVALID; } else { - ILEDArray *this = (ILEDArray *) self; - interface_lock_peek(this); - SLuint32 lightMask = this->mLightMask; - interface_unlock_peek(this); + ILEDArray *thiz = (ILEDArray *) self; + interface_lock_peek(thiz); + SLuint32 lightMask = thiz->mLightMask; + interface_unlock_peek(thiz); *pLightMask = lightMask; result = SL_RESULT_SUCCESS; } @@ -67,11 +67,11 @@ static SLresult ILEDArray_SetColor(SLLEDArrayItf self, SLuint8 index, const SLHS break; if (!(0 <= color.lightness && color.lightness <= 1000)) break; - ILEDArray *this = (ILEDArray *) self; + ILEDArray *thiz = (ILEDArray *) self; // can't use poke because struct copy might not be atomic - interface_lock_exclusive(this); - this->mColors[index] = color; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mColors[index] = color; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } while (0); @@ -86,11 +86,11 @@ static SLresult ILEDArray_GetColor(SLLEDArrayItf self, SLuint8 index, SLHSL *pCo if (!(index < MAX_LED_COUNT) || NULL == pColor) { result = SL_RESULT_PARAMETER_INVALID; } else { - ILEDArray *this = (ILEDArray *) self; + ILEDArray *thiz = (ILEDArray *) self; // can't use peek because struct copy might not be atomic - interface_lock_shared(this); - SLHSL color = this->mColors[index]; - interface_unlock_shared(this); + interface_lock_shared(thiz); + SLHSL color = thiz->mColors[index]; + interface_unlock_shared(thiz); *pColor = color; result = SL_RESULT_SUCCESS; } @@ -108,10 +108,10 @@ static const struct SLLEDArrayItf_ ILEDArray_Itf = { void ILEDArray_init(void *self) { - ILEDArray *this = (ILEDArray *) self; - this->mItf = &ILEDArray_Itf; - this->mLightMask = 0; - SLHSL *color = this->mColors; + ILEDArray *thiz = (ILEDArray *) self; + thiz->mItf = &ILEDArray_Itf; + thiz->mLightMask = 0; + SLHSL *color = thiz->mColors; SLuint8 index; for (index = 0; index < MAX_LED_COUNT; ++index, ++color) { color->hue = 0; // red, but per specification 1.0.1 pg. 259: "Default color is undefined." @@ -119,5 +119,5 @@ void ILEDArray_init(void *self) color->lightness = 1000; } // const - this->mCount = MAX_LED_COUNT; + thiz->mCount = MAX_LED_COUNT; } diff --git a/src/itf/IMIDIMessage.c b/src/itf/IMIDIMessage.c index da83120..1657bc3 100644 --- a/src/itf/IMIDIMessage.c +++ b/src/itf/IMIDIMessage.c @@ -27,7 +27,7 @@ static SLresult IMIDIMessage_SendMessage(SLMIDIMessageItf self, const SLuint8 *d if (NULL == data) { result = SL_RESULT_PARAMETER_INVALID; } else { - //IMIDIMessage *this = (IMIDIMessage *) self; + //IMIDIMessage *thiz = (IMIDIMessage *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; } @@ -40,11 +40,11 @@ static SLresult IMIDIMessage_RegisterMetaEventCallback(SLMIDIMessageItf self, { SL_ENTER_INTERFACE - IMIDIMessage *this = (IMIDIMessage *) self; - interface_lock_exclusive(this); - this->mMetaEventCallback = callback; - this->mMetaEventContext = pContext; - interface_unlock_exclusive(this); + IMIDIMessage *thiz = (IMIDIMessage *) self; + interface_lock_exclusive(thiz); + thiz->mMetaEventCallback = callback; + thiz->mMetaEventContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -56,11 +56,11 @@ static SLresult IMIDIMessage_RegisterMIDIMessageCallback(SLMIDIMessageItf self, { SL_ENTER_INTERFACE - IMIDIMessage *this = (IMIDIMessage *) self; - interface_lock_exclusive(this); - this->mMessageCallback = callback; - this->mMessageContext = pContext; - interface_unlock_exclusive(this); + IMIDIMessage *thiz = (IMIDIMessage *) self; + interface_lock_exclusive(thiz); + thiz->mMessageCallback = callback; + thiz->mMessageContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -82,10 +82,10 @@ static SLresult IMIDIMessage_AddMIDIMessageCallbackFilter(SLMIDIMessageItf self, case SL_MIDIMESSAGETYPE_SYSTEM_MESSAGE: { SLuint8 messageTypeMask = 1 << messageType; - IMIDIMessage *this = (IMIDIMessage *) self; - interface_lock_exclusive(this); - this->mMessageTypes |= messageTypeMask; - interface_unlock_exclusive(this); + IMIDIMessage *thiz = (IMIDIMessage *) self; + interface_lock_exclusive(thiz); + thiz->mMessageTypes |= messageTypeMask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } break; @@ -102,10 +102,10 @@ static SLresult IMIDIMessage_ClearMIDIMessageCallbackFilter(SLMIDIMessageItf sel { SL_ENTER_INTERFACE - IMIDIMessage *this = (IMIDIMessage *) self; - interface_lock_exclusive(this); - this->mMessageTypes = 0; - interface_unlock_exclusive(this); + IMIDIMessage *thiz = (IMIDIMessage *) self; + interface_lock_exclusive(thiz); + thiz->mMessageTypes = 0; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -122,11 +122,11 @@ static const struct SLMIDIMessageItf_ IMIDIMessage_Itf = { void IMIDIMessage_init(void *self) { - IMIDIMessage *this = (IMIDIMessage *) self; - this->mItf = &IMIDIMessage_Itf; - this->mMetaEventCallback = NULL; - this->mMetaEventContext = NULL; - this->mMessageCallback = NULL; - this->mMessageContext = NULL; - this->mMessageTypes = 0; + IMIDIMessage *thiz = (IMIDIMessage *) self; + thiz->mItf = &IMIDIMessage_Itf; + thiz->mMetaEventCallback = NULL; + thiz->mMetaEventContext = NULL; + thiz->mMessageCallback = NULL; + thiz->mMessageContext = NULL; + thiz->mMessageTypes = 0; } diff --git a/src/itf/IMIDIMuteSolo.c b/src/itf/IMIDIMuteSolo.c index f1524f6..ceb7d76 100644 --- a/src/itf/IMIDIMuteSolo.c +++ b/src/itf/IMIDIMuteSolo.c @@ -27,14 +27,14 @@ static SLresult IMIDIMuteSolo_SetChannelMute(SLMIDIMuteSoloItf self, SLuint8 cha if (channel > 15) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; SLuint16 mask = 1 << channel; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); if (mute) - this->mChannelMuteMask |= mask; + thiz->mChannelMuteMask |= mask; else - this->mChannelMuteMask &= ~mask; - interface_unlock_exclusive(this); + thiz->mChannelMuteMask &= ~mask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -50,10 +50,10 @@ static SLresult IMIDIMuteSolo_GetChannelMute(SLMIDIMuteSoloItf self, SLuint8 cha if (channel > 15 || (NULL == pMute)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; - interface_lock_peek(this); - SLuint16 mask = this->mChannelMuteMask; - interface_unlock_peek(this); + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; + interface_lock_peek(thiz); + SLuint16 mask = thiz->mChannelMuteMask; + interface_unlock_peek(thiz); *pMute = (mask >> channel) & 1; result = SL_RESULT_SUCCESS; } @@ -70,14 +70,14 @@ static SLresult IMIDIMuteSolo_SetChannelSolo(SLMIDIMuteSoloItf self, SLuint8 cha if (channel > 15) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; SLuint16 mask = 1 << channel; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); if (solo) - this->mChannelSoloMask |= mask; + thiz->mChannelSoloMask |= mask; else - this->mChannelSoloMask &= ~mask; - interface_unlock_exclusive(this); + thiz->mChannelSoloMask &= ~mask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -93,10 +93,10 @@ static SLresult IMIDIMuteSolo_GetChannelSolo(SLMIDIMuteSoloItf self, SLuint8 cha if (channel > 15 || (NULL == pSolo)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; - interface_lock_peek(this); - SLuint16 mask = this->mChannelSoloMask; - interface_unlock_peek(this); + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; + interface_lock_peek(thiz); + SLuint16 mask = thiz->mChannelSoloMask; + interface_unlock_peek(thiz); *pSolo = (mask >> channel) & 1; result = SL_RESULT_SUCCESS; } @@ -112,9 +112,9 @@ static SLresult IMIDIMuteSolo_GetTrackCount(SLMIDIMuteSoloItf self, SLuint16 *pC if (NULL == pCount) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; // const, so no lock needed - SLuint16 trackCount = this->mTrackCount; + SLuint16 trackCount = thiz->mTrackCount; *pCount = trackCount; result = SL_RESULT_SUCCESS; } @@ -127,18 +127,18 @@ static SLresult IMIDIMuteSolo_SetTrackMute(SLMIDIMuteSoloItf self, SLuint16 trac { SL_ENTER_INTERFACE - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; // const - if (!(track < this->mTrackCount)) { + if (!(track < thiz->mTrackCount)) { result = SL_RESULT_PARAMETER_INVALID; } else { SLuint32 mask = 1 << track; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); if (mute) - this->mTrackMuteMask |= mask; + thiz->mTrackMuteMask |= mask; else - this->mTrackMuteMask &= ~mask; - interface_unlock_exclusive(this); + thiz->mTrackMuteMask &= ~mask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -150,14 +150,14 @@ static SLresult IMIDIMuteSolo_GetTrackMute(SLMIDIMuteSoloItf self, SLuint16 trac { SL_ENTER_INTERFACE - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; // const, no lock needed - if (!(track < this->mTrackCount) || NULL == pMute) { + if (!(track < thiz->mTrackCount) || NULL == pMute) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_peek(this); - SLuint32 mask = this->mTrackMuteMask; - interface_unlock_peek(this); + interface_lock_peek(thiz); + SLuint32 mask = thiz->mTrackMuteMask; + interface_unlock_peek(thiz); *pMute = (mask >> track) & 1; result = SL_RESULT_SUCCESS; } @@ -170,17 +170,17 @@ static SLresult IMIDIMuteSolo_SetTrackSolo(SLMIDIMuteSoloItf self, SLuint16 trac { SL_ENTER_INTERFACE - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; // const - if (!(track < this->mTrackCount)) { + if (!(track < thiz->mTrackCount)) { result = SL_RESULT_PARAMETER_INVALID; } else { - SLuint32 mask = 1 << track; interface_lock_exclusive(this); + SLuint32 mask = 1 << track; interface_lock_exclusive(thiz); if (solo) - this->mTrackSoloMask |= mask; + thiz->mTrackSoloMask |= mask; else - this->mTrackSoloMask &= ~mask; - interface_unlock_exclusive(this); + thiz->mTrackSoloMask &= ~mask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -192,14 +192,14 @@ static SLresult IMIDIMuteSolo_GetTrackSolo(SLMIDIMuteSoloItf self, SLuint16 trac { SL_ENTER_INTERFACE - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; // const, no lock needed - if (!(track < this->mTrackCount) || NULL == pSolo) { + if (!(track < thiz->mTrackCount) || NULL == pSolo) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_peek(this); - SLuint32 mask = this->mTrackSoloMask; - interface_unlock_peek(this); + interface_lock_peek(thiz); + SLuint32 mask = thiz->mTrackSoloMask; + interface_unlock_peek(thiz); *pSolo = (mask >> track) & 1; result = SL_RESULT_SUCCESS; } @@ -222,12 +222,12 @@ static const struct SLMIDIMuteSoloItf_ IMIDIMuteSolo_Itf = { void IMIDIMuteSolo_init(void *self) { - IMIDIMuteSolo *this = (IMIDIMuteSolo *) self; - this->mItf = &IMIDIMuteSolo_Itf; - this->mChannelMuteMask = 0; - this->mChannelSoloMask = 0; - this->mTrackMuteMask = 0; - this->mTrackSoloMask = 0; + IMIDIMuteSolo *thiz = (IMIDIMuteSolo *) self; + thiz->mItf = &IMIDIMuteSolo_Itf; + thiz->mChannelMuteMask = 0; + thiz->mChannelSoloMask = 0; + thiz->mTrackMuteMask = 0; + thiz->mTrackSoloMask = 0; // const - this->mTrackCount = 32; // wrong + thiz->mTrackCount = 32; // wrong } diff --git a/src/itf/IMIDITempo.c b/src/itf/IMIDITempo.c index daa9133..831fda9 100644 --- a/src/itf/IMIDITempo.c +++ b/src/itf/IMIDITempo.c @@ -26,10 +26,10 @@ static SLresult IMIDITempo_SetTicksPerQuarterNote(SLMIDITempoItf self, SLuint32 if (!(1 <= tpqn && tpqn <= 32767)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITempo *this = (IMIDITempo *) self; - interface_lock_poke(this); - this->mTicksPerQuarterNote = tpqn; - interface_unlock_poke(this); + IMIDITempo *thiz = (IMIDITempo *) self; + interface_lock_poke(thiz); + thiz->mTicksPerQuarterNote = tpqn; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -44,10 +44,10 @@ static SLresult IMIDITempo_GetTicksPerQuarterNote(SLMIDITempoItf self, SLuint32 if (NULL == pTpqn) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITempo *this = (IMIDITempo *) self; - interface_lock_peek(this); - SLuint32 ticksPerQuarterNote = this->mTicksPerQuarterNote; - interface_unlock_peek(this); + IMIDITempo *thiz = (IMIDITempo *) self; + interface_lock_peek(thiz); + SLuint32 ticksPerQuarterNote = thiz->mTicksPerQuarterNote; + interface_unlock_peek(thiz); *pTpqn = ticksPerQuarterNote; result = SL_RESULT_SUCCESS; } @@ -64,10 +64,10 @@ static SLresult IMIDITempo_SetMicrosecondsPerQuarterNote(SLMIDITempoItf self, SL if (!(1 <= uspqn && uspqn <= 16777215)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITempo *this = (IMIDITempo *) self; - interface_lock_poke(this); - this->mMicrosecondsPerQuarterNote = uspqn; - interface_unlock_poke(this); + IMIDITempo *thiz = (IMIDITempo *) self; + interface_lock_poke(thiz); + thiz->mMicrosecondsPerQuarterNote = uspqn; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -82,10 +82,10 @@ static SLresult IMIDITempo_GetMicrosecondsPerQuarterNote(SLMIDITempoItf self, SL if (NULL == uspqn) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITempo *this = (IMIDITempo *) self; - interface_lock_peek(this); - SLuint32 microsecondsPerQuarterNote = this->mMicrosecondsPerQuarterNote; - interface_unlock_peek(this); + IMIDITempo *thiz = (IMIDITempo *) self; + interface_lock_peek(thiz); + SLuint32 microsecondsPerQuarterNote = thiz->mMicrosecondsPerQuarterNote; + interface_unlock_peek(thiz); *uspqn = microsecondsPerQuarterNote; result = SL_RESULT_SUCCESS; } @@ -103,8 +103,8 @@ static const struct SLMIDITempoItf_ IMIDITempo_Itf = { void IMIDITempo_init(void *self) { - IMIDITempo *this = (IMIDITempo *) self; - this->mItf = &IMIDITempo_Itf; - this->mTicksPerQuarterNote = 32; // wrong - this->mMicrosecondsPerQuarterNote = 100; // wrong + IMIDITempo *thiz = (IMIDITempo *) self; + thiz->mItf = &IMIDITempo_Itf; + thiz->mTicksPerQuarterNote = 32; // wrong + thiz->mMicrosecondsPerQuarterNote = 100; // wrong } diff --git a/src/itf/IMIDITime.c b/src/itf/IMIDITime.c index b320d8e..312e4bc 100644 --- a/src/itf/IMIDITime.c +++ b/src/itf/IMIDITime.c @@ -26,8 +26,8 @@ static SLresult IMIDITime_GetDuration(SLMIDITimeItf self, SLuint32 *pDuration) if (NULL == pDuration) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITime *this = (IMIDITime *) self; - SLuint32 duration = this->mDuration; + IMIDITime *thiz = (IMIDITime *) self; + SLuint32 duration = thiz->mDuration; *pDuration = duration; result = SL_RESULT_SUCCESS; } @@ -40,14 +40,14 @@ static SLresult IMIDITime_SetPosition(SLMIDITimeItf self, SLuint32 position) { SL_ENTER_INTERFACE - IMIDITime *this = (IMIDITime *) self; + IMIDITime *thiz = (IMIDITime *) self; // const, no lock needed - if (!(position < this->mDuration)) { + if (!(position < thiz->mDuration)) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_poke(this); - this->mPosition = position; - interface_unlock_poke(this); + interface_lock_poke(thiz); + thiz->mPosition = position; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -62,10 +62,10 @@ static SLresult IMIDITime_GetPosition(SLMIDITimeItf self, SLuint32 *pPosition) if (NULL == pPosition) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITime *this = (IMIDITime *) self; - interface_lock_peek(this); - SLuint32 position = this->mPosition; - interface_unlock_peek(this); + IMIDITime *thiz = (IMIDITime *) self; + interface_lock_peek(thiz); + SLuint32 position = thiz->mPosition; + interface_unlock_peek(thiz); *pPosition = position; result = SL_RESULT_SUCCESS; } @@ -78,16 +78,16 @@ static SLresult IMIDITime_SetLoopPoints(SLMIDITimeItf self, SLuint32 startTick, { SL_ENTER_INTERFACE - IMIDITime *this = (IMIDITime *) self; + IMIDITime *thiz = (IMIDITime *) self; // const, no lock needed - SLuint32 duration = this->mDuration; + SLuint32 duration = thiz->mDuration; if (!((startTick < duration) && (numTicks <= duration - startTick))) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_exclusive(this); - this->mStartTick = startTick; - this->mNumTicks = numTicks; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mStartTick = startTick; + thiz->mNumTicks = numTicks; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -103,11 +103,11 @@ static SLresult IMIDITime_GetLoopPoints(SLMIDITimeItf self, SLuint32 *pStartTick if (NULL == pStartTick || NULL == pNumTicks) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMIDITime *this = (IMIDITime *) self; - interface_lock_shared(this); - SLuint32 startTick = this->mStartTick; - SLuint32 numTicks = this->mNumTicks; - interface_unlock_shared(this); + IMIDITime *thiz = (IMIDITime *) self; + interface_lock_shared(thiz); + SLuint32 startTick = thiz->mStartTick; + SLuint32 numTicks = thiz->mNumTicks; + interface_unlock_shared(thiz); *pStartTick = startTick; *pNumTicks = numTicks; result = SL_RESULT_SUCCESS; @@ -127,10 +127,10 @@ static const struct SLMIDITimeItf_ IMIDITime_Itf = { void IMIDITime_init(void *self) { - IMIDITime *this = (IMIDITime *) self; - this->mItf = &IMIDITime_Itf; - this->mDuration = 0; - this->mPosition = 0; - this->mStartTick = 0; - this->mNumTicks = 0; + IMIDITime *thiz = (IMIDITime *) self; + thiz->mItf = &IMIDITime_Itf; + thiz->mDuration = 0; + thiz->mPosition = 0; + thiz->mStartTick = 0; + thiz->mNumTicks = 0; } diff --git a/src/itf/IMetadataExtraction.c b/src/itf/IMetadataExtraction.c index 0fabbb5..16368bb 100644 --- a/src/itf/IMetadataExtraction.c +++ b/src/itf/IMetadataExtraction.c @@ -23,7 +23,7 @@ static SLresult IMetadataExtraction_GetItemCount(SLMetadataExtractionItf self, S { SL_ENTER_INTERFACE - //IMetadataExtraction *this = (IMetadataExtraction *) self; + //IMetadataExtraction *thiz = (IMetadataExtraction *) self; if (NULL == pItemCount) { result = SL_RESULT_PARAMETER_INVALID; } else { @@ -40,7 +40,7 @@ static SLresult IMetadataExtraction_GetKeySize(SLMetadataExtractionItf self, { SL_ENTER_INTERFACE - //IMetadataExtraction *this = (IMetadataExtraction *) self; + //IMetadataExtraction *thiz = (IMetadataExtraction *) self; if (NULL == pKeySize) { result = SL_RESULT_PARAMETER_INVALID; } else { @@ -57,7 +57,7 @@ static SLresult IMetadataExtraction_GetKey(SLMetadataExtractionItf self, { SL_ENTER_INTERFACE - //IMetadataExtraction *this = (IMetadataExtraction *) self; + //IMetadataExtraction *thiz = (IMetadataExtraction *) self; if (NULL == pKey) { result = SL_RESULT_PARAMETER_INVALID; } else { @@ -79,7 +79,7 @@ static SLresult IMetadataExtraction_GetValueSize(SLMetadataExtractionItf self, { SL_ENTER_INTERFACE - //IMetadataExtraction *this = (IMetadataExtraction *) self; + //IMetadataExtraction *thiz = (IMetadataExtraction *) self; if (NULL == pValueSize) { result = SL_RESULT_PARAMETER_INVALID; } else { @@ -96,7 +96,7 @@ static SLresult IMetadataExtraction_GetValue(SLMetadataExtractionItf self, { SL_ENTER_INTERFACE - //IMetadataExtraction *this = (IMetadataExtraction *) self; + //IMetadataExtraction *thiz = (IMetadataExtraction *) self; if (NULL == pValue) { result = SL_RESULT_PARAMETER_INVALID; } else { @@ -123,15 +123,15 @@ static SLresult IMetadataExtraction_AddKeyFilter(SLMetadataExtractionItf self, SL_METADATA_FILTER_KEY | SL_METADATA_FILTER_KEY))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMetadataExtraction *this = (IMetadataExtraction *) self; - interface_lock_exclusive(this); - this->mKeySize = keySize; - this->mKey = pKey; - this->mKeyEncoding = keyEncoding; - this->mValueLangCountry = pValueLangCountry; // should make a local copy - this->mValueEncoding = valueEncoding; - this->mFilterMask = filterMask; - interface_unlock_exclusive(this); + IMetadataExtraction *thiz = (IMetadataExtraction *) self; + interface_lock_exclusive(thiz); + thiz->mKeySize = keySize; + thiz->mKey = pKey; + thiz->mKeyEncoding = keyEncoding; + thiz->mValueLangCountry = pValueLangCountry; // should make a local copy + thiz->mValueEncoding = valueEncoding; + thiz->mFilterMask = filterMask; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -143,8 +143,8 @@ static SLresult IMetadataExtraction_ClearKeyFilter(SLMetadataExtractionItf self) { SL_ENTER_INTERFACE - IMetadataExtraction *this = (IMetadataExtraction *) self; - this->mKeyFilter = 0; + IMetadataExtraction *thiz = (IMetadataExtraction *) self; + thiz->mKeyFilter = 0; result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -163,13 +163,13 @@ static const struct SLMetadataExtractionItf_ IMetadataExtraction_Itf = { void IMetadataExtraction_init(void *self) { - IMetadataExtraction *this = (IMetadataExtraction *) self; - this->mItf = &IMetadataExtraction_Itf; - this->mKeySize = 0; - this->mKey = NULL; - this->mKeyEncoding = 0 /*TBD*/; - this->mValueLangCountry = 0 /*TBD*/; - this->mValueEncoding = 0 /*TBD*/; - this->mFilterMask = 0 /*TBD*/; - this->mKeyFilter = 0; + IMetadataExtraction *thiz = (IMetadataExtraction *) self; + thiz->mItf = &IMetadataExtraction_Itf; + thiz->mKeySize = 0; + thiz->mKey = NULL; + thiz->mKeyEncoding = 0 /*TBD*/; + thiz->mValueLangCountry = 0 /*TBD*/; + thiz->mValueEncoding = 0 /*TBD*/; + thiz->mFilterMask = 0 /*TBD*/; + thiz->mKeyFilter = 0; } diff --git a/src/itf/IMetadataTraversal.c b/src/itf/IMetadataTraversal.c index 0793eeb..2432b9a 100644 --- a/src/itf/IMetadataTraversal.c +++ b/src/itf/IMetadataTraversal.c @@ -27,10 +27,10 @@ static SLresult IMetadataTraversal_SetMode(SLMetadataTraversalItf self, SLuint32 case SL_METADATATRAVERSALMODE_ALL: case SL_METADATATRAVERSALMODE_NODE: { - IMetadataTraversal *this = (IMetadataTraversal *) self; - interface_lock_poke(this); - this->mMode = mode; - interface_unlock_poke(this); + IMetadataTraversal *thiz = (IMetadataTraversal *) self; + interface_lock_poke(thiz); + thiz->mMode = mode; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } break; @@ -50,10 +50,10 @@ static SLresult IMetadataTraversal_GetChildCount(SLMetadataTraversalItf self, SL if (NULL == pCount) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMetadataTraversal *this = (IMetadataTraversal *) self; - interface_lock_peek(this); - SLuint32 count = this->mCount; - interface_unlock_peek(this); + IMetadataTraversal *thiz = (IMetadataTraversal *) self; + interface_lock_peek(thiz); + SLuint32 count = thiz->mCount; + interface_unlock_peek(thiz); *pCount = count; result = SL_RESULT_SUCCESS; } @@ -70,10 +70,10 @@ static SLresult IMetadataTraversal_GetChildMIMETypeSize( if (NULL == pSize) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMetadataTraversal *this = (IMetadataTraversal *) self; - interface_lock_peek(this); - SLuint32 size = this->mSize; - interface_unlock_peek(this); + IMetadataTraversal *thiz = (IMetadataTraversal *) self; + interface_lock_peek(thiz); + SLuint32 size = thiz->mSize; + interface_unlock_peek(thiz); *pSize = size; result = SL_RESULT_SUCCESS; } @@ -87,7 +87,7 @@ static SLresult IMetadataTraversal_GetChildInfo(SLMetadataTraversalItf self, SLu { SL_ENTER_INTERFACE - //IMetadataTraversal *this = (IMetadataTraversal *) self; + //IMetadataTraversal *thiz = (IMetadataTraversal *) self; result = SL_RESULT_FEATURE_UNSUPPORTED; SL_LEAVE_INTERFACE @@ -101,8 +101,8 @@ static SLresult IMetadataTraversal_SetActiveNode(SLMetadataTraversalItf self, SL if (SL_NODE_PARENT == index) { ; } - IMetadataTraversal *this = (IMetadataTraversal *) self; - this->mIndex = index; + IMetadataTraversal *thiz = (IMetadataTraversal *) self; + thiz->mIndex = index; result = SL_RESULT_PARAMETER_INVALID; SL_LEAVE_INTERFACE @@ -119,10 +119,10 @@ static const struct SLMetadataTraversalItf_ IMetadataTraversal_Itf = { void IMetadataTraversal_init(void *self) { - IMetadataTraversal *this = (IMetadataTraversal *) self; - this->mItf = &IMetadataTraversal_Itf; - this->mIndex = 0; - this->mMode = SL_METADATATRAVERSALMODE_NODE; - this->mCount = 0; - this->mSize = 0; + IMetadataTraversal *thiz = (IMetadataTraversal *) self; + thiz->mItf = &IMetadataTraversal_Itf; + thiz->mIndex = 0; + thiz->mMode = SL_METADATATRAVERSALMODE_NODE; + thiz->mCount = 0; + thiz->mSize = 0; } diff --git a/src/itf/IMuteSolo.c b/src/itf/IMuteSolo.c index 2811a71..dcf5879 100644 --- a/src/itf/IMuteSolo.c +++ b/src/itf/IMuteSolo.c @@ -23,19 +23,19 @@ static SLresult IMuteSolo_SetChannelMute(SLMuteSoloItf self, SLuint8 chan, SLboo { SL_ENTER_INTERFACE - IMuteSolo *this = (IMuteSolo *) self; - IObject *thisObject = this->mThis; + IMuteSolo *thiz = (IMuteSolo *) self; + IObject *thisObject = thiz->mThis; if (SL_OBJECTID_AUDIOPLAYER != IObjectToObjectID(thisObject)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { CAudioPlayer *ap = (CAudioPlayer *) thisObject; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); SLuint8 numChannels = ap->mNumChannels; if (1 >= numChannels) { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_FEATURE_UNSUPPORTED; } else if (numChannels <= chan) { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_PARAMETER_INVALID; } else { SLuint8 mask = 1 << chan; @@ -45,7 +45,7 @@ static SLresult IMuteSolo_SetChannelMute(SLMuteSoloItf self, SLuint8 chan, SLboo } else { ap->mMuteMask &= ~mask; } - interface_unlock_exclusive_attributes(this, oldMuteMask != ap->mMuteMask ? ATTR_GAIN : + interface_unlock_exclusive_attributes(thiz, oldMuteMask != ap->mMuteMask ? ATTR_GAIN : ATTR_NONE); result = SL_RESULT_SUCCESS; } @@ -62,14 +62,14 @@ static SLresult IMuteSolo_GetChannelMute(SLMuteSoloItf self, SLuint8 chan, SLboo if (NULL == pMute) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMuteSolo *this = (IMuteSolo *) self; - IObject *thisObject = this->mThis; + IMuteSolo *thiz = (IMuteSolo *) self; + IObject *thisObject = thiz->mThis; if (SL_OBJECTID_AUDIOPLAYER != IObjectToObjectID(thisObject)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { CAudioPlayer *ap = (CAudioPlayer *) thisObject; SLboolean mute; - interface_lock_shared(this); + interface_lock_shared(thiz); SLuint8 numChannels = ap->mNumChannels; if (1 >= numChannels) { mute = SL_BOOLEAN_FALSE; @@ -82,7 +82,7 @@ static SLresult IMuteSolo_GetChannelMute(SLMuteSoloItf self, SLuint8 chan, SLboo mute = (SLboolean) ((mask >> chan) & 1); result = SL_RESULT_SUCCESS; } - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pMute = mute; } } @@ -95,19 +95,19 @@ static SLresult IMuteSolo_SetChannelSolo(SLMuteSoloItf self, SLuint8 chan, SLboo { SL_ENTER_INTERFACE - IMuteSolo *this = (IMuteSolo *) self; - IObject *thisObject = this->mThis; + IMuteSolo *thiz = (IMuteSolo *) self; + IObject *thisObject = thiz->mThis; if (SL_OBJECTID_AUDIOPLAYER != IObjectToObjectID(thisObject)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { CAudioPlayer *ap = (CAudioPlayer *) thisObject; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); SLuint8 numChannels = ap->mNumChannels; if (1 >= numChannels) { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_FEATURE_UNSUPPORTED; } else if (numChannels <= chan) { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_PARAMETER_INVALID; } else { SLuint8 mask = 1 << chan; @@ -117,7 +117,7 @@ static SLresult IMuteSolo_SetChannelSolo(SLMuteSoloItf self, SLuint8 chan, SLboo } else { ap->mSoloMask &= ~mask; } - interface_unlock_exclusive_attributes(this, oldSoloMask != ap->mSoloMask ? ATTR_GAIN : + interface_unlock_exclusive_attributes(thiz, oldSoloMask != ap->mSoloMask ? ATTR_GAIN : ATTR_NONE); result = SL_RESULT_SUCCESS; } @@ -134,14 +134,14 @@ static SLresult IMuteSolo_GetChannelSolo(SLMuteSoloItf self, SLuint8 chan, SLboo if (NULL == pSolo) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMuteSolo *this = (IMuteSolo *) self; - IObject *thisObject = this->mThis; + IMuteSolo *thiz = (IMuteSolo *) self; + IObject *thisObject = thiz->mThis; if (SL_OBJECTID_AUDIOPLAYER != IObjectToObjectID(thisObject)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { CAudioPlayer *ap = (CAudioPlayer *) thisObject; SLboolean solo; - interface_lock_shared(this); + interface_lock_shared(thiz); SLuint8 numChannels = ap->mNumChannels; if (1 >= numChannels) { solo = SL_BOOLEAN_FALSE; @@ -154,7 +154,7 @@ static SLresult IMuteSolo_GetChannelSolo(SLMuteSoloItf self, SLuint8 chan, SLboo solo = (SLboolean) ((mask >> chan) & 1); result = SL_RESULT_SUCCESS; } - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pSolo = solo; } } @@ -170,8 +170,8 @@ static SLresult IMuteSolo_GetNumChannels(SLMuteSoloItf self, SLuint8 *pNumChanne if (NULL == pNumChannels) { result = SL_RESULT_PARAMETER_INVALID; } else { - IMuteSolo *this = (IMuteSolo *) self; - IObject *thisObject = this->mThis; + IMuteSolo *thiz = (IMuteSolo *) self; + IObject *thisObject = thiz->mThis; if (SL_OBJECTID_AUDIOPLAYER != IObjectToObjectID(thisObject)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { @@ -198,6 +198,6 @@ static const struct SLMuteSoloItf_ IMuteSolo_Itf = { void IMuteSolo_init(void *self) { - IMuteSolo *this = (IMuteSolo *) self; - this->mItf = &IMuteSolo_Itf; + IMuteSolo *thiz = (IMuteSolo *) self; + thiz->mItf = &IMuteSolo_Itf; } diff --git a/src/itf/IObject.c b/src/itf/IObject.c index 4ca150a..faad02e 100644 --- a/src/itf/IObject.c +++ b/src/itf/IObject.c @@ -26,27 +26,27 @@ static void HandleRealize(void *self, int unused) { // validate input parameters - IObject *this = (IObject *) self; - assert(NULL != this); - const ClassTable *class__ = this->mClass; - assert(NULL != class__); - AsyncHook realize = class__->mRealize; + IObject *thiz = (IObject *) self; + assert(NULL != thiz); + const ClassTable *clazz = thiz->mClass; + assert(NULL != clazz); + AsyncHook realize = clazz->mRealize; SLresult result; SLuint8 state; // check object state - object_lock_exclusive(this); - state = this->mState; + object_lock_exclusive(thiz); + state = thiz->mState; switch (state) { case SL_OBJECT_STATE_REALIZING_1: // normal case if (NULL != realize) { - this->mState = SL_OBJECT_STATE_REALIZING_2; - object_unlock_exclusive(this); + thiz->mState = SL_OBJECT_STATE_REALIZING_2; + object_unlock_exclusive(thiz); // Note that the mutex is unlocked during the realize hook - result = (*realize)(this, SL_BOOLEAN_TRUE); - object_lock_exclusive(this); - assert(SL_OBJECT_STATE_REALIZING_2 == this->mState); + result = (*realize)(thiz, SL_BOOLEAN_TRUE); + object_lock_exclusive(thiz); + assert(SL_OBJECT_STATE_REALIZING_2 == thiz->mState); state = SL_RESULT_SUCCESS == result ? SL_OBJECT_STATE_REALIZED : SL_OBJECT_STATE_UNREALIZED; } else { @@ -68,16 +68,16 @@ static void HandleRealize(void *self, int unused) } // mutex is locked, update state - this->mState = state; + thiz->mState = state; // Make a copy of these, so we can call the callback with mutex unlocked - slObjectCallback callback = this->mCallback; - void *context = this->mContext; - object_unlock_exclusive(this); + slObjectCallback callback = thiz->mCallback; + void *context = thiz->mContext; + object_unlock_exclusive(thiz); // Note that the mutex is unlocked during the callback if (NULL != callback) { - (*callback)(&this->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, NULL); + (*callback)(&thiz->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, NULL); } } @@ -86,13 +86,13 @@ static SLresult IObject_Realize(SLObjectItf self, SLboolean async) { SL_ENTER_INTERFACE - IObject *this = (IObject *) self; + IObject *thiz = (IObject *) self; SLuint8 state; - const ClassTable *class__ = this->mClass; + const ClassTable *clazz = thiz->mClass; bool isSharedEngine = false; - object_lock_exclusive(this); + object_lock_exclusive(thiz); // note that SL_OBJECTID_ENGINE and XA_OBJECTID_ENGINE map to same class - if (class__ == objectIDtoClass(SL_OBJECTID_ENGINE)) { + if (clazz == objectIDtoClass(SL_OBJECTID_ENGINE)) { // important: the lock order is engine followed by theOneTrueMutex int ok = pthread_mutex_lock(&theOneTrueMutex); assert(0 == ok); @@ -100,10 +100,10 @@ static SLresult IObject_Realize(SLObjectItf self, SLboolean async) ok = pthread_mutex_unlock(&theOneTrueMutex); assert(0 == ok); } - state = this->mState; + state = thiz->mState; // Reject redundant calls to Realize, except on a shared engine if (SL_OBJECT_STATE_UNREALIZED != state) { - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); // redundant realize on the shared engine is permitted if (isSharedEngine && (SL_OBJECT_STATE_REALIZED == state)) { result = SL_RESULT_SUCCESS; @@ -112,42 +112,42 @@ static SLresult IObject_Realize(SLObjectItf self, SLboolean async) } } else { // Asynchronous: mark operation pending and cancellable - if (async && (SL_OBJECTID_ENGINE != class__->mSLObjectID)) { + if (async && (SL_OBJECTID_ENGINE != clazz->mSLObjectID)) { state = SL_OBJECT_STATE_REALIZING_1; // Synchronous: mark operation pending and non-cancellable } else { state = SL_OBJECT_STATE_REALIZING_2; } - this->mState = state; - object_unlock_exclusive(this); + thiz->mState = state; + object_unlock_exclusive(thiz); switch (state) { case SL_OBJECT_STATE_REALIZING_1: // asynchronous on non-Engine assert(async); - result = ThreadPool_add(&this->mEngine->mThreadPool, HandleRealize, this, 0); + result = ThreadPool_add(&thiz->mEngine->mThreadPool, HandleRealize, thiz, 0); if (SL_RESULT_SUCCESS != result) { // Engine was destroyed during realize, or insufficient memory - object_lock_exclusive(this); - this->mState = SL_OBJECT_STATE_UNREALIZED; - object_unlock_exclusive(this); + object_lock_exclusive(thiz); + thiz->mState = SL_OBJECT_STATE_UNREALIZED; + object_unlock_exclusive(thiz); } break; case SL_OBJECT_STATE_REALIZING_2: // synchronous, or asynchronous on Engine { - AsyncHook realize = class__->mRealize; + AsyncHook realize = clazz->mRealize; // Note that the mutex is unlocked during the realize hook - result = (NULL != realize) ? (*realize)(this, async) : SL_RESULT_SUCCESS; - object_lock_exclusive(this); - assert(SL_OBJECT_STATE_REALIZING_2 == this->mState); + result = (NULL != realize) ? (*realize)(thiz, async) : SL_RESULT_SUCCESS; + object_lock_exclusive(thiz); + assert(SL_OBJECT_STATE_REALIZING_2 == thiz->mState); state = (SL_RESULT_SUCCESS == result) ? SL_OBJECT_STATE_REALIZED : SL_OBJECT_STATE_UNREALIZED; - this->mState = state; - slObjectCallback callback = this->mCallback; - void *context = this->mContext; - object_unlock_exclusive(this); + thiz->mState = state; + slObjectCallback callback = thiz->mCallback; + void *context = thiz->mContext; + object_unlock_exclusive(thiz); // asynchronous Realize on an Engine is actually done synchronously, but still has // callback because there is no thread pool yet to do it asynchronously. if (async && (NULL != callback)) { - (*callback)(&this->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, + (*callback)(&thiz->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, NULL); } } @@ -169,27 +169,27 @@ static void HandleResume(void *self, int unused) { // valid input parameters - IObject *this = (IObject *) self; - assert(NULL != this); - const ClassTable *class__ = this->mClass; - assert(NULL != class__); - AsyncHook resume = class__->mResume; + IObject *thiz = (IObject *) self; + assert(NULL != thiz); + const ClassTable *clazz = thiz->mClass; + assert(NULL != clazz); + AsyncHook resume = clazz->mResume; SLresult result; SLuint8 state; // check object state - object_lock_exclusive(this); - state = this->mState; + object_lock_exclusive(thiz); + state = thiz->mState; switch (state) { case SL_OBJECT_STATE_RESUMING_1: // normal case if (NULL != resume) { - this->mState = SL_OBJECT_STATE_RESUMING_2; - object_unlock_exclusive(this); + thiz->mState = SL_OBJECT_STATE_RESUMING_2; + object_unlock_exclusive(thiz); // Note that the mutex is unlocked during the resume hook - result = (*resume)(this, SL_BOOLEAN_TRUE); - object_lock_exclusive(this); - assert(SL_OBJECT_STATE_RESUMING_2 == this->mState); + result = (*resume)(thiz, SL_BOOLEAN_TRUE); + object_lock_exclusive(thiz); + assert(SL_OBJECT_STATE_RESUMING_2 == thiz->mState); state = SL_RESULT_SUCCESS == result ? SL_OBJECT_STATE_REALIZED : SL_OBJECT_STATE_SUSPENDED; } else { @@ -211,16 +211,16 @@ static void HandleResume(void *self, int unused) } // mutex is unlocked, update state - this->mState = state; + thiz->mState = state; // Make a copy of these, so we can call the callback with mutex unlocked - slObjectCallback callback = this->mCallback; - void *context = this->mContext; - object_unlock_exclusive(this); + slObjectCallback callback = thiz->mCallback; + void *context = thiz->mContext; + object_unlock_exclusive(thiz); // Note that the mutex is unlocked during the callback if (NULL != callback) { - (*callback)(&this->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, NULL); + (*callback)(&thiz->mItf, context, SL_OBJECT_EVENT_ASYNC_TERMINATION, result, state, NULL); } } @@ -229,14 +229,14 @@ static SLresult IObject_Resume(SLObjectItf self, SLboolean async) { SL_ENTER_INTERFACE - IObject *this = (IObject *) self; - const ClassTable *class__ = this->mClass; + IObject *thiz = (IObject *) self; + const ClassTable *clazz = thiz->mClass; SLuint8 state; - object_lock_exclusive(this); - state = this->mState; + object_lock_exclusive(thiz); + state = thiz->mState; // Reject redundant calls to Resume if (SL_OBJECT_STATE_SUSPENDED != state) { - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); result = SL_RESULT_PRECONDITIONS_VIOLATED; } else { // Asynchronous: mark operation pending and cancellable @@ -246,29 +246,29 @@ static SLresult IObject_Resume(SLObjectItf self, SLboolean async) } else { state = SL_OBJECT_STATE_RESUMING_2; } - this->mState = state; - object_unlock_exclusive(this); + thiz->mState = state; + object_unlock_exclusive(thiz); switch (state) { case SL_OBJECT_STATE_RESUMING_1: // asynchronous assert(async); - result = ThreadPool_add(&this->mEngine->mThreadPool, HandleResume, this, 0); + result = ThreadPool_add(&thiz->mEngine->mThreadPool, HandleResume, thiz, 0); if (SL_RESULT_SUCCESS != result) { // Engine was destroyed during resume, or insufficient memory - object_lock_exclusive(this); - this->mState = SL_OBJECT_STATE_SUSPENDED; - object_unlock_exclusive(this); + object_lock_exclusive(thiz); + thiz->mState = SL_OBJECT_STATE_SUSPENDED; + object_unlock_exclusive(thiz); } break; case SL_OBJECT_STATE_RESUMING_2: // synchronous { - AsyncHook resume = class__->mResume; + AsyncHook resume = clazz->mResume; // Note that the mutex is unlocked during the resume hook - result = (NULL != resume) ? (*resume)(this, SL_BOOLEAN_FALSE) : SL_RESULT_SUCCESS; - object_lock_exclusive(this); - assert(SL_OBJECT_STATE_RESUMING_2 == this->mState); - this->mState = (SL_RESULT_SUCCESS == result) ? SL_OBJECT_STATE_REALIZED : + result = (NULL != resume) ? (*resume)(thiz, SL_BOOLEAN_FALSE) : SL_RESULT_SUCCESS; + object_lock_exclusive(thiz); + assert(SL_OBJECT_STATE_RESUMING_2 == thiz->mState); + thiz->mState = (SL_RESULT_SUCCESS == result) ? SL_OBJECT_STATE_REALIZED : SL_OBJECT_STATE_SUSPENDED; - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); } break; default: // impossible @@ -288,11 +288,11 @@ static SLresult IObject_GetState(SLObjectItf self, SLuint32 *pState) if (NULL == pState) { result = SL_RESULT_PARAMETER_INVALID; } else { - IObject *this = (IObject *) self; + IObject *thiz = (IObject *) self; // Note that the state is immediately obsolete, so a peek lock is safe - object_lock_peek(this); - SLuint8 state = this->mState; - object_unlock_peek(this); + object_lock_peek(thiz); + SLuint8 state = thiz->mState; + object_unlock_peek(thiz); // Re-map the realizing, resuming, and suspending states switch (state) { case SL_OBJECT_STATE_REALIZING_1: @@ -334,35 +334,35 @@ static SLresult IObject_GetInterface(SLObjectItf self, const SLInterfaceID iid, if (NULL == iid) { result = SL_RESULT_PARAMETER_INVALID; } else { - IObject *this = (IObject *) self; - const ClassTable *class__ = this->mClass; + IObject *thiz = (IObject *) self; + const ClassTable *clazz = thiz->mClass; int MPH, index; if ((0 > (MPH = IID_to_MPH(iid))) || // no need to check for an initialization hook // (NULL == MPH_init_table[MPH].mInit) || - (0 > (index = class__->mMPH_to_index[MPH]))) { + (0 > (index = clazz->mMPH_to_index[MPH]))) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { unsigned mask = 1 << index; - object_lock_exclusive(this); - if ((SL_OBJECT_STATE_REALIZED != this->mState) && - !(INTERFACE_PREREALIZE & class__->mInterfaces[index].mInterface)) { + object_lock_exclusive(thiz); + if ((SL_OBJECT_STATE_REALIZED != thiz->mState) && + !(INTERFACE_PREREALIZE & clazz->mInterfaces[index].mInterface)) { // Can't get interface on an unrealized object unless pre-realize is ok result = SL_RESULT_PRECONDITIONS_VIOLATED; } else if ((MPH_MUTESOLO == MPH) && (SL_OBJECTID_AUDIOPLAYER == - class__->mSLObjectID) && (1 == ((CAudioPlayer *) this)->mNumChannels)) { + clazz->mSLObjectID) && (1 == ((CAudioPlayer *) thiz)->mNumChannels)) { // Can't get the MuteSolo interface of an audio player if the channel count is // mono, but _can_ get the MuteSolo interface if the channel count is unknown result = SL_RESULT_FEATURE_UNSUPPORTED; } else { - switch (this->mInterfaceStates[index]) { + switch (thiz->mInterfaceStates[index]) { case INTERFACE_EXPOSED: case INTERFACE_ADDED: - interface = (char *) this + class__->mInterfaces[index].mOffset; + interface = (char *) thiz + clazz->mInterfaces[index].mOffset; // Note that interface has been gotten, // for debugger and to detect incorrect use of interfaces - if (!(this->mGottenMask & mask)) { - this->mGottenMask |= mask; + if (!(thiz->mGottenMask & mask)) { + thiz->mGottenMask |= mask; // This trickery validates the v-table ((size_t *) interface)[0] ^= ~0; } @@ -375,7 +375,7 @@ static SLresult IObject_GetInterface(SLObjectItf self, const SLInterfaceID iid, break; } } - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); } } *(void **)pInterface = interface; @@ -390,11 +390,11 @@ static SLresult IObject_RegisterCallback(SLObjectItf self, { SL_ENTER_INTERFACE - IObject *this = (IObject *) self; - object_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; - object_unlock_exclusive(this); + IObject *thiz = (IObject *) self; + object_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; + object_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -405,20 +405,20 @@ static SLresult IObject_RegisterCallback(SLObjectItf self, * Note: called with mutex unlocked, and returns with mutex locked. */ -static void Abort_internal(IObject *this) +static void Abort_internal(IObject *thiz) { - const ClassTable *class__ = this->mClass; + const ClassTable *clazz = thiz->mClass; bool anyAsync = false; - object_lock_exclusive(this); + object_lock_exclusive(thiz); // Abort asynchronous operations on the object - switch (this->mState) { + switch (thiz->mState) { case SL_OBJECT_STATE_REALIZING_1: // Realize - this->mState = SL_OBJECT_STATE_REALIZING_1A; + thiz->mState = SL_OBJECT_STATE_REALIZING_1A; anyAsync = true; break; case SL_OBJECT_STATE_RESUMING_1: // Resume - this->mState = SL_OBJECT_STATE_RESUMING_1A; + thiz->mState = SL_OBJECT_STATE_RESUMING_1A; anyAsync = true; break; case SL_OBJECT_STATE_REALIZING_1A: // Realize @@ -435,9 +435,9 @@ static void Abort_internal(IObject *this) } // Abort asynchronous operations on interfaces - SLuint8 *interfaceStateP = this->mInterfaceStates; + SLuint8 *interfaceStateP = thiz->mInterfaceStates; unsigned index; - for (index = 0; index < class__->mInterfaceCount; ++index, ++interfaceStateP) { + for (index = 0; index < clazz->mInterfaceCount; ++index, ++interfaceStateP) { switch (*interfaceStateP) { case INTERFACE_ADDING_1: // AddInterface *interfaceStateP = INTERFACE_ADDING_1A; @@ -461,12 +461,12 @@ static void Abort_internal(IObject *this) // Wait until all asynchronous operations either complete normally or recognize the abort while (anyAsync) { - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); // FIXME should use condition variable instead of polling usleep(20000); anyAsync = false; - object_lock_exclusive(this); - switch (this->mState) { + object_lock_exclusive(thiz); + switch (thiz->mState) { case SL_OBJECT_STATE_REALIZING_1: // state 1 means it cycled during the usleep window case SL_OBJECT_STATE_RESUMING_1: case SL_OBJECT_STATE_REALIZING_1A: @@ -481,8 +481,8 @@ static void Abort_internal(IObject *this) default: break; } - interfaceStateP = this->mInterfaceStates; - for (index = 0; index < class__->mInterfaceCount; ++index, ++interfaceStateP) { + interfaceStateP = thiz->mInterfaceStates; + for (index = 0; index < clazz->mInterfaceCount; ++index, ++interfaceStateP) { switch (*interfaceStateP) { case INTERFACE_ADDING_1: // state 1 means it cycled during the usleep window case INTERFACE_RESUMING_1: @@ -507,9 +507,9 @@ static void IObject_AbortAsyncOperation(SLObjectItf self) { SL_ENTER_INTERFACE_VOID - IObject *this = (IObject *) self; - Abort_internal(this); - object_unlock_exclusive(this); + IObject *thiz = (IObject *) self; + Abort_internal(thiz); + object_unlock_exclusive(thiz); SL_LEAVE_INTERFACE_VOID } @@ -519,25 +519,25 @@ void IObject_Destroy(SLObjectItf self) { SL_ENTER_INTERFACE_VOID - IObject *this = (IObject *) self; + IObject *thiz = (IObject *) self; // mutex is unlocked - Abort_internal(this); + Abort_internal(thiz); // mutex is locked - const ClassTable *class__ = this->mClass; - PreDestroyHook preDestroy = class__->mPreDestroy; + const ClassTable *clazz = thiz->mClass; + PreDestroyHook preDestroy = clazz->mPreDestroy; // The pre-destroy hook is called with mutex locked, and should block until it is safe to // destroy. It is OK to unlock the mutex temporarily, as it long as it re-locks the mutex // before returning. if (NULL != preDestroy) { - predestroy_t okToDestroy = (*preDestroy)(this); + predestroy_t okToDestroy = (*preDestroy)(thiz); switch (okToDestroy) { case predestroy_ok: break; case predestroy_error: - SL_LOGE("Object::Destroy(%p) not allowed", this); + SL_LOGE("Object::Destroy(%p) not allowed", thiz); // fall through case predestroy_again: - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); // unfortunately Destroy doesn't return a result SL_LEAVE_INTERFACE_VOID // unreachable @@ -546,14 +546,14 @@ void IObject_Destroy(SLObjectItf self) break; } } - this->mState = SL_OBJECT_STATE_DESTROYING; - VoidHook destroy = class__->mDestroy; + thiz->mState = SL_OBJECT_STATE_DESTROYING; + VoidHook destroy = clazz->mDestroy; // const, no lock needed - IEngine *thisEngine = &this->mEngine->mEngine; - unsigned i = this->mInstanceID; + IEngine *thisEngine = &thiz->mEngine->mEngine; + unsigned i = thiz->mInstanceID; assert(MAX_INSTANCE >= i); // avoid a recursive lock on the engine when destroying the engine itself - if (thisEngine->mThis != this) { + if (thisEngine->mThis != thiz) { interface_lock_exclusive(thisEngine); } // An unpublished object has a slot reserved, but the ID hasn't been chosen yet @@ -565,28 +565,28 @@ void IObject_Destroy(SLObjectItf self) unsigned mask = 1 << i; assert(thisEngine->mInstanceMask & mask); thisEngine->mInstanceMask &= ~mask; - assert(thisEngine->mInstances[i] == this); + assert(thisEngine->mInstances[i] == thiz); thisEngine->mInstances[i] = NULL; } // avoid a recursive unlock on the engine when destroying the engine itself - if (thisEngine->mThis != this) { + if (thisEngine->mThis != thiz) { interface_unlock_exclusive(thisEngine); } // The destroy hook is called with mutex locked if (NULL != destroy) { - (*destroy)(this); + (*destroy)(thiz); } // Call the deinitializer for each currently initialized interface, // whether it is implicit, explicit, optional, or dynamically added. // The deinitializers are called in the reverse order that the // initializers were called, so that IObject_deinit is called last. - unsigned index = class__->mInterfaceCount; - const struct iid_vtable *x = &class__->mInterfaces[index]; - SLuint8 *interfaceStateP = &this->mInterfaceStates[index]; + unsigned index = clazz->mInterfaceCount; + const struct iid_vtable *x = &clazz->mInterfaces[index]; + SLuint8 *interfaceStateP = &thiz->mInterfaceStates[index]; for ( ; index > 0; --index) { --x; size_t offset = x->mOffset; - void *thisItf = (char *) this + offset; + void *thisItf = (char *) thiz + offset; SLuint32 state = *--interfaceStateP; switch (state) { case INTERFACE_UNINITIALIZED: @@ -620,7 +620,7 @@ void IObject_Destroy(SLObjectItf self) case INTERFACE_RESUMING_2: case INTERFACE_REMOVING: case INTERFACE_SUSPENDING: - SL_LOGE("Object::Destroy(%p) while interface %u active", this, index); + SL_LOGE("Object::Destroy(%p) while interface %u active", thiz, index); break; default: assert(SL_BOOLEAN_FALSE); @@ -628,12 +628,12 @@ void IObject_Destroy(SLObjectItf self) } } // The mutex is unlocked and destroyed by IObject_deinit, which is the last deinitializer - memset(this, 0x55, class__->mSize); // catch broken applications that continue using interfaces + memset(thiz, 0x55, clazz->mSize); // catch broken applications that continue using interfaces // was ifdef USE_DEBUG but safer to do this unconditionally - free(this); + free(thiz); - if (SL_OBJECTID_ENGINE == class__->mSLObjectID) { - CEngine_Destroyed((CEngine *) this); + if (SL_OBJECTID_ENGINE == clazz->mSLObjectID) { + CEngine_Destroyed((CEngine *) thiz); } SL_LEAVE_INTERFACE_VOID @@ -645,11 +645,11 @@ static SLresult IObject_SetPriority(SLObjectItf self, SLint32 priority, SLboolea SL_ENTER_INTERFACE #if USE_PROFILES & USE_PROFILES_BASE - IObject *this = (IObject *) self; - object_lock_exclusive(this); - this->mPriority = priority; - this->mPreemptable = SL_BOOLEAN_FALSE != preemptable; // normalize - object_unlock_exclusive(this); + IObject *thiz = (IObject *) self; + object_lock_exclusive(thiz); + thiz->mPriority = priority; + thiz->mPreemptable = SL_BOOLEAN_FALSE != preemptable; // normalize + object_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; #else result = SL_RESULT_FEATURE_UNSUPPORTED; @@ -667,11 +667,11 @@ static SLresult IObject_GetPriority(SLObjectItf self, SLint32 *pPriority, SLbool if (NULL == pPriority || NULL == pPreemptable) { result = SL_RESULT_PARAMETER_INVALID; } else { - IObject *this = (IObject *) self; - object_lock_shared(this); - SLint32 priority = this->mPriority; - SLboolean preemptable = this->mPreemptable; - object_unlock_shared(this); + IObject *thiz = (IObject *) self; + object_lock_shared(thiz); + SLint32 priority = thiz->mPriority; + SLboolean preemptable = thiz->mPreemptable; + object_unlock_shared(thiz); *pPriority = priority; *pPreemptable = preemptable; result = SL_RESULT_SUCCESS; @@ -696,8 +696,8 @@ static SLresult IObject_SetLossOfControlInterfaces(SLObjectItf self, if (NULL == pInterfaceIDs) { result = SL_RESULT_PARAMETER_INVALID; } else { - IObject *this = (IObject *) self; - const ClassTable *class__ = this->mClass; + IObject *thiz = (IObject *) self; + const ClassTable *clazz = thiz->mClass; unsigned lossOfControlMask = 0; // The cast is due to a typo in the spec, bug 6482 for (i = 0; i < (SLuint32) numInterfaces; ++i) { @@ -711,17 +711,17 @@ static SLresult IObject_SetLossOfControlInterfaces(SLObjectItf self, if ((0 <= (MPH = IID_to_MPH(iid))) && // no need to check for an initialization hook // (NULL == MPH_init_table[MPH].mInit) || - (0 <= (index = class__->mMPH_to_index[MPH]))) { + (0 <= (index = clazz->mMPH_to_index[MPH]))) { lossOfControlMask |= (1 << index); } } - object_lock_exclusive(this); + object_lock_exclusive(thiz); if (enabled) { - this->mLossOfControlMask |= lossOfControlMask; + thiz->mLossOfControlMask |= lossOfControlMask; } else { - this->mLossOfControlMask &= ~lossOfControlMask; + thiz->mLossOfControlMask &= ~lossOfControlMask; } - object_unlock_exclusive(this); + object_unlock_exclusive(thiz); } } out: @@ -751,33 +751,33 @@ static const struct SLObjectItf_ IObject_Itf = { void IObject_init(void *self) { - IObject *this = (IObject *) self; - this->mItf = &IObject_Itf; + IObject *thiz = (IObject *) self; + thiz->mItf = &IObject_Itf; // initialized in construct: // mClass // mInstanceID // mLossOfControlMask // mEngine // mInterfaceStates - this->mState = SL_OBJECT_STATE_UNREALIZED; - this->mGottenMask = 1; // IObject - this->mAttributesMask = 0; - this->mCallback = NULL; - this->mContext = NULL; + thiz->mState = SL_OBJECT_STATE_UNREALIZED; + thiz->mGottenMask = 1; // IObject + thiz->mAttributesMask = 0; + thiz->mCallback = NULL; + thiz->mContext = NULL; #if USE_PROFILES & USE_PROFILES_BASE - this->mPriority = SL_PRIORITY_NORMAL; - this->mPreemptable = SL_BOOLEAN_FALSE; + thiz->mPriority = SL_PRIORITY_NORMAL; + thiz->mPreemptable = SL_BOOLEAN_FALSE; #endif - this->mStrongRefCount = 0; + thiz->mStrongRefCount = 0; int ok; - ok = pthread_mutex_init(&this->mMutex, (const pthread_mutexattr_t *) NULL); + ok = pthread_mutex_init(&thiz->mMutex, (const pthread_mutexattr_t *) NULL); assert(0 == ok); #ifdef USE_DEBUG - memset(&this->mOwner, 0, sizeof(pthread_t)); - this->mFile = NULL; - this->mLine = 0; + memset(&thiz->mOwner, 0, sizeof(pthread_t)); + thiz->mFile = NULL; + thiz->mLine = 0; #endif - ok = pthread_cond_init(&this->mCond, (const pthread_condattr_t *) NULL); + ok = pthread_cond_init(&thiz->mCond, (const pthread_condattr_t *) NULL); assert(0 == ok); } @@ -786,19 +786,19 @@ void IObject_init(void *self) void IObject_deinit(void *self) { - IObject *this = (IObject *) self; + IObject *thiz = (IObject *) self; #ifdef USE_DEBUG - assert(pthread_equal(pthread_self(), this->mOwner)); + assert(pthread_equal(pthread_self(), thiz->mOwner)); #endif int ok; - ok = pthread_cond_destroy(&this->mCond); + ok = pthread_cond_destroy(&thiz->mCond); assert(0 == ok); // equivalent to object_unlock_exclusive, but without the rigmarole - ok = pthread_mutex_unlock(&this->mMutex); + ok = pthread_mutex_unlock(&thiz->mMutex); assert(0 == ok); - ok = pthread_mutex_destroy(&this->mMutex); + ok = pthread_mutex_destroy(&thiz->mMutex); assert(0 == ok); - // redundant: this->mState = SL_OBJECT_STATE_UNREALIZED; + // redundant: thiz->mState = SL_OBJECT_STATE_UNREALIZED; } @@ -807,9 +807,9 @@ void IObject_deinit(void *self) * and make it safe to return the SLObjectItf to the application. */ -void IObject_Publish(IObject *this) +void IObject_Publish(IObject *thiz) { - IEngine *thisEngine = &this->mEngine->mEngine; + IEngine *thisEngine = &thiz->mEngine->mEngine; interface_lock_exclusive(thisEngine); // construct earlier reserved a pending slot, but did not choose the actual slot number unsigned availMask = ~thisEngine->mInstanceMask; @@ -817,9 +817,9 @@ void IObject_Publish(IObject *this) unsigned i = ctz(availMask); assert(MAX_INSTANCE > i); assert(NULL == thisEngine->mInstances[i]); - thisEngine->mInstances[i] = this; + thisEngine->mInstances[i] = thiz; thisEngine->mInstanceMask |= 1 << i; // avoid zero as a valid instance ID - this->mInstanceID = i + 1; + thiz->mInstanceID = i + 1; interface_unlock_exclusive(thisEngine); } diff --git a/src/itf/IOutputMix.c b/src/itf/IOutputMix.c index 2b1c30e..99f5e46 100644 --- a/src/itf/IOutputMix.c +++ b/src/itf/IOutputMix.c @@ -49,11 +49,11 @@ static SLresult IOutputMix_RegisterDeviceChangeCallback(SLOutputMixItf self, { SL_ENTER_INTERFACE - IOutputMix *this = (IOutputMix *) self; - interface_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; - interface_unlock_exclusive(this); + IOutputMix *thiz = (IOutputMix *) self; + interface_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -90,8 +90,8 @@ static const struct SLOutputMixItf_ IOutputMix_Itf = { void IOutputMix_init(void *self) { - IOutputMix *this = (IOutputMix *) self; - this->mItf = &IOutputMix_Itf; - this->mCallback = NULL; - this->mContext = NULL; + IOutputMix *thiz = (IOutputMix *) self; + thiz->mItf = &IOutputMix_Itf; + thiz->mCallback = NULL; + thiz->mContext = NULL; } diff --git a/src/itf/IOutputMixExt.c b/src/itf/IOutputMixExt.c index 7addbc3..7a72d28 100644 --- a/src/itf/IOutputMixExt.c +++ b/src/itf/IOutputMixExt.c @@ -173,13 +173,13 @@ void IOutputMixExt_FillBuffer(SLOutputMixExtItf self, void *pBuffer, SLuint32 si // Force to be a multiple of a frame, assumes stereo 16-bit PCM size &= ~3; SLboolean mixBufferHasData = SL_BOOLEAN_FALSE; - IOutputMixExt *this = (IOutputMixExt *) self; - IObject *thisObject = this->mThis; + IOutputMixExt *thiz = (IOutputMixExt *) self; + IObject *thisObject = thiz->mThis; // This lock should never block, except when the application destroys the output mix object object_lock_exclusive(thisObject); unsigned activeMask; // If the output mix is marked for destruction, then acknowledge the request - if (this->mDestroyRequested) { + if (thiz->mDestroyRequested) { IEngine *thisEngine = &thisObject->mEngine->mEngine; interface_lock_exclusive(thisEngine); assert(&thisEngine->mOutputMix->mObject == thisObject); @@ -187,17 +187,17 @@ void IOutputMixExt_FillBuffer(SLOutputMixExtItf self, void *pBuffer, SLuint32 si // Note we don't attempt to connect another output mix, even if there is one interface_unlock_exclusive(thisEngine); // Acknowledge the destroy request, and notify the pre-destroy hook - this->mDestroyRequested = SL_BOOLEAN_FALSE; + thiz->mDestroyRequested = SL_BOOLEAN_FALSE; object_cond_broadcast(thisObject); activeMask = 0; } else { - activeMask = this->mActiveMask; + activeMask = thiz->mActiveMask; } while (activeMask) { unsigned i = ctz(activeMask); assert(MAX_TRACK > i); activeMask &= ~(1 << i); - Track *track = &this->mTracks[i]; + Track *track = &thiz->mTracks[i]; // track is allocated @@ -338,35 +338,35 @@ static const struct SLOutputMixExtItf_ IOutputMixExt_Itf = { void IOutputMixExt_init(void *self) { - IOutputMixExt *this = (IOutputMixExt *) self; - this->mItf = &IOutputMixExt_Itf; - this->mActiveMask = 0; - Track *track = &this->mTracks[0]; + IOutputMixExt *thiz = (IOutputMixExt *) self; + thiz->mItf = &IOutputMixExt_Itf; + thiz->mActiveMask = 0; + Track *track = &thiz->mTracks[0]; unsigned i; for (i = 0; i < MAX_TRACK; ++i, ++track) { track->mAudioPlayer = NULL; } - this->mDestroyRequested = SL_BOOLEAN_FALSE; + thiz->mDestroyRequested = SL_BOOLEAN_FALSE; } /** \brief Called by Engine::CreateAudioPlayer to allocate a track */ -SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *this) +SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *thiz) { - this->mTrack = NULL; + thiz->mTrack = NULL; // check the source for compatibility - switch (this->mDataSource.mLocator.mLocatorType) { + switch (thiz->mDataSource.mLocator.mLocatorType) { case SL_DATALOCATOR_BUFFERQUEUE: #ifdef ANDROID case SL_DATALOCATOR_ANDROIDSIMPLEBUFFERQUEUE: #endif - switch (this->mDataSource.mFormat.mFormatType) { + switch (thiz->mDataSource.mFormat.mFormatType) { case SL_DATAFORMAT_PCM: #ifdef USE_SDL // SDL is hard-coded to 44.1 kHz, and there is no sample rate converter - if (SL_SAMPLINGRATE_44_1 != this->mDataSource.mFormat.mPCM.samplesPerSec) + if (SL_SAMPLINGRATE_44_1 != thiz->mDataSource.mFormat.mPCM.samplesPerSec) return SL_RESULT_CONTENT_UNSUPPORTED; #endif break; @@ -379,7 +379,7 @@ SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *this) } // check the sink for compatibility - const SLDataSink *pAudioSnk = &this->mDataSink.u.mSink; + const SLDataSink *pAudioSnk = &thiz->mDataSink.u.mSink; Track *track = NULL; switch (*(SLuint32 *)pAudioSnk->pLocator) { case SL_DATALOCATOR_OUTPUTMIX: @@ -401,10 +401,10 @@ SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *this) track = &omExt->mTracks[i]; track->mAudioPlayer = NULL; // only field that is accessed before full initialization interface_unlock_exclusive(omExt); - this->mTrack = track; - this->mGains[0] = 1.0f; - this->mGains[1] = 1.0f; - this->mDestroyRequested = SL_BOOLEAN_FALSE; + thiz->mTrack = track; + thiz->mGains[0] = 1.0f; + thiz->mGains[1] = 1.0f; + thiz->mDestroyRequested = SL_BOOLEAN_FALSE; } break; default: @@ -412,8 +412,8 @@ SLresult IOutputMixExt_checkAudioPlayerSourceSink(CAudioPlayer *this) } assert(NULL != track); - track->mBufferQueue = &this->mBufferQueue; - track->mAudioPlayer = this; + track->mBufferQueue = &thiz->mBufferQueue; + track->mAudioPlayer = thiz; track->mReader = NULL; track->mAvail = 0; track->mGains[0] = 1.0f; diff --git a/src/itf/IPitch.c b/src/itf/IPitch.c index da2e9a6..8672972 100644 --- a/src/itf/IPitch.c +++ b/src/itf/IPitch.c @@ -23,14 +23,14 @@ static SLresult IPitch_SetPitch(SLPitchItf self, SLpermille pitch) { SL_ENTER_INTERFACE - IPitch *this = (IPitch *) self; + IPitch *thiz = (IPitch *) self; // const, so no lock needed - if (!(this->mMinPitch <= pitch && pitch <= this->mMaxPitch)) { + if (!(thiz->mMinPitch <= pitch && pitch <= thiz->mMaxPitch)) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_poke(this); - this->mPitch = pitch; - interface_unlock_poke(this); + interface_lock_poke(thiz); + thiz->mPitch = pitch; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -45,10 +45,10 @@ static SLresult IPitch_GetPitch(SLPitchItf self, SLpermille *pPitch) if (NULL == pPitch) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPitch *this = (IPitch *) self; - interface_lock_peek(this); - SLpermille pitch = this->mPitch; - interface_unlock_peek(this); + IPitch *thiz = (IPitch *) self; + interface_lock_peek(thiz); + SLpermille pitch = thiz->mPitch; + interface_unlock_peek(thiz); *pPitch = pitch; result = SL_RESULT_SUCCESS; } @@ -67,10 +67,10 @@ static SLresult IPitch_GetPitchCapabilities(SLPitchItf self, if (NULL == pMinPitch && NULL == pMaxPitch) result = SL_RESULT_PARAMETER_INVALID; #endif - IPitch *this = (IPitch *) self; + IPitch *thiz = (IPitch *) self; // const, so no lock needed - SLpermille minPitch = this->mMinPitch; - SLpermille maxPitch = this->mMaxPitch; + SLpermille minPitch = thiz->mMinPitch; + SLpermille maxPitch = thiz->mMaxPitch; if (NULL != pMinPitch) *pMinPitch = minPitch; if (NULL != pMaxPitch) @@ -89,10 +89,10 @@ static const struct SLPitchItf_ IPitch_Itf = { void IPitch_init(void *self) { - IPitch *this = (IPitch *) self; - this->mItf = &IPitch_Itf; - this->mPitch = 1000; + IPitch *thiz = (IPitch *) self; + thiz->mItf = &IPitch_Itf; + thiz->mPitch = 1000; // const - this->mMinPitch = -500; - this->mMaxPitch = 2000; + thiz->mMinPitch = -500; + thiz->mMaxPitch = 2000; } diff --git a/src/itf/IPlay.c b/src/itf/IPlay.c index 6dc55e7..0b8cd63 100644 --- a/src/itf/IPlay.c +++ b/src/itf/IPlay.c @@ -28,21 +28,21 @@ static SLresult IPlay_SetPlayState(SLPlayItf self, SLuint32 state) case SL_PLAYSTATE_PAUSED: case SL_PLAYSTATE_PLAYING: { - IPlay *this = (IPlay *) self; + IPlay *thiz = (IPlay *) self; unsigned attr = ATTR_NONE; result = SL_RESULT_SUCCESS; #ifdef USE_OUTPUTMIXEXT - CAudioPlayer *audioPlayer = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *audioPlayer = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; #endif - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); #ifdef USE_OUTPUTMIXEXT - for (;; interface_cond_wait(this)) { + for (;; interface_cond_wait(thiz)) { // We are comparing the old state (left) vs. new state (right). // Note that the old state is 3 bits wide, but new state is only 2 bits wide. // That is why the old state is on the left and new state is on the right. - switch ((this->mState << 2) | state) { + switch ((thiz->mState << 2) | state) { case (SL_PLAYSTATE_STOPPED << 2) | SL_PLAYSTATE_STOPPED: case (SL_PLAYSTATE_PAUSED << 2) | SL_PLAYSTATE_PAUSED: @@ -63,7 +63,7 @@ static SLresult IPlay_SetPlayState(SLPlayItf self, SLuint32 state) case (SL_PLAYSTATE_STOPPED << 2) | SL_PLAYSTATE_PAUSED: case (SL_PLAYSTATE_PLAYING << 2) | SL_PLAYSTATE_PAUSED: // easy - this->mState = state; + thiz->mState = state; break; case (SL_PLAYSTATE_STOPPING << 2) | SL_PLAYSTATE_STOPPED: @@ -78,7 +78,7 @@ static SLresult IPlay_SetPlayState(SLPlayItf self, SLuint32 state) case (SL_PLAYSTATE_PAUSED << 2) | SL_PLAYSTATE_STOPPED: case (SL_PLAYSTATE_PLAYING << 2) | SL_PLAYSTATE_STOPPED: // tell mixer to stop, then wait for mixer to acknowledge the request to stop - this->mState = SL_PLAYSTATE_STOPPING; + thiz->mState = SL_PLAYSTATE_STOPPING; continue; default: @@ -93,11 +93,11 @@ static SLresult IPlay_SetPlayState(SLPlayItf self, SLuint32 state) } #else // Here life looks easy for an Android, but there are other troubles in play land - this->mState = state; + thiz->mState = state; attr = ATTR_TRANSPORT; #endif // SL_LOGD("set play state %ld", state); - interface_unlock_exclusive_attributes(this, attr); + interface_unlock_exclusive_attributes(thiz, attr); } break; default: @@ -116,10 +116,10 @@ static SLresult IPlay_GetPlayState(SLPlayItf self, SLuint32 *pState) if (NULL == pState) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_peek(this); - SLuint32 state = this->mState; - interface_unlock_peek(this); + IPlay *thiz = (IPlay *) self; + interface_lock_peek(thiz); + SLuint32 state = thiz->mState; + interface_unlock_peek(thiz); result = SL_RESULT_SUCCESS; #ifdef USE_OUTPUTMIXEXT switch (state) { @@ -152,25 +152,25 @@ static SLresult IPlay_GetDuration(SLPlayItf self, SLmillisecond *pMsec) result = SL_RESULT_PARAMETER_INVALID; } else { result = SL_RESULT_SUCCESS; - IPlay *this = (IPlay *) self; + IPlay *thiz = (IPlay *) self; // even though this is a getter, it can modify state due to caching - interface_lock_exclusive(this); - SLmillisecond duration = this->mDuration; + interface_lock_exclusive(thiz); + SLmillisecond duration = thiz->mDuration; #ifdef ANDROID if ((SL_TIME_UNKNOWN == duration) && - (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this))) { + (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz))) { SLmillisecond temp; - result = android_audioPlayer_getDuration(this, &temp); + result = android_audioPlayer_getDuration(thiz, &temp); if (SL_RESULT_SUCCESS == result) { duration = temp; - this->mDuration = duration; + thiz->mDuration = duration; } } #else // will be set by containing AudioPlayer or MidiPlayer object at Realize, if known, // otherwise the duration will be updated each time a new maximum position is detected #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); *pMsec = duration; } @@ -185,30 +185,30 @@ static SLresult IPlay_GetPosition(SLPlayItf self, SLmillisecond *pMsec) if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; + IPlay *thiz = (IPlay *) self; SLmillisecond position; - interface_lock_shared(this); + interface_lock_shared(thiz); #ifdef ANDROID // Android does not use the mPosition field for audio players - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { - android_audioPlayer_getPosition(this, &position); + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { + android_audioPlayer_getPosition(thiz, &position); // note that we do not cache the position } else { - position = this->mPosition; + position = thiz->mPosition; } #else // on other platforms we depend on periodic updates to the current position - position = this->mPosition; + position = thiz->mPosition; // if a seek is pending, then lie about current position so the seek appears synchronous - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { - CAudioPlayer *audioPlayer = (CAudioPlayer *) this->mThis; + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { + CAudioPlayer *audioPlayer = (CAudioPlayer *) thiz->mThis; SLmillisecond pos = audioPlayer->mSeek.mPos; if (SL_TIME_UNKNOWN != pos) { position = pos; } } #endif - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pMsec = position; result = SL_RESULT_SUCCESS; } @@ -221,12 +221,12 @@ static SLresult IPlay_RegisterCallback(SLPlayItf self, slPlayCallback callback, { SL_ENTER_INTERFACE - IPlay *this = (IPlay *) self; - interface_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; + IPlay *thiz = (IPlay *) self; + interface_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; // omits _attributes b/c noone cares deeply enough about these fields to need quick notification - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -241,20 +241,20 @@ static SLresult IPlay_SetCallbackEventsMask(SLPlayItf self, SLuint32 eventFlags) SL_PLAYEVENT_HEADATNEWPOS | SL_PLAYEVENT_HEADMOVING | SL_PLAYEVENT_HEADSTALLED)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_exclusive(this); - if (this->mEventFlags != eventFlags) { + IPlay *thiz = (IPlay *) self; + interface_lock_exclusive(thiz); + if (thiz->mEventFlags != eventFlags) { #ifdef USE_OUTPUTMIXEXT // enabling the "head at new position" play event will postpone the next update event - if (!(this->mEventFlags & SL_PLAYEVENT_HEADATNEWPOS) && + if (!(thiz->mEventFlags & SL_PLAYEVENT_HEADATNEWPOS) && (eventFlags & SL_PLAYEVENT_HEADATNEWPOS)) { - this->mFramesSincePositionUpdate = 0; + thiz->mFramesSincePositionUpdate = 0; } #endif - this->mEventFlags = eventFlags; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + thiz->mEventFlags = eventFlags; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -269,10 +269,10 @@ static SLresult IPlay_GetCallbackEventsMask(SLPlayItf self, SLuint32 *pEventFlag if (NULL == pEventFlags) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_peek(this); - SLuint32 eventFlags = this->mEventFlags; - interface_unlock_peek(this); + IPlay *thiz = (IPlay *) self; + interface_lock_peek(thiz); + SLuint32 eventFlags = thiz->mEventFlags; + interface_unlock_peek(thiz); *pEventFlags = eventFlags; result = SL_RESULT_SUCCESS; } @@ -285,13 +285,13 @@ static SLresult IPlay_SetMarkerPosition(SLPlayItf self, SLmillisecond mSec) { SL_ENTER_INTERFACE - IPlay *this = (IPlay *) self; - interface_lock_exclusive(this); - if (this->mMarkerPosition != mSec) { - this->mMarkerPosition = mSec; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IPlay *thiz = (IPlay *) self; + interface_lock_exclusive(thiz); + if (thiz->mMarkerPosition != mSec) { + thiz->mMarkerPosition = mSec; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -302,15 +302,15 @@ static SLresult IPlay_ClearMarkerPosition(SLPlayItf self) { SL_ENTER_INTERFACE - IPlay *this = (IPlay *) self; - interface_lock_exclusive(this); + IPlay *thiz = (IPlay *) self; + interface_lock_exclusive(thiz); #ifdef ANDROID - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { // clearing the marker position is equivalent to setting the marker at 0 - this->mMarkerPosition = 0; + thiz->mMarkerPosition = 0; } #endif - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -324,10 +324,10 @@ static SLresult IPlay_GetMarkerPosition(SLPlayItf self, SLmillisecond *pMsec) if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_peek(this); - SLmillisecond markerPosition = this->mMarkerPosition; - interface_unlock_peek(this); + IPlay *thiz = (IPlay *) self; + interface_lock_peek(thiz); + SLmillisecond markerPosition = thiz->mMarkerPosition; + interface_unlock_peek(thiz); *pMsec = markerPosition; result = SL_RESULT_SUCCESS; } @@ -343,30 +343,30 @@ static SLresult IPlay_SetPositionUpdatePeriod(SLPlayItf self, SLmillisecond mSec if (0 == mSec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_exclusive(this); - if (this->mPositionUpdatePeriod != mSec) { - this->mPositionUpdatePeriod = mSec; + IPlay *thiz = (IPlay *) self; + interface_lock_exclusive(thiz); + if (thiz->mPositionUpdatePeriod != mSec) { + thiz->mPositionUpdatePeriod = mSec; #ifdef ANDROID - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { - // result = android_audioPlayer_useEventMask(this, this->mEventFlags); + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { + // result = android_audioPlayer_useEventMask(thiz, thiz->mEventFlags); } #endif #ifdef USE_OUTPUTMIXEXT - if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) { - CAudioPlayer *audioPlayer = (CAudioPlayer *) this->mThis; + if (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) { + CAudioPlayer *audioPlayer = (CAudioPlayer *) thiz->mThis; SLuint32 frameUpdatePeriod = ((long long) mSec * (long long) audioPlayer->mSampleRateMilliHz) / 1000000LL; if (0 == frameUpdatePeriod) frameUpdatePeriod = ~0; - this->mFrameUpdatePeriod = frameUpdatePeriod; + thiz->mFrameUpdatePeriod = frameUpdatePeriod; // setting a new update period postpones the next callback - this->mFramesSincePositionUpdate = 0; + thiz->mFramesSincePositionUpdate = 0; } #endif - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -381,10 +381,10 @@ static SLresult IPlay_GetPositionUpdatePeriod(SLPlayItf self, SLmillisecond *pMs if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlay *this = (IPlay *) self; - interface_lock_peek(this); - SLmillisecond positionUpdatePeriod = this->mPositionUpdatePeriod; - interface_unlock_peek(this); + IPlay *thiz = (IPlay *) self; + interface_lock_peek(thiz); + SLmillisecond positionUpdatePeriod = thiz->mPositionUpdatePeriod; + interface_unlock_peek(thiz); *pMsec = positionUpdatePeriod; result = SL_RESULT_SUCCESS; } @@ -410,20 +410,20 @@ static const struct SLPlayItf_ IPlay_Itf = { void IPlay_init(void *self) { - IPlay *this = (IPlay *) self; - this->mItf = &IPlay_Itf; - this->mState = SL_PLAYSTATE_STOPPED; - this->mDuration = SL_TIME_UNKNOWN; // will be set by containing player object - this->mPosition = (SLmillisecond) 0; - this->mCallback = NULL; - this->mContext = NULL; - this->mEventFlags = 0; - this->mMarkerPosition = 0; - this->mPositionUpdatePeriod = 1000; + IPlay *thiz = (IPlay *) self; + thiz->mItf = &IPlay_Itf; + thiz->mState = SL_PLAYSTATE_STOPPED; + thiz->mDuration = SL_TIME_UNKNOWN; // will be set by containing player object + thiz->mPosition = (SLmillisecond) 0; + thiz->mCallback = NULL; + thiz->mContext = NULL; + thiz->mEventFlags = 0; + thiz->mMarkerPosition = 0; + thiz->mPositionUpdatePeriod = 1000; #ifdef USE_OUTPUTMIXEXT - this->mFrameUpdatePeriod = 0; // because we don't know the sample rate yet - this->mLastSeekPosition = 0; - this->mFramesSinceLastSeek = 0; - this->mFramesSincePositionUpdate = 0; + thiz->mFrameUpdatePeriod = 0; // because we don't know the sample rate yet + thiz->mLastSeekPosition = 0; + thiz->mFramesSinceLastSeek = 0; + thiz->mFramesSincePositionUpdate = 0; #endif } diff --git a/src/itf/IPlaybackRate.c b/src/itf/IPlaybackRate.c index 6e0b7e5..264dbf4 100644 --- a/src/itf/IPlaybackRate.c +++ b/src/itf/IPlaybackRate.c @@ -23,17 +23,17 @@ static SLresult IPlaybackRate_SetRate(SLPlaybackRateItf self, SLpermille rate) { SL_ENTER_INTERFACE - IPlaybackRate *this = (IPlaybackRate *) self; + IPlaybackRate *thiz = (IPlaybackRate *) self; // const, so no lock needed - if (!(this->mMinRate <= rate && rate <= this->mMaxRate)) { + if (!(thiz->mMinRate <= rate && rate <= thiz->mMaxRate)) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_exclusive(this); - this->mRate = rate; - interface_unlock_exclusive(this); + interface_lock_exclusive(thiz); + thiz->mRate = rate; + interface_unlock_exclusive(thiz); #ifdef ANDROID - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { result = android_audioPlayer_setPlayRate(ap, rate, true); } else { @@ -55,10 +55,10 @@ static SLresult IPlaybackRate_GetRate(SLPlaybackRateItf self, SLpermille *pRate) if (NULL == pRate) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlaybackRate *this = (IPlaybackRate *) self; - interface_lock_peek(this); - SLpermille rate = this->mRate; - interface_unlock_peek(this); + IPlaybackRate *thiz = (IPlaybackRate *) self; + interface_lock_peek(thiz); + SLpermille rate = thiz->mRate; + interface_unlock_peek(thiz); *pRate = rate; result = SL_RESULT_SUCCESS; } @@ -71,12 +71,12 @@ static SLresult IPlaybackRate_SetPropertyConstraints(SLPlaybackRateItf self, SLu { SL_ENTER_INTERFACE - IPlaybackRate *this = (IPlaybackRate *) self; - this->mProperties = constraints; + IPlaybackRate *thiz = (IPlaybackRate *) self; + thiz->mProperties = constraints; #ifdef ANDROID // verify property support before storing - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { result = android_audioPlayer_setPlaybackRateBehavior(ap, constraints); } else { @@ -86,11 +86,11 @@ static SLresult IPlaybackRate_SetPropertyConstraints(SLPlaybackRateItf self, SLu #else result = SL_RESULT_SUCCESS; #endif - interface_lock_poke(this); + interface_lock_poke(thiz); if (result == SL_RESULT_SUCCESS) { - this->mProperties = constraints; + thiz->mProperties = constraints; } - interface_unlock_poke(this); + interface_unlock_poke(thiz); SL_LEAVE_INTERFACE } @@ -103,10 +103,10 @@ static SLresult IPlaybackRate_GetProperties(SLPlaybackRateItf self, SLuint32 *pP if (NULL == pProperties) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlaybackRate *this = (IPlaybackRate *) self; - interface_lock_peek(this); - SLuint32 properties = this->mProperties; - interface_unlock_peek(this); + IPlaybackRate *thiz = (IPlaybackRate *) self; + interface_lock_peek(thiz); + SLuint32 properties = thiz->mProperties; + interface_unlock_peek(thiz); *pProperties = properties; result = SL_RESULT_SUCCESS; } @@ -123,20 +123,20 @@ static SLresult IPlaybackRate_GetCapabilitiesOfRate(SLPlaybackRateItf self, if (NULL == pCapabilities) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlaybackRate *this = (IPlaybackRate *) self; + IPlaybackRate *thiz = (IPlaybackRate *) self; // const, so no lock needed - if (!(this->mMinRate <= rate && rate <= this->mMaxRate)) { + if (!(thiz->mMinRate <= rate && rate <= thiz->mMaxRate)) { result = SL_RESULT_PARAMETER_INVALID; } else { SLuint32 capabilities = 0; #ifdef ANDROID - CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(this)) ? - (CAudioPlayer *) this->mThis : NULL; + CAudioPlayer *ap = (SL_OBJECTID_AUDIOPLAYER == InterfaceToObjectID(thiz)) ? + (CAudioPlayer *) thiz->mThis : NULL; if (NULL != ap) { android_audioPlayer_getCapabilitiesOfRate(ap, &capabilities); } #else - capabilities = this->mCapabilities; + capabilities = thiz->mCapabilities; #endif *pCapabilities = capabilities; result = SL_RESULT_SUCCESS; @@ -157,13 +157,13 @@ static SLresult IPlaybackRate_GetRateRange(SLPlaybackRateItf self, SLuint8 index (0 < index)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPlaybackRate *this = (IPlaybackRate *) self; - interface_lock_shared(this); - SLpermille minRate = this->mMinRate; - SLpermille maxRate = this->mMaxRate; - SLpermille stepSize = this->mStepSize; - SLuint32 capabilities = this->mCapabilities; - interface_unlock_shared(this); + IPlaybackRate *thiz = (IPlaybackRate *) self; + interface_lock_shared(thiz); + SLpermille minRate = thiz->mMinRate; + SLpermille maxRate = thiz->mMaxRate; + SLpermille stepSize = thiz->mStepSize; + SLuint32 capabilities = thiz->mCapabilities; + interface_unlock_shared(thiz); *pMinRate = minRate; *pMaxRate = maxRate; *pStepSize = stepSize; @@ -186,20 +186,20 @@ static const struct SLPlaybackRateItf_ IPlaybackRate_Itf = { void IPlaybackRate_init(void *self) { - IPlaybackRate *this = (IPlaybackRate *) self; - this->mItf = &IPlaybackRate_Itf; - this->mProperties = SL_RATEPROP_NOPITCHCORAUDIO; - this->mRate = 1000; + IPlaybackRate *thiz = (IPlaybackRate *) self; + thiz->mItf = &IPlaybackRate_Itf; + thiz->mProperties = SL_RATEPROP_NOPITCHCORAUDIO; + thiz->mRate = 1000; // const - this->mMinRate = 500; - this->mMaxRate = 2000; - this->mStepSize = 0; + thiz->mMinRate = 500; + thiz->mMaxRate = 2000; + thiz->mStepSize = 0; #ifdef ANDROID // for an AudioPlayer, mCapabilities will be initialized in sles_to_android_audioPlayerCreate #endif // The generic implementation sets no capabilities because the generic // implementation alone doesn't support any. - this->mCapabilities = 0; + thiz->mCapabilities = 0; // SL_RATEPROP_SILENTAUDIO | SL_RATEPROP_STAGGEREDAUDIO | SL_RATEPROP_NOPITCHCORAUDIO | // SL_RATEPROP_PITCHCORAUDIO } diff --git a/src/itf/IPrefetchStatus.c b/src/itf/IPrefetchStatus.c index 64257be..6718c8c 100644 --- a/src/itf/IPrefetchStatus.c +++ b/src/itf/IPrefetchStatus.c @@ -26,10 +26,10 @@ static SLresult IPrefetchStatus_GetPrefetchStatus(SLPrefetchStatusItf self, SLui if (NULL == pStatus) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_peek(this); - SLuint32 status = this->mStatus; - interface_unlock_peek(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_peek(thiz); + SLuint32 status = thiz->mStatus; + interface_unlock_peek(thiz); *pStatus = status; result = SL_RESULT_SUCCESS; } @@ -45,10 +45,10 @@ static SLresult IPrefetchStatus_GetFillLevel(SLPrefetchStatusItf self, SLpermill if (NULL == pLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_peek(this); - SLpermille level = this->mLevel; - interface_unlock_peek(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_peek(thiz); + SLpermille level = thiz->mLevel; + interface_unlock_peek(thiz); *pLevel = level; result = SL_RESULT_SUCCESS; } @@ -62,11 +62,11 @@ static SLresult IPrefetchStatus_RegisterCallback(SLPrefetchStatusItf self, { SL_ENTER_INTERFACE - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; - interface_unlock_exclusive(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -77,10 +77,10 @@ static SLresult IPrefetchStatus_SetCallbackEventsMask(SLPrefetchStatusItf self, { SL_ENTER_INTERFACE - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_poke(this); - this->mCallbackEventsMask = eventFlags; - interface_unlock_poke(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_poke(thiz); + thiz->mCallbackEventsMask = eventFlags; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -95,10 +95,10 @@ static SLresult IPrefetchStatus_GetCallbackEventsMask(SLPrefetchStatusItf self, if (NULL == pEventFlags) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_peek(this); - SLuint32 callbackEventsMask = this->mCallbackEventsMask; - interface_unlock_peek(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_peek(thiz); + SLuint32 callbackEventsMask = thiz->mCallbackEventsMask; + interface_unlock_peek(thiz); *pEventFlags = callbackEventsMask; result = SL_RESULT_SUCCESS; } @@ -114,10 +114,10 @@ static SLresult IPrefetchStatus_SetFillUpdatePeriod(SLPrefetchStatusItf self, SL if (0 == period) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_poke(this); - this->mFillUpdatePeriod = period; - interface_unlock_poke(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_poke(thiz); + thiz->mFillUpdatePeriod = period; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -132,10 +132,10 @@ static SLresult IPrefetchStatus_GetFillUpdatePeriod(SLPrefetchStatusItf self, SL if (NULL == pPeriod) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPrefetchStatus *this = (IPrefetchStatus *) self; - interface_lock_peek(this); - SLpermille fillUpdatePeriod = this->mFillUpdatePeriod; - interface_unlock_peek(this); + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + interface_lock_peek(thiz); + SLpermille fillUpdatePeriod = thiz->mFillUpdatePeriod; + interface_unlock_peek(thiz); *pPeriod = fillUpdatePeriod; result = SL_RESULT_SUCCESS; } @@ -156,12 +156,12 @@ static const struct SLPrefetchStatusItf_ IPrefetchStatus_Itf = { void IPrefetchStatus_init(void *self) { - IPrefetchStatus *this = (IPrefetchStatus *) self; - this->mItf = &IPrefetchStatus_Itf; - this->mStatus = SL_PREFETCHSTATUS_UNDERFLOW; - this->mLevel = 0; - this->mCallback = NULL; - this->mContext = NULL; - this->mCallbackEventsMask = 0; - this->mFillUpdatePeriod = 100; + IPrefetchStatus *thiz = (IPrefetchStatus *) self; + thiz->mItf = &IPrefetchStatus_Itf; + thiz->mStatus = SL_PREFETCHSTATUS_UNDERFLOW; + thiz->mLevel = 0; + thiz->mCallback = NULL; + thiz->mContext = NULL; + thiz->mCallbackEventsMask = 0; + thiz->mFillUpdatePeriod = 100; } diff --git a/src/itf/IPresetReverb.c b/src/itf/IPresetReverb.c index 81323c7..540d892 100644 --- a/src/itf/IPresetReverb.c +++ b/src/itf/IPresetReverb.c @@ -31,7 +31,7 @@ static SLresult IPresetReverb_SetPreset(SLPresetReverbItf self, SLuint16 preset) { SL_ENTER_INTERFACE - IPresetReverb *this = (IPresetReverb *) self; + IPresetReverb *thiz = (IPresetReverb *) self; switch (preset) { case SL_REVERBPRESET_NONE: case SL_REVERBPRESET_SMALLROOM: @@ -40,19 +40,19 @@ static SLresult IPresetReverb_SetPreset(SLPresetReverbItf self, SLuint16 preset) case SL_REVERBPRESET_MEDIUMHALL: case SL_REVERBPRESET_LARGEHALL: case SL_REVERBPRESET_PLATE: - interface_lock_poke(this); - this->mPreset = preset; + interface_lock_poke(thiz); + thiz->mPreset = preset; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_PRESETREVERB(this)) { + if (NO_PRESETREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_prev_setPreset(this->mPresetReverbEffect, preset); + android::status_t status = android_prev_setPreset(thiz->mPresetReverbEffect, preset); result = android_fx_statusToResult(status); } #endif - interface_unlock_poke(this); + interface_unlock_poke(thiz); break; default: result = SL_RESULT_PARAMETER_INVALID; @@ -69,21 +69,21 @@ static SLresult IPresetReverb_GetPreset(SLPresetReverbItf self, SLuint16 *pPrese if (NULL == pPreset) { result = SL_RESULT_PARAMETER_INVALID; } else { - IPresetReverb *this = (IPresetReverb *) self; - interface_lock_peek(this); + IPresetReverb *thiz = (IPresetReverb *) self; + interface_lock_peek(thiz); SLuint16 preset = SL_REVERBPRESET_NONE; #if !defined(ANDROID) - preset = this->mPreset; + preset = thiz->mPreset; result = SL_RESULT_SUCCESS; #else - if (NO_PRESETREVERB(this)) { + if (NO_PRESETREVERB(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_prev_getPreset(this->mPresetReverbEffect, &preset); + android::status_t status = android_prev_getPreset(thiz->mPresetReverbEffect, &preset); result = android_fx_statusToResult(status); } #endif - interface_unlock_peek(this); + interface_unlock_peek(thiz); *pPreset = preset; } @@ -97,30 +97,30 @@ static const struct SLPresetReverbItf_ IPresetReverb_Itf = { void IPresetReverb_init(void *self) { - IPresetReverb *this = (IPresetReverb *) self; - this->mItf = &IPresetReverb_Itf; - this->mPreset = SL_REVERBPRESET_NONE; + IPresetReverb *thiz = (IPresetReverb *) self; + thiz->mItf = &IPresetReverb_Itf; + thiz->mPreset = SL_REVERBPRESET_NONE; #if defined(ANDROID) - memset(&this->mPresetReverbDescriptor, 0, sizeof(effect_descriptor_t)); + memset(&thiz->mPresetReverbDescriptor, 0, sizeof(effect_descriptor_t)); // placement new (explicit constructor) - (void) new (&this->mPresetReverbEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mPresetReverbEffect) android::sp<android::AudioEffect>(); #endif } void IPresetReverb_deinit(void *self) { #if defined(ANDROID) - IPresetReverb *this = (IPresetReverb *) self; + IPresetReverb *thiz = (IPresetReverb *) self; // explicit destructor - this->mPresetReverbEffect.~sp(); + thiz->mPresetReverbEffect.~sp(); #endif } bool IPresetReverb_Expose(void *self) { #if defined(ANDROID) - IPresetReverb *this = (IPresetReverb *) self; - if (!android_fx_initEffectDescriptor(SL_IID_PRESETREVERB, &this->mPresetReverbDescriptor)) { + IPresetReverb *thiz = (IPresetReverb *) self; + if (!android_fx_initEffectDescriptor(SL_IID_PRESETREVERB, &thiz->mPresetReverbDescriptor)) { SL_LOGE("PresetReverb initialization failed."); return false; } diff --git a/src/itf/IRatePitch.c b/src/itf/IRatePitch.c index a34d2b4..f83b5b4 100644 --- a/src/itf/IRatePitch.c +++ b/src/itf/IRatePitch.c @@ -23,13 +23,13 @@ static SLresult IRatePitch_SetRate(SLRatePitchItf self, SLpermille rate) { SL_ENTER_INTERFACE - IRatePitch *this = (IRatePitch *) self; - if (!(this->mMinRate <= rate && rate <= this->mMaxRate)) { + IRatePitch *thiz = (IRatePitch *) self; + if (!(thiz->mMinRate <= rate && rate <= thiz->mMaxRate)) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_poke(this); - this->mRate = rate; - interface_unlock_poke(this); + interface_lock_poke(thiz); + thiz->mRate = rate; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -44,10 +44,10 @@ static SLresult IRatePitch_GetRate(SLRatePitchItf self, SLpermille *pRate) if (NULL == pRate) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRatePitch *this = (IRatePitch *) self; - interface_lock_peek(this); - SLpermille rate = this->mRate; - interface_unlock_peek(this); + IRatePitch *thiz = (IRatePitch *) self; + interface_lock_peek(thiz); + SLpermille rate = thiz->mRate; + interface_unlock_peek(thiz); *pRate = rate; result = SL_RESULT_SUCCESS; } @@ -66,10 +66,10 @@ static SLresult IRatePitch_GetRatePitchCapabilities(SLRatePitchItf self, if (NULL == pMinRate && NULL == pMaxRate) result = SL_RESULT_PARAMETER_INVALID; #endif - IRatePitch *this = (IRatePitch *) self; + IRatePitch *thiz = (IRatePitch *) self; // const, so no lock required - SLpermille minRate = this->mMinRate; - SLpermille maxRate = this->mMaxRate; + SLpermille minRate = thiz->mMinRate; + SLpermille maxRate = thiz->mMaxRate; if (NULL != pMinRate) *pMinRate = minRate; if (NULL != pMaxRate) @@ -88,10 +88,10 @@ static const struct SLRatePitchItf_ IRatePitch_Itf = { void IRatePitch_init(void *self) { - IRatePitch *this = (IRatePitch *) self; - this->mItf = &IRatePitch_Itf; - this->mRate = 1000; + IRatePitch *thiz = (IRatePitch *) self; + thiz->mItf = &IRatePitch_Itf; + thiz->mRate = 1000; // const - this->mMinRate = 500; - this->mMaxRate = 2000; + thiz->mMinRate = 500; + thiz->mMaxRate = 2000; } diff --git a/src/itf/IRecord.c b/src/itf/IRecord.c index e48cb61..79233f6 100644 --- a/src/itf/IRecord.c +++ b/src/itf/IRecord.c @@ -28,13 +28,13 @@ static SLresult IRecord_SetRecordState(SLRecordItf self, SLuint32 state) case SL_RECORDSTATE_PAUSED: case SL_RECORDSTATE_RECORDING: { - IRecord *this = (IRecord *) self; - interface_lock_poke(this); - this->mState = state; + IRecord *thiz = (IRecord *) self; + interface_lock_poke(thiz); + thiz->mState = state; #ifdef ANDROID - android_audioRecorder_setRecordState(InterfaceToCAudioRecorder(this), state); + android_audioRecorder_setRecordState(InterfaceToCAudioRecorder(thiz), state); #endif - interface_unlock_poke(this); + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } break; @@ -51,13 +51,13 @@ static SLresult IRecord_GetRecordState(SLRecordItf self, SLuint32 *pState) { SL_ENTER_INTERFACE - IRecord *this = (IRecord *) self; + IRecord *thiz = (IRecord *) self; if (NULL == pState) { result = SL_RESULT_PARAMETER_INVALID; } else { - interface_lock_peek(this); - SLuint32 state = this->mState; - interface_unlock_peek(this); + interface_lock_peek(thiz); + SLuint32 state = thiz->mState; + interface_unlock_peek(thiz); *pState = state; result = SL_RESULT_SUCCESS; } @@ -70,13 +70,13 @@ static SLresult IRecord_SetDurationLimit(SLRecordItf self, SLmillisecond msec) { SL_ENTER_INTERFACE - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - if (this->mDurationLimit != msec) { - this->mDurationLimit = msec; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + if (thiz->mDurationLimit != msec) { + thiz->mDurationLimit = msec; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; @@ -91,20 +91,20 @@ static SLresult IRecord_GetPosition(SLRecordItf self, SLmillisecond *pMsec) if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; + IRecord *thiz = (IRecord *) self; SLmillisecond position; - interface_lock_shared(this); + interface_lock_shared(thiz); #ifdef ANDROID // Android does not use the mPosition field for audio recorders - if (SL_OBJECTID_AUDIORECORDER == InterfaceToObjectID(this)) { - android_audioRecorder_getPosition(InterfaceToCAudioRecorder(this), &position); + if (SL_OBJECTID_AUDIORECORDER == InterfaceToObjectID(thiz)) { + android_audioRecorder_getPosition(InterfaceToCAudioRecorder(thiz), &position); } else { - position = this->mPosition; + position = thiz->mPosition; } #else - position = this->mPosition; + position = thiz->mPosition; #endif - interface_unlock_shared(this); + interface_unlock_shared(thiz); *pMsec = position; result = SL_RESULT_SUCCESS; } @@ -118,11 +118,11 @@ static SLresult IRecord_RegisterCallback(SLRecordItf self, slRecordCallback call { SL_ENTER_INTERFACE - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; - interface_unlock_exclusive(this); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -142,13 +142,13 @@ static SLresult IRecord_SetCallbackEventsMask(SLRecordItf self, SLuint32 eventFl SL_RECORDEVENT_BUFFER_FULL)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - if (this->mCallbackEventsMask != eventFlags) { - this->mCallbackEventsMask = eventFlags; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + if (thiz->mCallbackEventsMask != eventFlags) { + thiz->mCallbackEventsMask = eventFlags; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; } @@ -164,10 +164,10 @@ static SLresult IRecord_GetCallbackEventsMask(SLRecordItf self, SLuint32 *pEvent if (NULL == pEventFlags) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; - interface_lock_peek(this); - SLuint32 callbackEventsMask = this->mCallbackEventsMask; - interface_unlock_peek(this); + IRecord *thiz = (IRecord *) self; + interface_lock_peek(thiz); + SLuint32 callbackEventsMask = thiz->mCallbackEventsMask; + interface_unlock_peek(thiz); *pEventFlags = callbackEventsMask; result = SL_RESULT_SUCCESS; } @@ -180,13 +180,13 @@ static SLresult IRecord_SetMarkerPosition(SLRecordItf self, SLmillisecond mSec) { SL_ENTER_INTERFACE - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - if (this->mMarkerPosition != mSec) { - this->mMarkerPosition = mSec; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + if (thiz->mMarkerPosition != mSec) { + thiz->mMarkerPosition = mSec; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; @@ -198,13 +198,13 @@ static SLresult IRecord_ClearMarkerPosition(SLRecordItf self) { SL_ENTER_INTERFACE - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - if (this->mMarkerPosition != 0) { - this->mMarkerPosition = 0; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + if (thiz->mMarkerPosition != 0) { + thiz->mMarkerPosition = 0; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; @@ -219,10 +219,10 @@ static SLresult IRecord_GetMarkerPosition(SLRecordItf self, SLmillisecond *pMsec if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; - interface_lock_peek(this); - SLmillisecond markerPosition = this->mMarkerPosition; - interface_unlock_peek(this); + IRecord *thiz = (IRecord *) self; + interface_lock_peek(thiz); + SLmillisecond markerPosition = thiz->mMarkerPosition; + interface_unlock_peek(thiz); *pMsec = markerPosition; result = SL_RESULT_SUCCESS; } @@ -238,13 +238,13 @@ static SLresult IRecord_SetPositionUpdatePeriod(SLRecordItf self, SLmillisecond if (0 == mSec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; - interface_lock_exclusive(this); - if (this->mPositionUpdatePeriod != mSec) { - this->mPositionUpdatePeriod = mSec; - interface_unlock_exclusive_attributes(this, ATTR_TRANSPORT); + IRecord *thiz = (IRecord *) self; + interface_lock_exclusive(thiz); + if (thiz->mPositionUpdatePeriod != mSec) { + thiz->mPositionUpdatePeriod = mSec; + interface_unlock_exclusive_attributes(thiz, ATTR_TRANSPORT); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; } @@ -260,10 +260,10 @@ static SLresult IRecord_GetPositionUpdatePeriod(SLRecordItf self, SLmillisecond if (NULL == pMsec) { result = SL_RESULT_PARAMETER_INVALID; } else { - IRecord *this = (IRecord *) self; - interface_lock_peek(this); - SLmillisecond positionUpdatePeriod = this->mPositionUpdatePeriod; - interface_unlock_peek(this); + IRecord *thiz = (IRecord *) self; + interface_lock_peek(thiz); + SLmillisecond positionUpdatePeriod = thiz->mPositionUpdatePeriod; + interface_unlock_peek(thiz); *pMsec = positionUpdatePeriod; result = SL_RESULT_SUCCESS; } @@ -289,14 +289,14 @@ static const struct SLRecordItf_ IRecord_Itf = { void IRecord_init(void *self) { - IRecord *this = (IRecord *) self; - this->mItf = &IRecord_Itf; - this->mState = SL_RECORDSTATE_STOPPED; - this->mDurationLimit = 0; - this->mPosition = 0; - this->mCallback = NULL; - this->mContext = NULL; - this->mCallbackEventsMask = 0; - this->mMarkerPosition = 0; - this->mPositionUpdatePeriod = 1000; + IRecord *thiz = (IRecord *) self; + thiz->mItf = &IRecord_Itf; + thiz->mState = SL_RECORDSTATE_STOPPED; + thiz->mDurationLimit = 0; + thiz->mPosition = 0; + thiz->mCallback = NULL; + thiz->mContext = NULL; + thiz->mCallbackEventsMask = 0; + thiz->mMarkerPosition = 0; + thiz->mPositionUpdatePeriod = 1000; } diff --git a/src/itf/ISeek.c b/src/itf/ISeek.c index 2195bba..ac5b35b 100644 --- a/src/itf/ISeek.c +++ b/src/itf/ISeek.c @@ -31,11 +31,11 @@ static SLresult ISeek_SetPosition(SLSeekItf self, SLmillisecond pos, SLuint32 se if (SL_TIME_UNKNOWN == pos) { pos = SL_TIME_UNKNOWN - 1; } - ISeek *this = (ISeek *) self; - interface_lock_exclusive(this); - this->mPos = pos; + ISeek *thiz = (ISeek *) self; + interface_lock_exclusive(thiz); + thiz->mPos = pos; // at this point the seek is merely pending, so do not yet update other fields - interface_unlock_exclusive_attributes(this, ATTR_POSITION); + interface_unlock_exclusive_attributes(thiz, ATTR_POSITION); result = SL_RESULT_SUCCESS; } break; @@ -56,29 +56,29 @@ static SLresult ISeek_SetLoop(SLSeekItf self, SLboolean loopEnable, if (!(startPos < endPos)) { result = SL_RESULT_PARAMETER_INVALID; } else { - ISeek *this = (ISeek *) self; - interface_lock_exclusive(this); + ISeek *thiz = (ISeek *) self; + interface_lock_exclusive(thiz); #ifdef ANDROID if ((startPos != 0) && (endPos != SL_TIME_UNKNOWN)) { result = SL_RESULT_FEATURE_UNSUPPORTED; } else { - this->mLoopEnabled = SL_BOOLEAN_FALSE != loopEnable; // normalize + thiz->mLoopEnabled = SL_BOOLEAN_FALSE != loopEnable; // normalize // start and end positions already initialized to [0, end of stream] - /*this->mStartPos = 0; - this->mEndPos = (SLmillisecond) SL_TIME_UNKNOWN;*/ - CAudioPlayer *ap = InterfaceToCAudioPlayer(this); + /*thiz->mStartPos = 0; + thiz->mEndPos = (SLmillisecond) SL_TIME_UNKNOWN;*/ + CAudioPlayer *ap = InterfaceToCAudioPlayer(thiz); if (NULL != ap) { android_audioPlayer_loop(ap, loopEnable); } result = SL_RESULT_SUCCESS; } #else - this->mLoopEnabled = SL_BOOLEAN_FALSE != loopEnable; // normalize - this->mStartPos = startPos; - this->mEndPos = endPos; + thiz->mLoopEnabled = SL_BOOLEAN_FALSE != loopEnable; // normalize + thiz->mStartPos = startPos; + thiz->mEndPos = endPos; result = SL_RESULT_SUCCESS; #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -93,12 +93,12 @@ static SLresult ISeek_GetLoop(SLSeekItf self, SLboolean *pLoopEnabled, if (NULL == pLoopEnabled || NULL == pStartPos || NULL == pEndPos) { result = SL_RESULT_PARAMETER_INVALID; } else { - ISeek *this = (ISeek *) self; - interface_lock_shared(this); - SLboolean loopEnabled = this->mLoopEnabled; - SLmillisecond startPos = this->mStartPos; - SLmillisecond endPos = this->mEndPos; - interface_unlock_shared(this); + ISeek *thiz = (ISeek *) self; + interface_lock_shared(thiz); + SLboolean loopEnabled = thiz->mLoopEnabled; + SLmillisecond startPos = thiz->mStartPos; + SLmillisecond endPos = thiz->mEndPos; + interface_unlock_shared(thiz); *pLoopEnabled = loopEnabled; *pStartPos = startPos; *pEndPos = endPos; @@ -117,10 +117,10 @@ static const struct SLSeekItf_ ISeek_Itf = { void ISeek_init(void *self) { - ISeek *this = (ISeek *) self; - this->mItf = &ISeek_Itf; - this->mPos = (SLmillisecond) SL_TIME_UNKNOWN; - this->mStartPos = (SLmillisecond) 0; - this->mEndPos = (SLmillisecond) SL_TIME_UNKNOWN; - this->mLoopEnabled = SL_BOOLEAN_FALSE; + ISeek *thiz = (ISeek *) self; + thiz->mItf = &ISeek_Itf; + thiz->mPos = (SLmillisecond) SL_TIME_UNKNOWN; + thiz->mStartPos = (SLmillisecond) 0; + thiz->mEndPos = (SLmillisecond) SL_TIME_UNKNOWN; + thiz->mLoopEnabled = SL_BOOLEAN_FALSE; } diff --git a/src/itf/IStreamInformation.c b/src/itf/IStreamInformation.c index 7cf8b6f..a983caa 100644 --- a/src/itf/IStreamInformation.c +++ b/src/itf/IStreamInformation.c @@ -24,10 +24,10 @@ static XAresult IStreamInformation_QueryMediaContainerInformation( XAStreamInfor XA_ENTER_INTERFACE #ifdef ANDROID - IStreamInformation *this = (IStreamInformation *) self; - interface_lock_exclusive(this); - info = (XAMediaContainerInformation*)&(this->mStreamInfoTable.itemAt(0).containerInfo); - interface_unlock_exclusive(this); + IStreamInformation *thiz = (IStreamInformation *) self; + interface_lock_exclusive(thiz); + info = (XAMediaContainerInformation*)&(thiz->mStreamInfoTable.itemAt(0).containerInfo); + interface_unlock_exclusive(thiz); // even though the pointer to the media container info is returned, the values aren't set // for the actual container in this version, they are simply initialized to defaults // (see IStreamInformation_init) @@ -60,20 +60,20 @@ static XAresult IStreamInformation_QueryStreamType( XAStreamInformationItf self, // stream 0 is reserved for the container result = XA_RESULT_PARAMETER_INVALID; } else { - IStreamInformation *this = (IStreamInformation *) self; + IStreamInformation *thiz = (IStreamInformation *) self; - interface_lock_exclusive(this); - XAuint32 nbStreams = this->mStreamInfoTable.itemAt(0).containerInfo.numStreams; + interface_lock_exclusive(thiz); + XAuint32 nbStreams = thiz->mStreamInfoTable.itemAt(0).containerInfo.numStreams; // streams in the container are numbered 1..nbStreams if (streamIndex <= nbStreams) { result = XA_RESULT_SUCCESS; - *domain = this->mStreamInfoTable.itemAt(streamIndex).domain; + *domain = thiz->mStreamInfoTable.itemAt(streamIndex).domain; } else { SL_LOGE("Querying stream type for stream %ld, only %ld streams available", streamIndex, nbStreams); result = XA_RESULT_PARAMETER_INVALID; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } #endif @@ -114,14 +114,14 @@ static XAresult IStreamInformation_RegisterStreamChangeCallback( XAStreamInforma { XA_ENTER_INTERFACE - IStreamInformation *this = (IStreamInformation *) self; + IStreamInformation *thiz = (IStreamInformation *) self; - interface_lock_exclusive(this); + interface_lock_exclusive(thiz); - this->mCallback = callback; - this->mContext = pContext; + thiz->mCallback = callback; + thiz->mContext = pContext; - switch (InterfaceToObjectID(this)) { + switch (InterfaceToObjectID(thiz)) { case XA_OBJECTID_MEDIAPLAYER: SL_LOGI("IStreamInformation_RegisterStreamChangeCallback()"); @@ -132,7 +132,7 @@ static XAresult IStreamInformation_RegisterStreamChangeCallback( XAStreamInforma break; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); XA_LEAVE_INTERFACE } @@ -184,11 +184,11 @@ static const struct XAStreamInformationItf_ IStreamInformation_Itf = { void IStreamInformation_init(void *self) { - IStreamInformation *this = (IStreamInformation *) self; - this->mItf = &IStreamInformation_Itf; + IStreamInformation *thiz = (IStreamInformation *) self; + thiz->mItf = &IStreamInformation_Itf; - this->mCallback = NULL; - this->mContext = NULL; + thiz->mCallback = NULL; + thiz->mContext = NULL; #ifdef ANDROID // initialize container info @@ -197,6 +197,6 @@ void IStreamInformation_init(void *self) contInf.containerInfo.containerType = XA_CONTAINERTYPE_UNSPECIFIED; contInf.containerInfo.mediaDuration = XA_TIME_UNKNOWN; contInf.containerInfo.numStreams = 0; - this->mStreamInfoTable.add(contInf); + thiz->mStreamInfoTable.add(contInf); #endif } diff --git a/src/itf/IThreadSync.c b/src/itf/IThreadSync.c index 937e4c6..09d52df 100644 --- a/src/itf/IThreadSync.c +++ b/src/itf/IThreadSync.c @@ -23,25 +23,25 @@ static SLresult IThreadSync_EnterCriticalSection(SLThreadSyncItf self) { SL_ENTER_INTERFACE - IThreadSync *this = (IThreadSync *) self; - interface_lock_exclusive(this); + IThreadSync *thiz = (IThreadSync *) self; + interface_lock_exclusive(thiz); for (;;) { - if (this->mInCriticalSection) { - if (!pthread_equal(this->mOwner, pthread_self())) { - ++this->mWaiting; - interface_cond_wait(this); + if (thiz->mInCriticalSection) { + if (!pthread_equal(thiz->mOwner, pthread_self())) { + ++thiz->mWaiting; + interface_cond_wait(thiz); continue; } // nested locks are not allowed result = SL_RESULT_PRECONDITIONS_VIOLATED; break; } - this->mInCriticalSection = SL_BOOLEAN_TRUE; - this->mOwner = pthread_self(); + thiz->mInCriticalSection = SL_BOOLEAN_TRUE; + thiz->mOwner = pthread_self(); result = SL_RESULT_SUCCESS; break; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -51,20 +51,20 @@ static SLresult IThreadSync_ExitCriticalSection(SLThreadSyncItf self) { SL_ENTER_INTERFACE - IThreadSync *this = (IThreadSync *) self; - interface_lock_exclusive(this); - if (!this->mInCriticalSection || !pthread_equal(this->mOwner, pthread_self())) { + IThreadSync *thiz = (IThreadSync *) self; + interface_lock_exclusive(thiz); + if (!thiz->mInCriticalSection || !pthread_equal(thiz->mOwner, pthread_self())) { result = SL_RESULT_PRECONDITIONS_VIOLATED; } else { - this->mInCriticalSection = SL_BOOLEAN_FALSE; - memset(&this->mOwner, 0, sizeof(pthread_t)); - if (this->mWaiting) { - --this->mWaiting; - interface_cond_signal(this); + thiz->mInCriticalSection = SL_BOOLEAN_FALSE; + memset(&thiz->mOwner, 0, sizeof(pthread_t)); + if (thiz->mWaiting) { + --thiz->mWaiting; + interface_cond_signal(thiz); } result = SL_RESULT_SUCCESS; } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE } @@ -77,17 +77,17 @@ static const struct SLThreadSyncItf_ IThreadSync_Itf = { void IThreadSync_init(void *self) { - IThreadSync *this = (IThreadSync *) self; - this->mItf = &IThreadSync_Itf; - this->mInCriticalSection = SL_BOOLEAN_FALSE; - this->mWaiting = 0; - memset(&this->mOwner, 0, sizeof(pthread_t)); + IThreadSync *thiz = (IThreadSync *) self; + thiz->mItf = &IThreadSync_Itf; + thiz->mInCriticalSection = SL_BOOLEAN_FALSE; + thiz->mWaiting = 0; + memset(&thiz->mOwner, 0, sizeof(pthread_t)); } void IThreadSync_deinit(void *self) { - IThreadSync *this = (IThreadSync *) self; - if (this->mInCriticalSection) { + IThreadSync *thiz = (IThreadSync *) self; + if (thiz->mInCriticalSection) { SL_LOGW("ThreadSync::EnterCriticalSection was active at Engine::Destroy"); } } diff --git a/src/itf/IVibra.c b/src/itf/IVibra.c index cb84491..67b1016 100644 --- a/src/itf/IVibra.c +++ b/src/itf/IVibra.c @@ -23,10 +23,10 @@ static SLresult IVibra_Vibrate(SLVibraItf self, SLboolean vibrate) { SL_ENTER_INTERFACE - IVibra *this = (IVibra *) self; - interface_lock_poke(this); - this->mVibrate = SL_BOOLEAN_FALSE != vibrate; // normalize - interface_unlock_poke(this); + IVibra *thiz = (IVibra *) self; + interface_lock_poke(thiz); + thiz->mVibrate = SL_BOOLEAN_FALSE != vibrate; // normalize + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -40,10 +40,10 @@ static SLresult IVibra_IsVibrating(SLVibraItf self, SLboolean *pVibrating) if (NULL == pVibrating) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVibra *this = (IVibra *) self; - interface_lock_peek(this); - SLboolean vibrate = this->mVibrate; - interface_unlock_peek(this); + IVibra *thiz = (IVibra *) self; + interface_lock_peek(thiz); + SLboolean vibrate = thiz->mVibrate; + interface_unlock_peek(thiz); *pVibrating = vibrate; result = SL_RESULT_SUCCESS; } @@ -62,10 +62,10 @@ static SLresult IVibra_SetFrequency(SLVibraItf self, SLmilliHertz frequency) } else if (!(d->minFrequency <= frequency && frequency <= d->maxFrequency)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVibra *this = (IVibra *) self; - interface_lock_poke(this); - this->mFrequency = frequency; - interface_unlock_poke(this); + IVibra *thiz = (IVibra *) self; + interface_lock_poke(thiz); + thiz->mFrequency = frequency; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -80,10 +80,10 @@ static SLresult IVibra_GetFrequency(SLVibraItf self, SLmilliHertz *pFrequency) if (NULL == pFrequency) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVibra *this = (IVibra *) self; - interface_lock_peek(this); - SLmilliHertz frequency = this->mFrequency; - interface_unlock_peek(this); + IVibra *thiz = (IVibra *) self; + interface_lock_peek(thiz); + SLmilliHertz frequency = thiz->mFrequency; + interface_unlock_peek(thiz); *pFrequency = frequency; result = SL_RESULT_SUCCESS; } @@ -102,10 +102,10 @@ static SLresult IVibra_SetIntensity(SLVibraItf self, SLpermille intensity) } else if (!(0 <= intensity && intensity <= 1000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVibra *this = (IVibra *) self; - interface_lock_poke(this); - this->mIntensity = intensity; - interface_unlock_poke(this); + IVibra *thiz = (IVibra *) self; + interface_lock_poke(thiz); + thiz->mIntensity = intensity; + interface_unlock_poke(thiz); result = SL_RESULT_SUCCESS; } @@ -124,10 +124,10 @@ static SLresult IVibra_GetIntensity(SLVibraItf self, SLpermille *pIntensity) if (!d->supportsIntensity) { result = SL_RESULT_PRECONDITIONS_VIOLATED; } else { - IVibra *this = (IVibra *) self; - interface_lock_peek(this); - SLpermille intensity = this->mIntensity; - interface_unlock_peek(this); + IVibra *thiz = (IVibra *) self; + interface_lock_peek(thiz); + SLpermille intensity = thiz->mIntensity; + interface_unlock_peek(thiz); *pIntensity = intensity; result = SL_RESULT_SUCCESS; } @@ -148,10 +148,10 @@ static const struct SLVibraItf_ IVibra_Itf = { void IVibra_init(void *self) { - IVibra *this = (IVibra *) self; - this->mItf = &IVibra_Itf; - this->mVibrate = SL_BOOLEAN_FALSE; + IVibra *thiz = (IVibra *) self; + thiz->mItf = &IVibra_Itf; + thiz->mVibrate = SL_BOOLEAN_FALSE; // next 2 values are undefined per spec - this->mFrequency = Vibra_id_descriptors[0].descriptor->minFrequency; - this->mIntensity = 1000; + thiz->mFrequency = Vibra_id_descriptors[0].descriptor->minFrequency; + thiz->mIntensity = 1000; } diff --git a/src/itf/IVirtualizer.c b/src/itf/IVirtualizer.c index b4dd0b6..8f42618 100644 --- a/src/itf/IVirtualizer.c +++ b/src/itf/IVirtualizer.c @@ -36,21 +36,21 @@ static SLresult IVirtualizer_SetEnabled(SLVirtualizerItf self, SLboolean enabled { SL_ENTER_INTERFACE - IVirtualizer *this = (IVirtualizer *) self; - interface_lock_exclusive(this); - this->mEnabled = (SLboolean) enabled; + IVirtualizer *thiz = (IVirtualizer *) self; + interface_lock_exclusive(thiz); + thiz->mEnabled = (SLboolean) enabled; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_VIRTUALIZER(this)) { + if (NO_VIRTUALIZER(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - this->mVirtualizerEffect->setEnabled((bool) this->mEnabled); + thiz->mVirtualizerEffect->setEnabled((bool) thiz->mEnabled); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); SL_LEAVE_INTERFACE @@ -64,21 +64,21 @@ static SLresult IVirtualizer_IsEnabled(SLVirtualizerItf self, SLboolean *pEnable if (NULL == pEnabled) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVirtualizer *this = (IVirtualizer *) self; - interface_lock_exclusive(this); - SLboolean enabled = this->mEnabled; + IVirtualizer *thiz = (IVirtualizer *) self; + interface_lock_exclusive(thiz); + SLboolean enabled = thiz->mEnabled; #if !defined(ANDROID) *pEnabled = enabled; result = SL_RESULT_SUCCESS; #else - if (NO_VIRTUALIZER(this)) { + if (NO_VIRTUALIZER(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - *pEnabled = (SLboolean) this->mVirtualizerEffect->getEnabled(); + *pEnabled = (SLboolean) thiz->mVirtualizerEffect->getEnabled(); result = SL_RESULT_SUCCESS; } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -92,21 +92,21 @@ static SLresult IVirtualizer_SetStrength(SLVirtualizerItf self, SLpermille stren if ((VIRTUALIZER_STRENGTH_MIN > strength) || (VIRTUALIZER_STRENGTH_MAX < strength)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVirtualizer *this = (IVirtualizer *) self; - interface_lock_exclusive(this); + IVirtualizer *thiz = (IVirtualizer *) self; + interface_lock_exclusive(thiz); #if !defined(ANDROID) - this->mStrength = strength; + thiz->mStrength = strength; result = SL_RESULT_SUCCESS; #else - if (NO_VIRTUALIZER(this)) { + if (NO_VIRTUALIZER(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_virt_setParam(this->mVirtualizerEffect, + android::status_t status = android_virt_setParam(thiz->mVirtualizerEffect, VIRTUALIZER_PARAM_STRENGTH, &strength); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } SL_LEAVE_INTERFACE @@ -120,21 +120,21 @@ static SLresult IVirtualizer_GetRoundedStrength(SLVirtualizerItf self, SLpermill if (NULL == pStrength) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVirtualizer *this = (IVirtualizer *) self; - interface_lock_exclusive(this); - SLpermille strength = this->mStrength;; + IVirtualizer *thiz = (IVirtualizer *) self; + interface_lock_exclusive(thiz); + SLpermille strength = thiz->mStrength;; #if !defined(ANDROID) result = SL_RESULT_SUCCESS; #else - if (NO_VIRTUALIZER(this)) { + if (NO_VIRTUALIZER(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { - android::status_t status = android_virt_getParam(this->mVirtualizerEffect, + android::status_t status = android_virt_getParam(thiz->mVirtualizerEffect, VIRTUALIZER_PARAM_STRENGTH, &strength); result = android_fx_statusToResult(status); } #endif - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); *pStrength = strength; } @@ -153,18 +153,18 @@ static SLresult IVirtualizer_IsStrengthSupported(SLVirtualizerItf self, SLboolea *pSupported = SL_BOOLEAN_TRUE; result = SL_RESULT_SUCCESS; #else - IVirtualizer *this = (IVirtualizer *) self; + IVirtualizer *thiz = (IVirtualizer *) self; int32_t supported = 0; - interface_lock_exclusive(this); - if (NO_VIRTUALIZER(this)) { + interface_lock_exclusive(thiz); + if (NO_VIRTUALIZER(thiz)) { result = SL_RESULT_CONTROL_LOST; } else { android::status_t status = - android_virt_getParam(this->mVirtualizerEffect, + android_virt_getParam(thiz->mVirtualizerEffect, VIRTUALIZER_PARAM_STRENGTH_SUPPORTED, &supported); result = android_fx_statusToResult(status); } - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); *pSupported = (SLboolean) (supported != 0); #endif } @@ -183,31 +183,31 @@ static const struct SLVirtualizerItf_ IVirtualizer_Itf = { void IVirtualizer_init(void *self) { - IVirtualizer *this = (IVirtualizer *) self; - this->mItf = &IVirtualizer_Itf; - this->mEnabled = SL_BOOLEAN_FALSE; - this->mStrength = 0; + IVirtualizer *thiz = (IVirtualizer *) self; + thiz->mItf = &IVirtualizer_Itf; + thiz->mEnabled = SL_BOOLEAN_FALSE; + thiz->mStrength = 0; #if defined(ANDROID) - memset(&this->mVirtualizerDescriptor, 0, sizeof(effect_descriptor_t)); + memset(&thiz->mVirtualizerDescriptor, 0, sizeof(effect_descriptor_t)); // placement new (explicit constructor) - (void) new (&this->mVirtualizerEffect) android::sp<android::AudioEffect>(); + (void) new (&thiz->mVirtualizerEffect) android::sp<android::AudioEffect>(); #endif } void IVirtualizer_deinit(void *self) { #if defined(ANDROID) - IVirtualizer *this = (IVirtualizer *) self; + IVirtualizer *thiz = (IVirtualizer *) self; // explicit destructor - this->mVirtualizerEffect.~sp(); + thiz->mVirtualizerEffect.~sp(); #endif } bool IVirtualizer_Expose(void *self) { #if defined(ANDROID) - IVirtualizer *this = (IVirtualizer *) self; - if (!android_fx_initEffectDescriptor(SL_IID_VIRTUALIZER, &this->mVirtualizerDescriptor)) { + IVirtualizer *thiz = (IVirtualizer *) self; + if (!android_fx_initEffectDescriptor(SL_IID_VIRTUALIZER, &thiz->mVirtualizerDescriptor)) { SL_LOGE("Virtualizer initialization failed."); return false; } diff --git a/src/itf/IVisualization.c b/src/itf/IVisualization.c index 28b2378..6991d80 100644 --- a/src/itf/IVisualization.c +++ b/src/itf/IVisualization.c @@ -27,12 +27,12 @@ static SLresult IVisualization_RegisterVisualizationCallback(SLVisualizationItf if (!(0 < rate && rate <= 20000)) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVisualization *this = (IVisualization *) self; - interface_lock_exclusive(this); - this->mCallback = callback; - this->mContext = pContext; - this->mRate = rate; - interface_unlock_exclusive(this); + IVisualization *thiz = (IVisualization *) self; + interface_lock_exclusive(thiz); + thiz->mCallback = callback; + thiz->mContext = pContext; + thiz->mRate = rate; + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -62,9 +62,9 @@ static const struct SLVisualizationItf_ IVisualization_Itf = { void IVisualization_init(void *self) { - IVisualization *this = (IVisualization *) self; - this->mItf = &IVisualization_Itf; - this->mCallback = NULL; - this->mContext = NULL; - this->mRate = 20000; + IVisualization *thiz = (IVisualization *) self; + thiz->mItf = &IVisualization_Itf; + thiz->mCallback = NULL; + thiz->mContext = NULL; + thiz->mRate = 20000; } diff --git a/src/itf/IVolume.c b/src/itf/IVolume.c index d315a51..b5438d6 100644 --- a/src/itf/IVolume.c +++ b/src/itf/IVolume.c @@ -26,14 +26,14 @@ static SLresult IVolume_SetVolumeLevel(SLVolumeItf self, SLmillibel level) if (!((SL_MILLIBEL_MIN <= level) && (level <= PLATFORM_MILLIBEL_MAX_VOLUME))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_exclusive(this); - SLmillibel oldLevel = this->mLevel; + IVolume *thiz = (IVolume *) self; + interface_lock_exclusive(thiz); + SLmillibel oldLevel = thiz->mLevel; if (oldLevel != level) { - this->mLevel = level; - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + thiz->mLevel = level; + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -48,10 +48,10 @@ static SLresult IVolume_GetVolumeLevel(SLVolumeItf self, SLmillibel *pLevel) if (NULL == pLevel) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_peek(this); - SLmillibel level = this->mLevel; - interface_unlock_peek(this); + IVolume *thiz = (IVolume *) self; + interface_lock_peek(thiz); + SLmillibel level = thiz->mLevel; + interface_unlock_peek(thiz); *pLevel = level; result = SL_RESULT_SUCCESS; } @@ -79,15 +79,15 @@ static SLresult IVolume_SetMute(SLVolumeItf self, SLboolean mute) { SL_ENTER_INTERFACE - IVolume *this = (IVolume *) self; + IVolume *thiz = (IVolume *) self; mute = SL_BOOLEAN_FALSE != mute; // normalize - interface_lock_exclusive(this); - SLboolean oldMute = this->mMute; + interface_lock_exclusive(thiz); + SLboolean oldMute = thiz->mMute; if (oldMute != mute) { - this->mMute = (SLuint8) mute; - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + thiz->mMute = (SLuint8) mute; + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; SL_LEAVE_INTERFACE @@ -101,10 +101,10 @@ static SLresult IVolume_GetMute(SLVolumeItf self, SLboolean *pMute) if (NULL == pMute) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_peek(this); - SLboolean mute = this->mMute; - interface_unlock_peek(this); + IVolume *thiz = (IVolume *) self; + interface_lock_peek(thiz); + SLboolean mute = thiz->mMute; + interface_unlock_peek(thiz); *pMute = mute; result = SL_RESULT_SUCCESS; } @@ -117,15 +117,15 @@ static SLresult IVolume_EnableStereoPosition(SLVolumeItf self, SLboolean enable) { SL_ENTER_INTERFACE - IVolume *this = (IVolume *) self; + IVolume *thiz = (IVolume *) self; enable = SL_BOOLEAN_FALSE != enable; // normalize - interface_lock_exclusive(this); - SLboolean oldEnable = this->mEnableStereoPosition; + interface_lock_exclusive(thiz); + SLboolean oldEnable = thiz->mEnableStereoPosition; if (oldEnable != enable) { - this->mEnableStereoPosition = (SLuint8) enable; - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + thiz->mEnableStereoPosition = (SLuint8) enable; + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); } else { - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); } result = SL_RESULT_SUCCESS; @@ -140,10 +140,10 @@ static SLresult IVolume_IsEnabledStereoPosition(SLVolumeItf self, SLboolean *pEn if (NULL == pEnable) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_peek(this); - SLboolean enable = this->mEnableStereoPosition; - interface_unlock_peek(this); + IVolume *thiz = (IVolume *) self; + interface_lock_peek(thiz); + SLboolean enable = thiz->mEnableStereoPosition; + interface_unlock_peek(thiz); *pEnable = enable; result = SL_RESULT_SUCCESS; } @@ -159,14 +159,14 @@ static SLresult IVolume_SetStereoPosition(SLVolumeItf self, SLpermille stereoPos if (!((-1000 <= stereoPosition) && (1000 >= stereoPosition))) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_exclusive(this); - SLpermille oldStereoPosition = this->mStereoPosition; + IVolume *thiz = (IVolume *) self; + interface_lock_exclusive(thiz); + SLpermille oldStereoPosition = thiz->mStereoPosition; if (oldStereoPosition != stereoPosition) { - this->mStereoPosition = stereoPosition; - interface_unlock_exclusive_attributes(this, ATTR_GAIN); + thiz->mStereoPosition = stereoPosition; + interface_unlock_exclusive_attributes(thiz, ATTR_GAIN); } else - interface_unlock_exclusive(this); + interface_unlock_exclusive(thiz); result = SL_RESULT_SUCCESS; } @@ -181,10 +181,10 @@ static SLresult IVolume_GetStereoPosition(SLVolumeItf self, SLpermille *pStereoP if (NULL == pStereoPosition) { result = SL_RESULT_PARAMETER_INVALID; } else { - IVolume *this = (IVolume *) self; - interface_lock_peek(this); - SLpermille stereoPosition = this->mStereoPosition; - interface_unlock_peek(this); + IVolume *thiz = (IVolume *) self; + interface_lock_peek(thiz); + SLpermille stereoPosition = thiz->mStereoPosition; + interface_unlock_peek(thiz); *pStereoPosition = stereoPosition; result = SL_RESULT_SUCCESS; } @@ -207,10 +207,10 @@ static const struct SLVolumeItf_ IVolume_Itf = { void IVolume_init(void *self) { - IVolume *this = (IVolume *) self; - this->mItf = &IVolume_Itf; - this->mLevel = 0; - this->mMute = SL_BOOLEAN_FALSE; - this->mEnableStereoPosition = SL_BOOLEAN_FALSE; - this->mStereoPosition = 0; + IVolume *thiz = (IVolume *) self; + thiz->mItf = &IVolume_Itf; + thiz->mLevel = 0; + thiz->mMute = SL_BOOLEAN_FALSE; + thiz->mEnableStereoPosition = SL_BOOLEAN_FALSE; + thiz->mStereoPosition = 0; } |
