Mercurial > sdl-ios-xcode
comparison src/haptic/linux/SDL_syshaptic.c @ 2526:2d88b82ce781 gsoc2008_force_feedback
More documentation.
SDL_HapticPeriodic.phase now should make sense.
More explicit if you try to update an effect type.
author | Edgar Simo <bobbens@gmail.com> |
---|---|
date | Fri, 18 Jul 2008 08:00:16 +0000 |
parents | 1a55848ce198 |
children | 22ce87690b41 |
comparison
equal
deleted
inserted
replaced
2525:1fb3fba13a2c | 2526:2d88b82ce781 |
---|---|
491 * Values above 32767 (for unsigned) are unspecified so we must clamp. | 491 * Values above 32767 (for unsigned) are unspecified so we must clamp. |
492 */ | 492 */ |
493 static int | 493 static int |
494 SDL_SYS_ToFFEffect( struct ff_effect * dest, SDL_HapticEffect * src ) | 494 SDL_SYS_ToFFEffect( struct ff_effect * dest, SDL_HapticEffect * src ) |
495 { | 495 { |
496 Uint32 tmp; | |
496 SDL_HapticConstant *constant; | 497 SDL_HapticConstant *constant; |
497 SDL_HapticPeriodic *periodic; | 498 SDL_HapticPeriodic *periodic; |
498 SDL_HapticCondition *condition; | 499 SDL_HapticCondition *condition; |
499 SDL_HapticRamp *ramp; | 500 SDL_HapticRamp *ramp; |
500 | 501 |
561 else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN) | 562 else if (periodic->type == SDL_HAPTIC_SAWTOOTHDOWN) |
562 dest->u.periodic.waveform = FF_SAW_DOWN; | 563 dest->u.periodic.waveform = FF_SAW_DOWN; |
563 dest->u.periodic.period = CLAMP(periodic->period); | 564 dest->u.periodic.period = CLAMP(periodic->period); |
564 dest->u.periodic.magnitude = periodic->magnitude; | 565 dest->u.periodic.magnitude = periodic->magnitude; |
565 dest->u.periodic.offset = periodic->offset; | 566 dest->u.periodic.offset = periodic->offset; |
566 dest->u.periodic.phase = CLAMP(periodic->phase); | 567 /* Phase is calculated based of offset from period and then clamped. */ |
568 tmp = ((periodic->phase % 36000) * dest->u.periodic.period) / 36000; | |
569 dest->u.periodic.phase = CLAMP(tmp); | |
567 | 570 |
568 /* Envelope */ | 571 /* Envelope */ |
569 dest->u.periodic.envelope.attack_length = CLAMP(periodic->attack_length); | 572 dest->u.periodic.envelope.attack_length = CLAMP(periodic->attack_length); |
570 dest->u.periodic.envelope.attack_level = CLAMP(periodic->attack_level); | 573 dest->u.periodic.envelope.attack_level = CLAMP(periodic->attack_level); |
571 dest->u.periodic.envelope.fade_length = CLAMP(periodic->fade_length); | 574 dest->u.periodic.envelope.fade_length = CLAMP(periodic->fade_length); |