Skip to main content

[Windows Mobile] DirectShow framerate sound problem

 
View related threads: (in this forum | in all forums)

Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Windows Mobile] >> Windows Mobile 6 >> [Windows Mobile] DirectShow framerate sound problem Page: [1]
Login
Message << Older Topic   Newer Topic >>
[Windows Mobile] DirectShow framerate sound problem - 9/11/2008 9:24:34 AM   
warptrosse

 

Posts: 3
Score: 0
Joined: 9/11/2008
Status: offline
Hi again.... As you know (or not) I´m developing a game for windows mobile 6, another problem with which I have encountered is framerate when the game start to reproduce a sound....

First to all, I manage to reproduce midi, wav, aac and amr... not mp3... but it´s another problem.....

so... I´m using following code:

===============================================================================
bool SoundPlayer::realize()
{
// Cleaning GraphFilter
if(pGraph != NULL)
{
return true;
}

// Initializing the COM library on the current thread.
HRESULT hr;
hr = CoInitialize(NULL);
if (FAILED(hr))
{
printf("ERROR - Could not initialize COM library.\n");
return false;
}

// Creating an instance of the Filter Graph Manager.
hr = CoCreateInstance(CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, IID_IGraphBuilder, (void **)&pGraph);
if (FAILED(hr))
{
printf("ERROR - Could not create the Filter Graph Manager.\n");
return false;
}

// Asking to Graph for interfaces.
hr = pGraph->QueryInterface(IID_IMediaControl, (void **)&pControl);
if (FAILED(hr))
{
printf("ERROR - Could not retrieve pointer to IMediaControl interface.\n");
return false;
}

hr = pGraph->QueryInterface(IID_IMediaEvent, (void **)&pEvent);
if (FAILED(hr))
{
printf("ERROR - Could not retrieve pointer to IMediaEvent interface.\n");
return false;
}

hr = pGraph->QueryInterface(IID_IMediaSeeking, (void **)&pSeeking);
if (FAILED(hr))
{
printf("ERROR - Could not retrieve pointer to IMediaSeeking interface.\n");
return false;
}

hr = pGraph->QueryInterface(IID_IBasicAudio, (void **)&pAudio);
if (FAILED(hr))
{
printf("ERROR - Could not retrieve pointer to IBasicAudio interface.\n");
return false;
}

// Constructing a filter graph that will play the specified file.
hr = pGraph->RenderFile(soundFileNameW, NULL);
if (FAILED(hr))
{
printf("ERROR - Could not construct a filter graph that will play the specified file.");
return false;
}

}

bool SoundPlayer::start()
{
if(!realize())
{
return false;
}

// Switching the entire filter graph to running state.
HRESULT hr;
hr = pControl->Run();
if (FAILED(hr))
{
printf("ERROR - Could not switch filter graph to running state.\n");
return false;
}

return true;
}

bool SoundPlayer::stop()
{
// Switching the entire filter graph to stopped state.
HRESULT hr;
hr = pControl->Stop();
if (FAILED(hr))
{
printf("ERROR - Could not switch filter graph to stopped state.\n");
return false;
}

return true;
}

void SoundPlayer::close()
{
// Releasing graph and COM.
pAudio->Release();
pAudio = NULL;

pSeeking->Release();
pSeeking = NULL;

pEvent->Release();
pEvent = NULL;

pControl->Release();
pControl = NULL;

pGraph->Release();
pGraph = NULL;

CoUninitialize();
}
===============================================================================

The problem is that when a sound starts I need to render it again (realize function), and add the filters too.... then run the graph (start function).... this operation decreases the framerate significantly just for a second or two.... but it´s really annoying....

so, there is a way to hold the sound "realized" and only execute run operation?....

other observation... when the sound finishes, the thread which appears to contains the graphFilter is destroyed....

best regards...
Post #: 1
Page:   [1]
All Forums >> [Windows Mobile] >> Windows Mobile 6 >> [Windows Mobile] DirectShow framerate sound problem Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Forum Software © ASPPlayground.NET Advanced Edition 2.5.5 Unicode

0.016