Gamestudio Links
Zorro Links
Newest Posts
Z9 getting Error 058
by k_ivan. 04/25/26 19:13
ZorroGPT
by TipmyPip. 04/25/26 16:09
Stooq now requires an API key
by jcl. 04/13/26 09:42
Strange "Alien" Skull created with >Knubber<
by NeoDumont. 04/10/26 18:58
400 free seamless texture pack downl. here !
by NeoDumont. 04/08/26 19:55
AUM Magazine
Latest Screens
Dorifto samurai
Shadow 2
Rocker`s Revenge
Stug 3 Stormartillery
Who's Online Now
1 registered members (AndrewAMD), 3,675 guests, and 8 spiders.
Key: Admin, Global Mod, Mod
Newest Members
valino, juergenwue, VladMak, Geir, ondrej
19209 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
ptr_for_handle not working with SOUND* #309593
02/10/10 05:52
02/10/10 05:52
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Hi,

it seems that there's a problem when using ptr_for_handle with SOUND* objects.

Please take a look at this little prg:

Code:
#include <default.c>
#include <acknex.h> // Pure Mode

void main() {	 		
		
	video_mode = 8;	
	video_depth = 32;
	video_screen = 2;
					
	level_load(NULL);		
	wait(1);
	
	SOUND* snd = snd_create("cricket.ogg");
		
	if (ptr_for_handle(handle(snd)) == NULL) {
		diag("\nptr_for_handle returns NULL");
	}
	
	snd_loop(snd, 100, 0);
	
	while (1) {
		wait(1);
	}
	
}



This always prints me "ptr_for_handle returns NULL" either with an ogg or with a wav file, but the sound is played without any problem (so no problem with snd_create).

You can check it yourself here:

www.infinite-dreams.de/3dgs/ptrForHandle-issue.rar

Regards,
Pegamode.

Re: ptr_for_handle not working with SOUND* [Re: pegamode] #309601
02/10/10 07:54
02/10/10 07:54
Joined: Sep 2003
Posts: 9,859
F
FBL Offline
Senior Expert
FBL  Offline
Senior Expert
F

Joined: Sep 2003
Posts: 9,859
Are you still supposed to use handle/ptr_for_handle in Lite-C?
Possibly it needs some explicit cast to var, but I haven'T used it for a long time...

Re: ptr_for_handle not working with SOUND* [Re: FBL] #309603
02/10/10 08:11
02/10/10 08:11
Joined: Jul 2000
Posts: 28,094
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,094
Frankfurt
Thanks for the report! This was indeed a bug.

Re: ptr_for_handle not working with SOUND* [Re: jcl] #309605
02/10/10 08:15
02/10/10 08:15
Joined: Feb 2006
Posts: 1,011
Germany
pegamode Offline OP
Serious User
pegamode  Offline OP
Serious User

Joined: Feb 2006
Posts: 1,011
Germany
Is there any workaround I could use until it is fixed?
Maybe some kind of mem_cpy?

Re: ptr_for_handle not working with SOUND* [Re: pegamode] #309606
02/10/10 08:18
02/10/10 08:18
Joined: Jul 2000
Posts: 28,094
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 28,094
Frankfurt
Unfortunately not. The SOUND object was just forgotten in the list of objects to return a pointer to. This is a very ancient bug, from A5 days - apparently no one has used SOUND handles so far. Until this is fixed, you can use the SOUND pointer only, but not the SOUND handle.


Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1