Subject:Issue while integrating Noise Reduction Plug-In
Posted by: tosamsam
Date:5/28/2003 11:49:50 PM
Hi, I have written sample application for adding Sonic Foundry filter plug-ins in VC++. I have some issues while playing the files after adding the noise reduction plug-ins. There is no issue while adding all other plug-ins (Like Sonic Foundry Amplitude Modulation, Sonic Foundry ExpressFX Amplitude Modulation ... etc). The 'Run' method IMediaControl is retuning S_FALSE; After that I called OAFilterState ofs; hr = m_pMediaControl->GetState(5000, &ofs); The value of hr is VFW_S_STATE_INTERMEDIATE and ofs is State_Running What could be the problem? Please suggest a solution. The sample code is given below void LoadFile(CString csFileName) { IMediaControl *m_pMediaControl; IMediaEvent *m_pMediaEvent; IMediaSeeking *m_pMediaSeeking; hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER,IID_IGraphBuilder, (void **)&m_pGraphBuilder); if(FAILED(hr)) return; //Query for the IMediaControl interface (provides the methods to run, pause, and stop the playback), the IMediaEventEx interface (so you can receive event notifications), and the IVideoWindow interface to hide the window when the movie is finished playing. hr = m_pGraphBuilder->QueryInterface(IID_IMediaControl, (void **)&m_pMediaControl); if(FAILED(hr)) return; // Get the event interface so we can tell when the playback stopped. hr = m_pGraphBuilder->QueryInterface(IID_IMediaEvent, (void **)&m_pMediaEvent); if(FAILED(hr)) return; // Get the stream positioning interface so that we can increase playback rate. hr = m_pGraphBuilder->QueryInterface(IID_IMediaSeeking, (void **)&m_pMediaSeeking); if(FAILED(hr)) return; //set the time format hr=m_pMediaSeeking->SetTimeFormat(&TIME_FORMAT_MEDIA_TIME); if(FAILED(hr)) return; //Ask the filter graph manager to build the filter graph that renders the input file. This does not play the media file. (When you play the file with Run, the filter graph will automatically render the input file's media type. You do not have to specify a renderer filter.) USES_CONVERSION; wchar_t *wszAudioFile = A2OLE((LPCTSTR)csFileName); hr = m_pGraphBuilder->RenderFile(wszAudioFile , NULL); if(FAILED(hr)) return; IBaseFilter *pRenderFilter = NULL; hr = m_pGraphBuilder->FindFilterByName(L"Default DirectSound Device", &pRenderFilter); IPin *pRenderIPPin; pRenderIPPin = GetInputPin(pRenderFilter); IPin *pTransformOPPin = NULL; pRenderIPPin->ConnectedTo(&pTransformOPPin); LoadAndInsertSonicFilters(m_pGraphBuilder, pRenderIPPin, pTransformOPPin, pRenderFilter); hr = m_pGraphBuilder->RemoveFilter(pRenderFilter); hr = m_pMediaControl->Run(); if(FAILED(hr)) return; /* This function returns S_FALSE and its not playing. What could be the problem? */ //need to wait.. OAFilterState ofs; if(S_FALSE == hr) hr = m_pMediaControl->GetState(5000, &ofs); /* This function returns VFW_S_STATE_INTERMEDIATE; What could be the problem? */ IBasicAudio *pBasicAudio = NULL; hr = m_pGraphBuilder->QueryInterface(IID_IBasicAudio, (void **)&pBasicAudio); hr = pBasicAudio->put_Volume(0); } |