Recent

Author Topic: DirectMusic Problem  (Read 11138 times)

Aeternitas

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
DirectMusic Problem
« on: October 11, 2013, 12:22:48 pm »
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: [Select]
objDX8Loader: IDirectMusicLoader8;
  objDX8Segment: IDirectMusicSegment8;
  objDX8Performance: IDirectMusicPerformance8;
  objDX8SegmentState: IDirectMusicSegmentState8;

Then I tried to init audio and load the music file:
Code: [Select]
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.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: DirectMusic Problem
« Reply #1 on: October 11, 2013, 01:24:30 pm »
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

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
Re: DirectMusic Problem
« Reply #2 on: October 11, 2013, 05:45:57 pm »
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

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: DirectMusic Problem
« Reply #3 on: October 11, 2013, 06:51:03 pm »
Which version do you mean? Prerelease 1.1.99? If not, please give a link.
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).
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

BlueIcaro

  • Hero Member
  • *****
  • Posts: 792
    • Blog personal
Re: DirectMusic Problem
« Reply #4 on: October 11, 2013, 06:57:17 pm »
do you have all need dll into folder where is your exe? or in path?

/BlueIcaro

Aeternitas

  • New Member
  • *
  • Posts: 42
    • The Dark Forests Web
Re: DirectMusic Problem
« Reply #5 on: October 11, 2013, 07:18:27 pm »
do you have all need dll into folder where is your exe? or in path?

/BlueIcaro

I have there d3dx9_33.dll and DXErr9ab.dll. And DirectX9.2 is installed.

 

TinyPortal © 2005-2018