Archived

This topic is now archived and is closed to further replies.

Doolwind

InitAudio - E_OUTOFMEMORY

Recommended Posts

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]

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites