void HdxDrawTargetRenderPass::_ClearBuffers() { float depthValue = _drawTargetRenderPassState->GetDepthClearValue(); glClearBufferfv(GL_DEPTH, 0, &depthValue); size_t numAttachments = _drawTargetRenderPassState->GetNumColorAttachments(); for (size_t attachmentNum = 0; attachmentNum < numAttachments; ++attachmentNum) { const VtValue &clearColor = _drawTargetRenderPassState->GetColorClearValue(attachmentNum); _ClearBuffer(GL_COLOR, attachmentNum, clearColor); } }
int WEqProcessor::Clear(int fBroadcast) { #ifdef _PRINT_DEBUG_INFO printf("WEqProcessor::Clear\n"); #endif EnterCriticalSection(&c_CriticalSection); if(c_fEnable) _ClearBuffer(this); c_nCurrentEqLatency = Latency; c_nLatencyInSamples = 0; // clear output queue c_queue.Clear(); LeaveCriticalSection(&c_CriticalSection); if(fBroadcast && c_next) { #ifdef AUDIO_PROCESSOR_RETURN_ERROR_STR if(c_pchReturnError == 0) c_next->c_pchReturnError = c_pchErrorMessageStr; else c_next->c_pchReturnError = c_pchReturnError; #endif return c_next->Clear(fBroadcast); } return 1; }
int WEqProcessor::Flush(int fBroadcast) { #ifdef _PRINT_DEBUG_INFO printf("WEqProcessor::Flush\n"); #endif EnterCriticalSection(&c_CriticalSection); if(c_nCurrentEqLatency < c_nMaxLatencySamples) { // allocate flash buffer char *buf = (char*) malloc(c_nMaxLatencySamples * c_nBlockAlign); if(buf == 0) { strcpy(c_pchErrorMessageStr, "WEqProcessor::Flush->Memory allocation error."); if(c_pchReturnError) strcpy(c_pchReturnError, c_pchErrorMessageStr); LeaveCriticalSection(&c_CriticalSection); return 0; } memset(buf, 0, c_nMaxLatencySamples * c_nBlockAlign); if(c_fEnable == 0) weq_enable = 0; _ModifySamples(this, (char *) buf, buf, c_nMaxLatencySamples, c_nChannel, c_nBitPerSample); weq_enable = 1; _ClearBuffer(this); c_LastData.nStartPosition = c_LastData.nEndPosition; c_LastData.nEndPosition += c_nMaxLatencySamples; c_LastData.pSamples = buf; c_LastData.nNumberOfSamples = c_nMaxLatencySamples; c_LastData.nBlockAllign = c_nBlockAlign; if(c_next) { if(c_next->PushSamples(&c_LastData) == 0) { free(buf); LeaveCriticalSection(&c_CriticalSection); return 0; } free(buf); } else if (c_output) { if(c_output(&c_LastData) == 0) { free(buf); strcpy(c_pchErrorMessageStr, "WEqProcessor::Flush->Output function return 0."); if(c_pchReturnError) strcpy(c_pchReturnError, c_pchErrorMessageStr); LeaveCriticalSection(&c_CriticalSection); return 0; } free(buf); } else { if(c_queue.PushSamples(&c_LastData) == 0) { strcpy(c_pchErrorMessageStr, "WEqProcessor::Flush->Can't add data to queue."); if(c_pchReturnError) strcpy(c_pchReturnError, c_pchErrorMessageStr); LeaveCriticalSection(&c_CriticalSection); return 0; } } } c_nLatencyInSamples = 0; LeaveCriticalSection(&c_CriticalSection); c_nCurrentEqLatency = Latency; if(fBroadcast && c_next) { #ifdef AUDIO_PROCESSOR_RETURN_ERROR_STR if(c_pchReturnError == 0) c_next->c_pchReturnError = c_pchErrorMessageStr; else c_next->c_pchReturnError = c_pchReturnError; #endif return c_next->Flush(fBroadcast); } return 1; }