static int wait_event_time(void *p) { MidiEvent *ev = (MidiEvent *)p; int rc, ch; for(;;){ if(ev->time - (current_tick()*play_mode->rate+30)/60 < 0) break; trace_loop(); YieldToAnyThread(); rc = check_apply_control(); if(RC_IS_SKIP_FILE(rc)){ prescan = 0; for(ch = 0; ch < MAX_CHANNELS; ch++){ if(note_channel[ch] != NULL){ NADisposeNoteChannel(gNoteAllocator, note_channel[ch]); note_channel[ch] = NULL; } channel[ch].bank_lsb = 0; channel[ch].bank_msb = 0; } trace_flush(); return rc; } } return RC_NONE; }
void CSenBaseIdentityManager::CleanupUnusedIdentityDBL() { TInt count(0); RPointerArray<CSenElement> elemList; CleanupClosePushL(elemList); CSenElement& element = iIdentity->AsElement(); element.ElementsL(elemList, KIdentityProvider); count = elemList.Count(); // There can be many Identity Provider elements within Identity element for(TInt i = 0; i < count; i++) { CSenElement* elem = elemList[i]; const TDesC8* attrValue = elem->AttrValue(KTouch()); if(attrValue != NULL) { TUint32 current_tick(0); TUint32 db_ticks(0); TUint32 diff_ticks(0); TLex8 lex; lex.Assign(*attrValue); lex.Val(db_ticks, EDecimal); current_tick = User::NTickCount(); diff_ticks = current_tick - db_ticks; if(KMaxTicks <= diff_ticks || current_tick < db_ticks) { TInt endpointCount(0); _LIT8(KEndpoint, "Endpoint"); RPointerArray<CSenElement> endpointElemList; CleanupClosePushL(endpointElemList); elem->ElementsL(endpointElemList, KEndpoint); endpointCount = endpointElemList.Count(); if(endpointCount > 0) { CSenIdentityProvider* pMatch = NULL; CSenElement* endpointElem = endpointElemList[0]; TPtrC8 endpoint = endpointElem->Content(); pMatch = IdentityProviderL(endpoint); if(pMatch != NULL) { // Ownership ? UnregisterIdentityProviderL(*pMatch); } } CleanupStack::PopAndDestroy(&endpointElemList); } } } CleanupStack::PopAndDestroy(&elemList); }
static void ctl_timestamp(void) { long secs; CtlEvent ce; static int last_secs = -1; secs = current_tick() / 60; if(secs == last_secs) return; ce.type = CTLE_CURRENT_TIME; ce.v1 = last_secs = secs; if(ctl->trace_playing && !midi_trace.flush_flag) push_midi_trace_ce(ctl->event, &ce); else ctl->event(&ce); }
EXPORT_C void CSenBaseIdentityManager::UpdateTouchIdentityDBL(MSenServiceDescription& asd) { CSenIdentityProvider* Idp = NULL; Idp = iIdentity->IdentityProviderL(asd); if(Idp != NULL) { TUint32 current_tick(0); TBuf8<32> tickBuf; CSenElement& IdpElem = Idp->AsElement(); current_tick = User::NTickCount(); tickBuf.Num(current_tick); IdpElem.AddAttrL(KTouch(), tickBuf); } // CleanupUnusedIdentityDBL(); // (don't de-serialize old items). Serialized // objects cannot be de-allocated on the fly. }
static int32 current_samples(void) { return (current_tick()*play_mode->rate + 30)/60; }