Gamestudio Links
Zorro Links
Newest Posts
Help with plotting multiple ZigZag
by degenerate_762. 04/30/24 23:23
M1 Oversampling
by 11honza11. 04/30/24 08:16
Trading Journey
by howardR. 04/28/24 09:55
Zorro Trader GPT
by TipmyPip. 04/27/24 13:50
Data from CSV not parsed correctly
by jcl. 04/26/24 11:18
Why Zorro supports up to 72 cores?
by jcl. 04/26/24 11:09
Eigenwerbung
by jcl. 04/26/24 11:08
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (AndrewAMD), 568 guests, and 3 spiders.
Key: Admin, Global Mod, Mod
Newest Members
wandaluciaia, Mega_Rod, EternallyCurious, howardR, 11honza11
19049 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
crash with ent_playloop and pXent_getspeed #431154
10/10/13 08:43
10/10/13 08:43
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
I get an engine when I using ent_playsound in combination with the "pXent_getspeed" function from "car.c" in gamestudio folder ("\include\"):

What sound file you are using doesn't matter. It crashes with wav and ogg. The file is also not broken, I've tried many different sound files, even some files vom gamestudio folder.

Code:
#include <acknex.h>
#include <ackphysx.h>

SOUND* snd_test="test.wav";
var snd_hndl=0;

//this function is from /include/car.c in gamestudio folder
var pXent_getspeed(ENTITY* ent)
{
	VECTOR vSpeed,vDir;
	pXent_getvelocity(ent,vSpeed,NULL);
	vec_for_angle(vDir,ent.pan);
// speed in km/h, assume 40 quants = 1 m	
	var speed = vec_dot(vDir,vSpeed) * (60.*60.)/(40.*1000.); 
	if (abs(speed) < 1) 
		return 0;
	else 
		return speed;
}

void main()
{
	physX_open();
	level_load(NULL);
	
	ENTITY* ent_tmp=ent_create(CUBE_MDL,nullvector,NULL);
	pXent_settype(ent_tmp,PH_RIGID,PH_BOX);
	
	wait(-3);
	
	while(1)
	{
		pXent_getspeed(ent_tmp);
		
		if(!snd_playing(snd_hndl))
		{
			snd_hndl=ent_playloop(ent_tmp,snd_test,100);
		}
		
		wait(1);
	}
}


Re: crash with ent_playloop and pXent_getspeed [Re: oliver2s] #431210
10/11/13 10:23
10/11/13 10:23
Joined: Jul 2000
Posts: 27,986
Frankfurt
jcl Offline

Chief Engineer
jcl  Offline

Chief Engineer

Joined: Jul 2000
Posts: 27,986
Frankfurt
Thanks, I'll look into that. A possible reason is that snd_playing is called with a zero handle, but normally the function should then return and not crash.

Re: crash with ent_playloop and pXent_getspeed [Re: jcl] #431220
10/11/13 12:00
10/11/13 12:00
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
[EDIT]: oops, I accidently edited my post instead of creating a new one.

Last edited by oliver2s; 10/15/13 14:00.
Re: crash with ent_playloop and pXent_getspeed [Re: oliver2s] #431388
10/15/13 13:59
10/15/13 13:59
Joined: Aug 2002
Posts: 3,258
Mainz
oliver2s Offline OP
Expert
oliver2s  Offline OP
Expert

Joined: Aug 2002
Posts: 3,258
Mainz
Can you confirm the crash?

Re: crash with ent_playloop and pXent_getspeed [Re: oliver2s] #431395
10/15/13 14:58
10/15/13 14:58
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
By the way the same happens with knights_on_wheels.c sample under car_noise function by ent_playloop in car.c file.


Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P

Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | 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