2 registered members (TipmyPip, AndrewAMD),
12,726
guests, and 5
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: Adding Sound (Motor Sound)
[Re: Dreher]
#262405
04/23/09 15:18
04/23/09 15:18
|
Joined: Apr 2009
Posts: 113 Netherlands
Dreher
OP
Warez Victim
|
OP
Warez Victim
Joined: Apr 2009
Posts: 113
Netherlands
|
Hm, I'm back, but I can't figure it out how to use it yet 
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
Dreher
OP
Warez Victim
|
OP
Warez Victim
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]
#262510
04/24/09 08:43
04/24/09 08:43
|
Joined: Apr 2005
Posts: 4,506 Germany
fogman
Expert
|
Expert
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
Dreher
OP
Warez Victim
|
OP
Warez Victim
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..
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);
}
}
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
Dreher
OP
Warez Victim
|
OP
Warez Victim
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
fogman
Expert
|
Expert
Joined: Apr 2005
Posts: 4,506
Germany
|
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
Dreher
OP
Warez Victim
|
OP
Warez Victim
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
|
|
|
|