Gamestudio Links
Zorro Links
Newest Posts
Zorro 2.70
by jcl. 09/29/25 09:24
optimize global parameters SOLVED
by dBc. 09/27/25 17:07
ZorroGPT
by TipmyPip. 09/27/25 10:05
assetHistory one candle shift
by jcl. 09/21/25 11:36
Plugins update
by Grant. 09/17/25 16:28
AUM Magazine
Latest Screens
Rocker`s Revenge
Stug 3 Stormartillery
Iljuschin 2
Galactic Strike X
Who's Online Now
2 registered members (AndrewAMD, TipmyPip), 12,400 guests, and 5 spiders.
Key: Admin, Global Mod, Mod
Newest Members
krishna, DrissB, James168, Ed_Love, xtns
19168 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
Page 2 of 2 1 2
Re: Adding Sound (Motor Sound) [Re: Dreher] #262405
04/23/09 15:18
04/23/09 15:18
Joined: Apr 2009
Posts: 113
Netherlands
D
Dreher Offline OP
Warez Victim
Dreher  Offline OP
Warez Victim
D

Joined: Apr 2009
Posts: 113
Netherlands
Hm, I'm back, but I can't figure it out how to use it yet shocked

Code:
var vSoundhandle;
var vVolume;
var vFreq;
vSoundhandle = snd_loop(sndEngine, 100, 0);
while(vEngineRunning)
{
vVolume = vCarSpeed*vVolumeFactor;
vFreq = vCarSpeed*vFreqFactor;
snd_tune(vSoundhandle, vVolume, vFreq, 0);
wait(1);
}


Where to place this and what to code should I use for letting it know which mp3 should be looped at what speed of rotation etc?

Thanks^


A7 7.77
Re: Adding Sound (Motor Sound) [Re: Dreher] #262473
04/23/09 22:01
04/23/09 22:01
Joined: Apr 2009
Posts: 113
Netherlands
D
Dreher Offline OP
Warez Victim
Dreher  Offline OP
Warez Victim
D

Joined: Apr 2009
Posts: 113
Netherlands
Well, I tried several thing with that code, but it keeps crying that vVolumeFactor, vFreq, vVolume are unknown, and I don't know what to do nor do I know where to place it exactly ><


A7 7.77
Re: Adding Sound (Motor Sound) [Re: Dreher] #262483
04/24/09 02:57
04/24/09 02:57
Joined: Jul 2008
Posts: 553
Singapore
delinkx Offline
User
delinkx  Offline
User

Joined: Jul 2008
Posts: 553
Singapore
the code above is just a pseudocode.. u need to convert it to real code. if u using lite-c i can help u out. c-script i can still help. post ur code maybe we can fix it.


A7 commercial Team / VC++ 2008 Pro
homepage | twitter | facebook
Re: Adding Sound (Motor Sound) [Re: Dreher] #262510
04/24/09 08:43
04/24/09 08:43
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
"Where to place this and what to code should I use for letting it know which mp3 should be looped at what speed of rotation etc"

You should really make the Lite-C workshop - it deals with such basics.


no science involved
Re: Adding Sound (Motor Sound) [Re: fogman] #262529
04/24/09 11:40
04/24/09 11:40
Joined: Apr 2009
Posts: 113
Netherlands
D
Dreher Offline OP
Warez Victim
Dreher  Offline OP
Warez Victim
D

Joined: Apr 2009
Posts: 113
Netherlands
Alright, I will check the workshop AGAIN but I dont think I can convert it to C-Script yet..

Code:
action bdplatte {
   var oid;
	pplatte = my;
	my.passable = on;	
	my.flare = off;
	my.transparent = off;
	my.ambient = 10;
        my.z += -15;

   
//Physik Quellcode
	phent_settype(my,PH_RIGID,PH_SPHERE);
	phent_setmass(my,60,PH_POLY);
	phent_setdamping(my,0,50);
	phent_setgroup(my,2);

	vec_set(temp.x,vector(0,0,1));
	oid = phcon_add(PH_HINGE,my,0);
	phcon_setparams1(oid,vector(my.x,my.y,my.z-20),temp.x,nullvector);
	phcon_setparams2(oid,vector(-360,360,0),nullvector,nullvector);  //Darf sich um 360 Grad drehen
	phent_setdamping(my,0,75);
   
   phent_enable(my,0);
	my.tilt = -7; //Sollte klar sein
	phent_enable(my,1);
	vec_set(temp.x,vector(0,0,1));
	vec_rotate(temp.x,vector(0,-7,0));
	phcon_setparams1(oid,vector(my.x,my.y,my.z),temp.x,nullvector);
	ph_setcorrections(100000,0.001);

	while(1) {
		phcon_setmotor(oid,vector((plattespeed*-1.20),24000000,0),nullvector,nullvector);  //Platte beschleunigen

		wait(1);
	}	
}


Code:
function plat_speed_up() {
	while((key_q) && (plattespeed > -22)) {
		plattespeed -= 0.085*time;
		
		wait(1);
	}
      plattespeed = max(plattespeed,-22);
}

function plat_speed_do() {
	while((key_a) && (plattespeed < 0)) {
		plattespeed += 0.085*time;
		
		wait(1);
	}
	   plattespeed = min(plattespeed,0);
}


This is all that has to do with the mainplatform (The entity that needs the sound when: Going faster // stays at a certain speed // Going down

So 3 sounds total!


A7 7.77
Re: Adding Sound (Motor Sound) [Re: Dreher] #262608
04/24/09 21:23
04/24/09 21:23
Joined: Apr 2009
Posts: 113
Netherlands
D
Dreher Offline OP
Warez Victim
Dreher  Offline OP
Warez Victim
D

Joined: Apr 2009
Posts: 113
Netherlands
Well, I can't find anything usefull within the Online Tutorial about something like this?!

I'm stuck..


A7 7.77
Re: Adding Sound (Motor Sound) [Re: Dreher] #262714
04/25/09 12:14
04/25/09 12:14
Joined: Apr 2005
Posts: 4,506
Germany
F
fogman Offline
Expert
fogman  Offline
Expert
F

Joined: Apr 2005
Posts: 4,506
Germany
Code:

SOUND* sndEngine = "brumm.wav"; // define your soundfile

function EngineSound()
{
   var vSoundhandle;
   var vFreq;
   vSoundhandle = snd_loop(sndEngine, 100, 0); // play sound in a loop
   while(1)
   {       
      vFreq = plattespeed*-4; // get speed, play with -4
      snd_tune(vSoundhandle, 0, vFreq, 0); // tune sound
      wait(1);
   }
}


Not tested!
Just start the function in your main:

function main()
{
... // other code
EngineSound();
... // other code
}


no science involved
Re: Adding Sound (Motor Sound) [Re: fogman] #262716
04/25/09 12:43
04/25/09 12:43
Joined: Apr 2009
Posts: 113
Netherlands
D
Dreher Offline OP
Warez Victim
Dreher  Offline OP
Warez Victim
D

Joined: Apr 2009
Posts: 113
Netherlands
It works!

Now I'm gonne have to tune the sound, but it atleast works, so thanks alot (Yet again!)


A7 7.77
Page 2 of 2 1 2

Moderated by  HeelX, Lukas, rayp, Rei_Ayanami, Superku, Tobias, TWO, VeT 

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