Fix some issues with sound device code
This commit is contained in:
parent
5dc00eb4ce
commit
1e6bde9da1
|
|
@ -60,8 +60,6 @@ int sounddev_engine_update(SimDevice* this, SimData* simdata)
|
||||||
|
|
||||||
double effect = ((double)simdata->rpms/60)/((double)simdata->maxrpm/60);
|
double effect = ((double)simdata->rpms/60)/((double)simdata->maxrpm/60);
|
||||||
modulate(sounddevice, effect, sounddevice->modulationType);
|
modulate(sounddevice, effect, sounddevice->modulationType);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int sounddev_tyreslip_update(SimDevice* this, SimData* simdata)
|
int sounddev_tyreslip_update(SimDevice* this, SimData* simdata)
|
||||||
|
|
@ -73,12 +71,15 @@ int sounddev_tyreslip_update(SimDevice* this, SimData* simdata)
|
||||||
|
|
||||||
if (effect > 0)
|
if (effect > 0)
|
||||||
{
|
{
|
||||||
effect = modulate(sounddevice, effect, sounddevice->modulationType);
|
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
||||||
|
sounddevice->sounddata.curr_amplitude = sounddevice->sounddata.amplitude;
|
||||||
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
||||||
|
effect = modulate(sounddevice, effect, sounddevice->modulationType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = 0;
|
sounddevice->sounddata.curr_frequency = 0;
|
||||||
|
sounddevice->sounddata.curr_amplitude = 0;
|
||||||
sounddevice->sounddata.curr_duration = 0;
|
sounddevice->sounddata.curr_duration = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -94,11 +95,14 @@ int sounddev_tyrelock_update(SimDevice* this, SimData* simdata)
|
||||||
if (play > 0)
|
if (play > 0)
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
||||||
|
sounddevice->sounddata.curr_amplitude = sounddevice->sounddata.amplitude;
|
||||||
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
||||||
|
modulate(sounddevice, play, sounddevice->modulationType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = 0;
|
sounddevice->sounddata.curr_frequency = 0;
|
||||||
|
sounddevice->sounddata.curr_amplitude = 0;
|
||||||
sounddevice->sounddata.curr_duration = 0;
|
sounddevice->sounddata.curr_duration = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -112,11 +116,14 @@ int sounddev_absbrakes_update(SimDevice* this, SimData* simdata)
|
||||||
if (play > 0)
|
if (play > 0)
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
||||||
|
sounddevice->sounddata.curr_amplitude = sounddevice->sounddata.amplitude;
|
||||||
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
||||||
|
modulate(sounddevice, play, sounddevice->modulationType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = 0;
|
sounddevice->sounddata.curr_frequency = 0;
|
||||||
|
sounddevice->sounddata.curr_amplitude = 0;
|
||||||
sounddevice->sounddata.curr_duration = 0;
|
sounddevice->sounddata.curr_duration = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -133,8 +140,8 @@ int sounddev_suspension_update(SimDevice* this, SimData* simdata)
|
||||||
{
|
{
|
||||||
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
sounddevice->sounddata.curr_frequency = sounddevice->sounddata.frequency;
|
||||||
sounddevice->sounddata.curr_amplitude = sounddevice->sounddata.amplitude;
|
sounddevice->sounddata.curr_amplitude = sounddevice->sounddata.amplitude;
|
||||||
effect = modulate(sounddevice, effect, sounddevice->modulationType);
|
|
||||||
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
sounddevice->sounddata.curr_duration = sounddevice->sounddata.duration;
|
||||||
|
effect = modulate(sounddevice, effect, sounddevice->modulationType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -224,6 +231,13 @@ int sounddev_init(SoundDevice* sounddevice, const char* devname, MonocoqueTyreId
|
||||||
case (EFFECT_ABSBRAKES):
|
case (EFFECT_ABSBRAKES):
|
||||||
streamname = "ABS";
|
streamname = "ABS";
|
||||||
break;
|
break;
|
||||||
|
case (EFFECT_SUSPENSION):
|
||||||
|
streamname = "Suspension";
|
||||||
|
break;
|
||||||
|
case (EFFECT_ENGINERPM):
|
||||||
|
default:
|
||||||
|
streamname = "Engine";
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue