InitAudio - E_OUTOFMEMORY

Started by
3 comments, last by Doolwind 20 years, 6 months ago
Hi, I'm trying to put some basic sounds into my 3D RTS and I'm having a problem. I am following the Direct Audio tutorial line for line but still haivng trouble. The two calls to CoCreateInstance work fine and return success, however when I make the call to InitAudio the error E_OUTOFMEMORY is returned. I have put the exact same code into a skeleton program and it works fine, it seems to be something in my program that is causing it to run out of memory. The game's process is only using 3megs of memory when I get the E_OUTOFMEMORY return and I have 512megs of RAM on my PC. The actual calling code is:

g_pPerformance->InitAudio( 
	NULL,      // IDirectMusic interface not needed.
	NULL,      // IDirectSound interface not needed.
	NULL,      // Window handle.
	DMUS_APATH_SHARED_STEREOPLUSREVERB,  // Default audiopath type.
	64,        // Number of performance channels.
	DMUS_AUDIOF_ALL,   // Features on synthesizer.
	NULL       // Audio parameters; use defaults.
	);
  
I realise the problem is obviously specific to something in my game, but I'm wondering if there is some generic problem anyone has come across to give the E_OUTOFMEMORY message. All but one of my large objects are pointers, and are instantiated after the call to InitAudio, and I have moved the sound setup code to the start of my game's execution, but still I get the error. Thanks Doolwind --------------------------------------------------------- Who of you by worrying can add a single hour to his life. Matthew 6:27 [edited by - Doolwind on October 5, 2003 8:41:37 AM]
Advertisement
Bump
your InitAudio is the same as mine...

It''s time you start commenting out your sound facilities, until you pinpoint the cause for outofmemory.. (you mentioned earlier that isolating the Dmusic worked ok).


www.cppnow.com
SORRY, I have this setup...


hr = MusicPerformanceData.MusicPerformance->InitAudio(0, 0, 0, 0, 64, DMUS_AUDIOF_ALL, 0);
//if(hr == ...) ...
hr = MusicPerformanceData.MusicPerformance->CreateStandardAudioPath(DMUS_APATH_SHARED_STEREOPLUSREVERB, 64, false, &MusicPerformanceData.AudioPath);
//if(hr == ...) ...



It seems I do NOT init usinf the shared option, but I assign an audiopath using this shared facility..



www.cppnow.com
superdeveloper-

Thanks for your reply. With regard to commenting out sound facilities, there isn''t really anything I can comment out. All I have done is Call CoCreateInstance twice and then on the call to InitAudio it fails. Here is the source from the very beginning of sound setup.

ret = CoCreateInstance(CLSID_DirectMusicLoader, NULL, 	CLSCTX_INPROC, IID_IDirectMusicLoader8,	(void**)&g_pLoader);ret = CoCreateInstance(CLSID_DirectMusicPerformance, NULL,	CLSCTX_INPROC, IID_IDirectMusicPerformance8,	(void**)&g_pPerformance );	ret = g_pPerformance->InitAudio( 	NULL,      // IDirectMusic interface not needed.	NULL,      // IDirectSound interface not needed.	NULL,      // Window handle.	DMUS_APATH_SHARED_STEREOPLUSREVERB,  // Default audiopath type.	64,        // Number of performance channels.	DMUS_AUDIOF_ALL,   // Features on synthesizer.	NULL       // Audio parameters; use defaults.	);


Doolwind

---------------------------------------------------------
Who of you by worrying can add a single hour to his life.
Matthew 6:27

This topic is closed to new replies.

Advertisement