Home | History | Annotate | Download | only in libmedia

Lines Matching refs:lpToneGen

1106     ToneGenerator *lpToneGen = static_cast<ToneGenerator *>(user);
1109 const ToneDescriptor *lpToneDesc = lpToneGen->mpToneDesc;
1118 unsigned int lReqSmp = lNumSmp < lpToneGen->mProcessSize*2 ? lNumSmp : lpToneGen->mProcessSize;
1123 lpToneGen->mLock.lock();
1127 lpToneGen->mTotalSmp += lReqSmp;
1130 switch (lpToneGen->mState) {
1144 lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below
1155 if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0 ||
1156 lpToneGen->mTotalSmp > lpToneGen->mMaxSmp) {
1157 if (lpToneGen->mState == TONE_PLAYING) {
1158 lpToneGen->mState = TONE_STOPPING;
1160 if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) {
1165 lpToneGen->mNextSegSmp = TONEGEN_INF; // forced to skip state machine management below
1168 if (lpToneGen->mTotalSmp > lpToneGen->mNextSegSmp) {
1176 if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) {
1179 unsigned short lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[lFreqIdx];
1182 WaveGenerator *lpWaveGen = lpToneGen->mWaveGens.valueFor(lFrequency);
1184 lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx];
1190 if (lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
1191 if (lpToneGen->mLoopCounter < lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt) {
1193 lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
1194 lpToneGen->mLoopCounter,
1195 lpToneGen->mCurSegment);
1196 lpToneGen->mCurSegment = lpToneDesc->segments[lpToneGen->mCurSegment].loopIndx;
1197 ++lpToneGen->mLoopCounter;
1200 lpToneGen->mLoopCounter = 0;
1201 lpToneGen->mCurSegment++;
1203 lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
1204 lpToneGen->mLoopCounter,
1205 lpToneGen->mCurSegment);
1208 lpToneGen->mCurSegment++;
1210 lpToneDesc->segments[lpToneGen->mCurSegment].loopCnt,
1211 lpToneGen->mLoopCounter,
1212 lpToneGen->mCurSegment);
1217 if (lpToneDesc->segments[lpToneGen->mCurSegment].duration == 0) {
1218 ALOGV("Last Seg: %d", lpToneGen->mCurSegment);
1221 if (++lpToneGen->mCurCount <= lpToneDesc->repeatCnt) {
1222 ALOGV("Repeating Count: %d", lpToneGen->mCurCount);
1224 lpToneGen->mCurSegment = lpToneDesc->repeatSegment;
1229 ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment,
1230 (lpToneGen->mNextSegSmp*1000)/lpToneGen->mSamplingRate);
1237 ALOGV("New segment %d, Next Time: %d", lpToneGen->mCurSegment,
1238 (lpToneGen->mNextSegSmp*1000)/lpToneGen
1239 if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] != 0) {
1249 // Update next segment transition position. No harm to do it also for last segment as lpToneGen->mNextSegSmp won't be used any more
1250 lpToneGen->mNextSegSmp
1251 += (lpToneDesc->segments[lpToneGen->mCurSegment].duration * lpToneGen->mSamplingRate) / 1000;
1255 if (lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[0] == 0) {
1265 unsigned short lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[lFreqIdx];
1268 WaveGenerator *lpWaveGen = lpToneGen->mWaveGens.valueFor(lFrequency);
1270 lFrequency = lpToneDesc->segments[lpToneGen->mCurSegment].waveFreq[++lFreqIdx];
1279 switch (lpToneGen->mState) {
1282 if (lpToneGen->prepareWave()) {
1283 lpToneGen->mState = TONE_STARTING;
1284 if (clock_gettime(CLOCK_MONOTONIC, &lpToneGen->mStartTime) != 0) {
1285 lpToneGen->mStartTime.tv_sec = 0;
1288 lpToneDesc = lpToneGen->mpToneDesc;
1291 lpToneGen->mState = TONE_IDLE;
1292 lpToneGen->mpAudioTrack->stop();
1300 lpToneGen->mState = TONE_STOPPED;
1305 lpToneGen->mState = TONE_INIT;
1307 lpToneGen->mpAudioTrack->stop();
1315 lpToneGen->mState = TONE_PLAYING;
1328 lpToneGen->mWaitCbkCond.broadcast();
1329 lpToneGen->mLock.unlock();