Hi,
I try to use DirectX music in my application, because I need to play SGT music files. I downloaded Clootie DirectX Headers and defined:
objDX8Loader: IDirectMusicLoader8;
objDX8Segment: IDirectMusicSegment8;
objDX8Performance: IDirectMusicPerformance8;
objDX8SegmentState: IDirectMusicSegmentState8;
Then I tried to init audio and load the music file:
procedure TForm30.Load(FileNamePath: string);
begin
CoInitialize(nil); //initialize COM
CoCreateInstance(CLSID_DirectMusicLoader,
nil,
CLSCTX_INPROC,
IID_IDirectMusicLoader8,
objDX8Loader); //create loader object
CoCreateInstance(CLSID_DirectMusicPerformance,
nil,
CLSCTX_INPROC,
IID_IDirectMusicPerformance8,
objDX8Performance); //create performance object
objDX8Performance.InitAudio(nil,nil,WindowHandle,DMUS_APATH_SHARED_STEREOPLUSREVERB,32,DMUS_AUDIOF_ALL,nil); //initialize DirectMusic & DirectSound
CoCreateInstance(CLSID_DirectMusicSegment,nil,CLSCTX_INPROC,IID_IDirectMusicSegment8,objDX8Segment);
objDX8Loader.LoadObjectFromFile(CLSID_DirectMusicSegment,IID_IDirectMusicSegment8,PWideChar(FileNamePath),objDX8Segment);
objDX8Segment.Download(objDX8Performance);
end;
The code has been successfully compiled and ran, but then unfortunately the application crashed by the line objDX8Performance.InitAudio referring External SIGSEGV exception.
I use Win7 64bit, Lazarus 1.0.12 64bit. DirectX 9 is installed and I also put the DLLs from Clootie's page next to application exe file.
Any idea what I do wrong?
Thanks in advance.