1 registered members (M_D),
1,501
guests, and 4
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
snd_tune !!!!
#185548
02/25/08 13:55
02/25/08 13:55
|
Joined: Dec 2007
Posts: 17
Mare
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 17
|
Hi guys!! here's the code I've got: Code:
//////////////////////////////////////////////////////// // speedometer--->>>> phent_getvelocity(me,speed,nullvector); ////////////////////////////////////////////////////////// //SOUNDS---->
speed_avrg = abs((speed.x + speed.y + speed.z)/3); var jet_s; jet_s = ent_playloop(my,jet_sound,70); var engine_s; engine_s = ent_playloop(my,engine_noise_sound,90); snd_tune(jet_s,0,speed_avrg,0);
It should pitch the sound depending on the players movement, but for some reason it doesnt work! But when I replace speed_avrg = abs((speed.x + speed.y + speed.z)/3); with a fixed value it works fine, but it doesnt do the job its soposed to Please help!
Last edited by Mare; 02/25/08 13:56.
|
|
|
Re: snd_tune !!!!
[Re: Mare]
#185549
02/25/08 14:54
02/25/08 14:54
|
Joined: Sep 2007
Posts: 67 Seevetal, Germany
Rasterbar
Junior Member
|
Junior Member
Joined: Sep 2007
Posts: 67
Seevetal, Germany
|
Hi, have you a pitch range or a min max limit ? here is a example of my code i use: Code:
... my.car_topSpeed = clamp(my.car_topSpeed,0.1,pmax_topspeed[0]);
temp = 0; if (my.car_topSpeed > 0.1) { temp = (rpm_range / pmax_topspeed[0]) - rpm_work; temp = my.car_topSpeed * temp; temp = clamp(temp,0,rpm_range); } else { my.carEngineTorque = 0; }
... rpm_range = veh_daten[19] - veh_daten[18];
eng_pitch = veh_daten[18] + temp;
eng_pitch = clamp(eng_pitch,veh_daten[18],veh_daten[19]); // min, max SND_TUNE snd_tune (enghandle1, null, eng_pitch, null); ...
mfg
|
|
|
Re: snd_tune !!!!
[Re: Mare]
#185550
02/25/08 14:57
02/25/08 14:57
|
Joined: Jul 2007
Posts: 959 nl
flits
User
|
User
Joined: Jul 2007
Posts: 959
nl
|
maby this
speed_avrg = int(abs((speed.x + speed.y + speed.z)/3));
"empty"
|
|
|
Re: snd_tune !!!!
[Re: flits]
#185551
02/25/08 15:05
02/25/08 15:05
|
Joined: Mar 2006
Posts: 2,503 SC, United States
xXxGuitar511
Expert
|
Expert
Joined: Mar 2006
Posts: 2,503
SC, United States
|
instead of using the average of your speeed values, use the length...
speed_avrg = vec_length(speed);
xXxGuitar511 - Programmer
|
|
|
Re: snd_tune !!!!
[Re: Mare]
#185553
02/25/08 16:41
02/25/08 16:41
|
Joined: Sep 2007
Posts: 67 Seevetal, Germany
Rasterbar
Junior Member
|
Junior Member
Joined: Sep 2007
Posts: 67
Seevetal, Germany
|
Hi, i use this simple code for find the right pitch: Code:
var rpm_pitch[2]; function rpm_min_1() { rpm_pitch[0] -= 1; } function rpm_min1() { rpm_pitch[0] += 1; } function rpm_max_1() { rpm_pitch[1] -= 1; } function rpm_max1() { rpm_pitch[1] += 1; }
on_cul = rpm_min_1; on_cur = rpm_min1; on_cuu = rpm_max_1; on_cud = rpm_max1;
|
|
|
Re: snd_tune !!!!
[Re: Rasterbar]
#185554
02/25/08 22:05
02/25/08 22:05
|
Joined: Dec 2007
Posts: 17
Mare
OP
Newbie
|
OP
Newbie
Joined: Dec 2007
Posts: 17
|
Hmmmmm..... The problem was that the pitch of a sound played by the ent_playloop cannot be changed during gameplay Is this a bug?
|
|
|
Re: snd_tune !!!!
[Re: Mare]
#185555
02/25/08 23:29
02/25/08 23:29
|
Joined: Sep 2007
Posts: 67 Seevetal, Germany
Rasterbar
Junior Member
|
Junior Member
Joined: Sep 2007
Posts: 67
Seevetal, Germany
|
Hi, this is my sound init and no problems with a6.6com and a7.06com. Code:
... cam_ansicht = 1; // Fahrzeug Aussenansicht
eng_vol = 100; // Aktuelle Lautstaerke (Motor_Sound)
if(enghandle1 == 0) { enghandle1 = ent_playloop(my, motsnd_string_ptr[veh_daten[14]], eng_vol); } else { snd_tune (enghandle1, eng_vol, eng_pitch, null); }
rpm_pitch[0] = veh_daten[18]; rpm_pitch[1] = veh_daten[19]; ...
have you a debugpanel to show the pitch var ? write a test function and play with the pitch var, control the pitch var with keys.
|
|
|
|