Forum > DirectX

DirectMusic Problem

(1/2) > >>

Aeternitas:
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:


--- Code: ---objDX8Loader: IDirectMusicLoader8;
  objDX8Segment: IDirectMusicSegment8;
  objDX8Performance: IDirectMusicPerformance8;
  objDX8SegmentState: IDirectMusicSegmentState8;
--- End code ---

Then I tried to init audio and load the music file:

--- Code: ---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;
--- End code ---

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.

marcov:
Are those DLLs and headers fit for 64-bit programs?  A 64-bits programs can use a 32-bit DLL.


FPC 2.6.x 64-bit doesn't support certain forms of exception handling (in non FPC code). IF you have a problem with exceptions from external code in 64-bit mode, try the development version of FPC.

Aeternitas:
I have also 32 bit installation of Lazarus; causing the exception as well.

Which version do you mean? Prerelease 1.1.99? If not, please give a link.

BigChimp:

--- Quote from: Aeternitas on October 11, 2013, 05:45:57 pm ---Which version do you mean? Prerelease 1.1.99? If not, please give a link.

--- End quote ---
1.1.99 is still based on 2.6.x so no.

You would need a snapshot based on FPC 2.7.1 or compile yourself using an svn copy (e.g. using fpcup).

BlueIcaro:
do you have all need dll into folder where is your exe? or in path?

/BlueIcaro

Navigation

[0] Message Index

[#] Next page

Go to full version