I still try to ask a question even if it is not related to the development environment.
Every time I call this PlayBufferWasapi () function a number of objects are instantiated, right?
If I never call back:
audioClient-> Stop ();
audioClient-> Release ();
audioRenderClient-> Release ();
at some point I'll find my memory full of objects, so to speak, PlayBufferWasapi () right?
And maybe no longer referenced and therefore no longer eliminable.
Is there a way to keep track of these PlayBufferWasapi () objects in order to free the memory after a certain amount of time?
Code: Select all
void PlayBufferWasapi(short *fileBytes, int fileSize)
{
CoInitialize(NULL);
hr = CoCreateInstance();
deviceEnumerator->GetDefaultAudioEndpoint();
deviceEnumerator->Release();
hr = audioDevice->Activate();
audioDevice->Release();
WAVEFORMATEX wfx = {WAVE_FORMAT_PCM, 2 44100, 16, 4, 176200};
audioClient->Initialize();
audioClient->GetService();
audioClient->GetBufferSize();
audioClient->Start();
audioClient->GetCurrentPadding();
audioRenderClient->GetBuffer();
audioRenderClient->ReleaseBuffer();
/*
Sleep(time_play * 1000);
audioClient->Stop();
audioClient->Release();
audioRenderClient->Release();
*/
}