|
||||||||||||||||||
Add Forum to Favorites | Send Topic To a Friend | View Forum FAQ | Track this topic |
Last Thread Next Thread ![]() |
| DirectMusic - (Again) Works on One Computer, But Not Another |
|
![]() deadimp Member since: 8/22/2004 |
||||
|
|
||||
| Yet again, DirectMusic vexes me in the utmost frustating way... I have gotten DirectMusic to compile just fine and dandy in my game engine library and my game, however when I call the intializer for DirectMusic, it does not work. It loads the window, displays the buffer (which doesn't cleared when I close the program), freezes for about a second or so, and then simply closes... I am confused. I am including the COM initialization, along with the appropriate header, library, etc., and I place this along with the DirectMusic initialization after the window has been defined. As for DirectMusic I am using the "Playing MIDIs and WAVs using DirectX" article. Here is a basic layout (along with my initialize/unload function) int WINAPI WinMain(...) { //Window created here CoInitialize(NULL); initDS(); ... //End of program unloadDS(); CoUnitialize(); } //DX globals IDirectMusicLoader8* dsLoader=NULL; IDirectMusicPerformance8* dsPerformance=NULL; string DGI_DSPath=""; bool initDS() { //Initialize DirectMusic HRESULT hRes; hRes=CoCreateInstance(CLSID_DirectMusicLoader, NULL, CLSCTX_INPROC, IID_IDirectMusicLoader8, (void**)&dsLoader); if (FAILED(hRes)) return DGI_Error("DS COM Loader",hRes); hRes=CoCreateInstance(CLSID_DirectMusicPerformance, NULL, CLSCTX_INPROC, IID_IDirectMusicPerformance8, (void**)&dsPerformance); if (FAILED(hRes)) return DGI_Error("DS COM Performance",hRes); hRes=dsPerformance->InitAudio( NULL, // IDirectMusic interface not needed. NULL, // IDirectSound interface not needed. hwnd, // 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. ); if (FAILED(hRes)) return DGI_Error("DS Performance InitAudio",hRes); //Start search path if (DGI_DSPath.length()==0) DGI_DSPath=get_current_dir(); //Get current directory hRes=dsLoader->SetSearchDirectory( GUID_DirectMusicAllTypes, // Types of files sought. string_unicode(DGI_DSPath), //Path for searching (convert to unicoe) false // Don't clear object data. ); if (FAILED(hRes)) return DGI_Error("DS Loader SSD",hRes); return true; } bool unloadDS() { //Unload DirectSound //Stop all sounds if (dsPerformance!=NULL) { dsPerformance->Stop(NULL,NULL,0,0); dsPerformance->CloseDown(); DXDELETE(dsPerformance); dsPerformance=NULL; } if (dsLoader!=NULL) { DXDELETE(dsLoader); dsLoader=NULL; } return false; //This is for errors } All I'm having the game do with DirectMusic is simply load and unload it. No loading music, no playing it either. [Edited by - deadimp on May 23, 2005 11:55:19 AM] |
||||
|
||||
![]() CycloCode Member since: 1/24/2005 From: Canada |
||||
|
|
||||
| Not much help, but since you mentioned its urgent. (that music plays?) Have you considered using a lgpl lib? Maybe audiere ? I personaly find it very easy to use. plug-n-play ;) |
||||
|
||||
![]() deadimp Member since: 8/22/2004 |
||||
|
|
||||
| Well, I no longer need urgent help, for I simply used Windows MultiMedia for a temporary place holder. Yet still, I need to figure out what is wrong. I am using: Dev-C++ 4.9.9.1, DirectX 9.0 DevPak (w/changes), on WindowsXP Home Edition. Thanks for the suggestion, but having my overbearing ego, I would like to be able to have my own sound engine. This is because I like knowing what is going on behind the scenes, I can change what I like, etc... However, it looks rather good, and it seems that this would be what I will use if I can't get this to work. Thanks again. |
||||
|
||||
![]() deadimp Member since: 8/22/2004 |
||||
|
|
||||
| Well, I've made a little progress. I have added a small little error handling system for initialization that works fine, and once I remove the 'AddPort' function from 'initDS', it doesn't give me any errors. Another thing I have discovered: It freezes after 1 step of program (maybe at the Translating/Dispatching message section of WinMain), and I don't know why, for I do not call any DirectMusic or DirectSound functions in the mean time. NOTE: I edited the above source code. |
||||
|
||||
![]() deadimp Member since: 8/22/2004 |
||||
|
|
||||
| I've found out a little more: The program will work fine when I don't initialize DirectMusic at all and when I intitialize but unload it right after... So the problem now lies within Windows and DirectX, but what is it? |
||||
|
||||
![]() deadimp Member since: 8/22/2004 |
||||
|
|
||||
| Well, I must say... WTF?!?! My sound engine doesn't work at all at my computer at home, but it works fine on the school computer... I must research this... Does anyone know what could contribute to this erroneus variety of results? |
||||
|
||||
All times are ET (US)![]() |
Last Thread Next Thread ![]() |
|