예제 #1
0
STDMETHODIMP CDelay::Process(ULONG ulSize, BYTE *pData, REFERENCE_TIME refTimeStart, DWORD dwFlags)
{
    if (dwFlags &= ~DMO_INPLACE_ZERO)
        return E_INVALIDARG;

    if (!pData) 
    {
        return E_POINTER;
    }


	ATLTRACE2(atlTraceGeneral, 3, "Process: %d bytes. Time stamp: %f\n", 
		ulSize, RefTime2Double(refTimeStart));



    LockIt lock(this);
    
    if (!InputTypeSet(0) || !OutputTypeSet(0)) 
    {
        return DMO_E_TYPE_NOT_SET;
    }
    
    //  Make sure all streams have media types set and resources are allocated
    HRESULT hr = AllocateStreamingResources();
    
	if (SUCCEEDED(hr))
		hr = DoProcessOutput(pData, pData, ulSize / m_pWave->nBlockAlign);

	return hr;

    // If this DMO supported an effect tail, it would return S_FALSE until 
    // the tail was processed. See IMediaObjectInPlace::Process documentation.
}
예제 #2
0
///////////////////////
//
// IMediaObjectInPlace::Process
//
//  The Process method processes a block of data. The application supplies a
//  pointer to a block of input data. The DMO processes the data in place.
//
//  Parameters
//
//      ulSize
//          [in] Size of the data, in bytes.
//
//      pData
//          [in, out] Pointer to a buffer of size ulSize. On input, the buffer
//          holds the input data. If the method returns successfully, the
//          buffer contains the output data.
//
//      refTimeStart
//          [in] Start time of the data.
//
//      dwFlags
//          [in] Either DMO_INPLACE_NORMAL or DMO_INPLACE_ZERO. See Remarks
//          for more information.
//
//  Return Value
//      S_FALSE Success. There is still data to process.
//      S_TRUE Success. There is no remaining data to process.
//      E_FAIL Failure.
//
//  If the method fails, the buffer might contain garbage. The application
//  should not use the contents of the buffer.
//
//  The DMO might produce output data beyond the length of the input data. This
//  is called an effect tail. For example, a reverb effect continues after the
//  input reaches silence. If the DMO has an effect tail, this method returns
//  S_FALSE.
//
//  While the application has input data for processing, call the Process
//  method with the dwFlags parameter set to DMO_INPLACE_NORMAL. If the last
//  such call returns S_FALSE, call Process again, this time with a zeroed input
//  buffer and the DMO_INPLACE_ZERO flag. The DMO will now fill the zeroed buffer
//  with the effect tail. Continue calling Process in this way until the return
//  value is S_TRUE, indicating that the DMO has finished processing the effect
//  tail.
//
//  If the DMO has no effect tail, this method always returns S_TRUE (or an error code).
//
HRESULT CHXAudioDeviceHookBase::Process(ULONG ulSize, BYTE *pData, REFERENCE_TIME refTimeStart, DWORD dwFlags)
{

// TODO: Modify implementation of Process() if necessary

    HRESULT hr = S_OK;

    if (!m_fInitialized)
    {
        hr = AllocateStreamingResources();
    }

    if (SUCCEEDED(hr))
    {
        // Process the data
        hr = DoProcess(pData, pData, ulSize / WaveFormat()->nBlockAlign);
    }
    return hr;
}