Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
1 registered members (M_D), 1,501 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
firatv, wandaluciaia, Mega_Rod, EternallyCurious, howardR
19050 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
snd_tune !!!! #185548
02/25/08 13:55
02/25/08 13:55
Joined: Dec 2007
Posts: 17
Mare Offline OP
Newbie
Mare  Offline 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 Offline
Junior Member
Rasterbar  Offline
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
F
flits Offline
User
flits  Offline
User
F

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 Offline
Expert
xXxGuitar511  Offline
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: flits] #185552
02/25/08 15:13
02/25/08 15:13
Joined: Dec 2007
Posts: 17
Mare Offline OP
Newbie
Mare  Offline OP
Newbie

Joined: Dec 2007
Posts: 17
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

Re: snd_tune !!!! [Re: Mare] #185553
02/25/08 16:41
02/25/08 16:41
Joined: Sep 2007
Posts: 67
Seevetal, Germany
Rasterbar Offline
Junior Member
Rasterbar  Offline
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 Offline OP
Newbie
Mare  Offline 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 Offline
Junior Member
Rasterbar  Offline
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.

Re: snd_tune !!!! [Re: Rasterbar] #185556
02/26/08 12:47
02/26/08 12:47
Joined: Dec 2007
Posts: 17
Mare Offline OP
Newbie
Mare  Offline OP
Newbie

Joined: Dec 2007
Posts: 17
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


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

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