Search Home Members Contacts
About Us
Products
Downloads
Community
Support
Pages: [1]
  Print  
Author Topic: Sound engine / minimize  (Read 2696 times)
James
Community Member
*
Posts: 883


« on: July 21, 2003, 10:58:28 AM »

Hi,

I`ve problems with the sound engine under Delphi, it seems that for some reason when I enable the sound in the Samples/3D - Terrain with snow and wood, that the sample will play but then I shutdown I get the following error:

Project snow2.exe raised exception class C0000005 with message "access violation at 0x7343ff3f : read of address 0x7343ff3f".

Now if I open the first Tutorial A01 - A simple form, start up the application, minimize it and then close the application I get the same error.

So this must be something pretty fundamental as the Tutorial example doesn`t anything much, except set-up.

When this error happens I can debug the various bits and what i`ve found is:

1) Delphi correctly terminates the applicatio, freeing all objects
2) When Delphi gets down to call ExitProcess, thats when the jump to 0x7343ff3f occurs.
Logged

James
[www.DeepVoodooGaming.Com (Ireland)]
James
Community Member
*
Posts: 883


« Reply #1 on: July 21, 2003, 11:10:40 AM »

FYI : C0000005 means invalid memory access.
Logged

James
[www.DeepVoodooGaming.Com (Ireland)]
sury
Community Member
*
Posts: 200


« Reply #2 on: July 21, 2003, 11:27:13 AM »

Yeah as i said already , strange things happen with TV objects when dealing with Delphi ..i'm currently working on an workaround ..kinda Delphi exceptions suppression  Cheesy
BTW James how did you made the sound to work ?
If i uncomment the sound statements in 3D - Terrain with snow and wood sample , only exceptions occured ...durring startup  :cry:
I just wonder why the sound has been commented if it works ?


Smooth coding...
Logged
James
Community Member
*
Posts: 883


« Reply #3 on: July 21, 2003, 02:21:22 PM »

It works, u just need to make sure that it calls SoundINit (or InitSound) only once, theres a bug when u set the SOUNDENABLE flag to true, it calls InitSound twice (do'h!)

This bug is easily reproducable...
Logged

James
[www.DeepVoodooGaming.Com (Ireland)]
Chroma
Community Member
*
Posts: 173


« Reply #4 on: July 21, 2003, 03:06:19 PM »

strange thing happens when u close the Temple sample too
Logged
sogin
Community Member
*
Posts: 5


« Reply #5 on: July 23, 2003, 03:25:43 PM »

Hey James. What methods do you use to play sounds in Delphi. So far I've managed to get basic wave playback working using the following code:

Code:
Sounds.AddFile(txtFile.Text, ExtractFileName(txtFile.Text) , TV_SOUNDTYPE_DIRECTXSTEREO);
// using sKey = '' (let sound engine determine key) doesn't work for me.
// TV_SOUNDTYPE_UNDEFINED (let sound engine determine sound type) doesn't work either

...

var
  aSoundv : Variant;
  ...
  aSoundv := Sounds.Item[OleVariant(1)];
  aSoundv.Play;  


This is somewhat ok, but I wanted to use the COM interfaces to the sounds since they are more strongly typed. Anyways, after lots of hacking, I now got code like this :

Code:
var
  aSound : IDispatch;
  aWav : _TVSoundDXStereo;
  ...
  aSound := Sounds.Item[OleVariant(1)];
  if aSound.QueryInterface(IID__TVSoundDXStereo , aWav) = S_OK then
    aWav.Play;  

This is better, but it requires me to know that the sound I am going to play is of type TVSoundDXStereo. aWav has to be of the type _TVSoundDXStereo and the call to QueryInterface() has to use the IID__TVSoundDXStereo  interface ID. Not too flexible...

Is there a better way to do this??

----

Quote
It works, u just need to make sure that it calls SoundINit (or InitSound) only once, theres a bug when u set the SOUNDENABLE flag to true, it calls InitSound twice (do'h!)


This is wierd... when I make a call to SoundEngine.Init(), my app throws an exception when I close it. When I comment it out, it doesn't. This is this the exact opposite of how you described it!!

Yes, "strange things happen with TV objects when dealing with Delphi" ... Wink
Logged
James
Community Member
*
Posts: 883


« Reply #6 on: July 24, 2003, 03:00:25 AM »

Quote from: "sogin"
This is wierd... when I make a call to SoundEngine.Init(), my app throws an exception when I close it. When I comment it out, it doesn't. This is this the exact opposite of how you described it!!


Well, thats whats happening to the rest of us. The main problem is Delphi is more 'exact' that (for example) VB when closing down. For example, if you don`t .free and nil any objects Delphi will detect this at shut-down and do it for you.
Logged

James
[www.DeepVoodooGaming.Com (Ireland)]
sogin
Community Member
*
Posts: 5


« Reply #7 on: July 29, 2003, 05:29:42 PM »

Whoa.. this is wierd. I've found another way to get around the program shutdown error when using TVSoundEngine...

Code:
//This code generates an error when the application shuts down ...

procedure TForm1.FormCreate(Sender: TObject);
begin
  SoundEngine := CoTVSoundEngine.Create;
  SoundEngine.Init(self.Handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  SoundEngine := nil;
end;


Code:
//This code doesn't !!

procedure TForm1.FormCreate(Sender: TObject);
begin
  SoundEngine := CoTVSoundEngine.Create;
  SoundEngine.Init(self.Handle);
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  SoundEngine := nil;
  SoundEngine := CoTVSoundEngine.Create;
  SoundEngine := nil;
end;


Seems that when I re-create the SoundEngine object but don't call SoundEngine.Init(), it will suppress the shutdown error message. Wierd, wierd ...  :wink:
Logged
sury
Community Member
*
Posts: 200


« Reply #8 on: August 03, 2003, 02:42:58 AM »

Quote
Whoa.. this is wierd. I've found another way to get around the program shutdown error when using TVSoundEngine...

This is interesting  ..thanks sogin..i was looking for some kind of workaround too..it is impermissible to have any kind of commercial application which throws exceptions like hell.. Cheesy
BTW I've noticed that these "minimize , form lost focus" exceptions only occured when Delphi dealing with the Final 6.0... ..RC3 works without having any trouble so i guess it will be pretty easy for TV team to fix this issue

Smooth coding....
Logged
James
Community Member
*
Posts: 883


« Reply #9 on: August 04, 2003, 03:37:56 AM »

My work around was to implement my own DirectSound Engine  :lol:
Logged

James
[www.DeepVoodooGaming.Com (Ireland)]
ux3zsh
Community Member
*
Posts: 7


« Reply #10 on: July 14, 2007, 09:06:06 AM »

my way

http://www.truevision3d.com/phpBB2/viewtopic.php?p=108549&sid=b95f4165330f528f8e12be942aa12db2#108549
Logged

china user, english is poor, i hope you understand what i said.
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.3 | SMF © 2006-2007, Simple Machines LLC
Seo4Smf v0.2 © Webmaster's Talks