snd_tune !!!!

Posted By: Mare

snd_tune !!!! - 02/25/08 13:55

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!
Posted By: Rasterbar

Re: snd_tune !!!! - 02/25/08 14:54

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
Posted By: flits

Re: snd_tune !!!! - 02/25/08 14:57

maby this

speed_avrg = int(abs((speed.x + speed.y + speed.z)/3));
Posted By: xXxGuitar511

Re: snd_tune !!!! - 02/25/08 15:05

instead of using the average of your speeed values, use the length...

speed_avrg = vec_length(speed);
Posted By: Mare

Re: snd_tune !!!! - 02/25/08 15:13

No it doesnt work I have clamped the pitch value between 50 and 150 but nothing happens Please any other solutions? Flits, thaks for your input, but that doesnt work too
Posted By: Rasterbar

Re: snd_tune !!!! - 02/25/08 16:41

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;



Posted By: Mare

Re: snd_tune !!!! - 02/25/08 22:05

Hmmmmm..... The problem was that the pitch of a sound played by the ent_playloop
cannot be changed during gameplay
Is this a bug?
Posted By: Rasterbar

Re: snd_tune !!!! - 02/25/08 23:29

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.
Posted By: Mare

Re: snd_tune !!!! - 02/26/08 12:47

OMG!!!! People, it was my bad!!! I have put the ent_playloop(...); in a while() loop

I'am the most stupid creature on earth!!!

Thank you for your answers
© 2024 lite-C Forums