comparison src/haptic/darwin/SDL_syshaptic.c @ 2531:7f2a4c387292 gsoc2008_force_feedback

Fixed some inconsistancies in coding style. Fixed embarassing mistake (I wish I could compile this locally).
author Edgar Simo <bobbens@gmail.com>
date Fri, 18 Jul 2008 18:58:47 +0000
parents 22ce87690b41
children 688cad3f6090
comparison
equal deleted inserted replaced
2530:22ce87690b41 2531:7f2a4c387292
63 struct haptic_hweffect 63 struct haptic_hweffect
64 { 64 {
65 FFEffectObjectReference ref; /* Reference. */ 65 FFEffectObjectReference ref; /* Reference. */
66 struct FFEFFECT effect; /* Hardware effect. */ 66 struct FFEFFECT effect; /* Hardware effect. */
67 }; 67 };
68
69 /*
70 * Prototypes.
71 */
72 static void SDL_SYS_HapticFreeFFEFFECT( FFEFFECT * effect );
68 73
69 74
70 /* 75 /*
71 * Initializes the haptic subsystem. 76 * Initializes the haptic subsystem.
72 */ 77 */
530 return -1; 535 return -1;
531 } 536 }
532 537
533 /* Specifics */ 538 /* Specifics */
534 for (i=0; i<dest->cAxes; i++) { 539 for (i=0; i<dest->cAxes; i++) {
535 condition[i].lOffset = CONVERT(hap_constant->center[i]); 540 condition[i].lOffset = CONVERT(hap_condition->center[i]);
536 condition[i].lPositiveCoefficient = CONVERT(hap_constant->right_coeff[i]); 541 condition[i].lPositiveCoefficient = CONVERT(hap_condition->right_coeff[i]);
537 condition[i].lNegativeCoefficient = CONVERT(hap_constant->left_coeff[i]); 542 condition[i].lNegativeCoefficient = CONVERT(hap_condition->left_coeff[i]);
538 condition[i].dwPositiveSaturation = CONVERT(hap_constant->right_sat[i]); 543 condition[i].dwPositiveSaturation = CONVERT(hap_condition->right_sat[i]);
539 condition[i].dwNegativeSaturation = CONVERT(hap_constant->left_sat[i]); 544 condition[i].dwNegativeSaturation = CONVERT(hap_condition->left_sat[i]);
540 condition[i].lDeadBand = CONVERT(hap_constant->deadband[i]); 545 condition[i].lDeadBand = CONVERT(hap_condition->deadband[i]);
541 } 546 }
542 dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes; 547 dest->cbTypeSpecificParams = sizeof(FFCONDITION) * dest->cAxes;
543 dest->lpvTypeSpecificParams = condition; 548 dest->lpvTypeSpecificParams = condition;
544 549
545 /* Generics */ 550 /* Generics */
546 dest->dwDuration = hap_constant->length * 1000; /* In microseconds. */ 551 dest->dwDuration = hap_condition->length * 1000; /* In microseconds. */
547 dest->dwTriggerButton = FFJOFS_BUTTON(hap_constant->button); 552 dest->dwTriggerButton = FFJOFS_BUTTON(hap_condition->button);
548 dest->dwTriggerRepeatInterval = hap_constant->interval; 553 dest->dwTriggerRepeatInterval = hap_condition->interval;
549 dest->dwStartDelay = hap_constant->delay * 1000; /* In microseconds. */ 554 dest->dwStartDelay = hap_condition->delay * 1000; /* In microseconds. */
550 555
551 /* Direction. */ 556 /* Direction. */
552 if (SDL_SYS_SetDirection(dest, &hap_constant->direction, dest->cAxes) < 0) { 557 if (SDL_SYS_SetDirection(dest, &hap_condition->direction, dest->cAxes) < 0) {
553 return -1; 558 return -1;
554 } 559 }
555 560
556 /* Envelope */ 561 /* Envelope */
557 envelope->dwAttackLevel = CONVERT(hap_constant->attack_level); 562 envelope->dwAttackLevel = CONVERT(hap_condition->attack_level);
558 envelope->dwAttackTime = hap_constant->attack_length * 1000; 563 envelope->dwAttackTime = hap_condition->attack_length * 1000;
559 envelope->dwFadeLevel = CONVERT(hap_constant->fade_level); 564 envelope->dwFadeLevel = CONVERT(hap_condition->fade_level);
560 envelope->dwFadeTime = hap_constant->fade_length * 1000; 565 envelope->dwFadeTime = hap_condition->fade_length * 1000;
561 566
562 break; 567 break;
563 568
564 case SDL_HAPTIC_RAMP: 569 case SDL_HAPTIC_RAMP:
565 hap_ramp = &src->ramp; 570 hap_ramp = &src->ramp;
577 582
578 583
579 /* 584 /*
580 * Frees an FFEFFECT allocated by SDL_SYS_ToFFEFFECT. 585 * Frees an FFEFFECT allocated by SDL_SYS_ToFFEFFECT.
581 */ 586 */
582 void SDL_SYS_HapticFreeFFEFFECT( FFEFFECT * effect ) 587 static void
588 SDL_SYS_HapticFreeFFEFFECT( FFEFFECT * effect )
583 { 589 {
584 if (effect->lpEnvelope != NULL) { 590 if (effect->lpEnvelope != NULL) {
585 SDL_free(effect->lpEnvelope); 591 SDL_free(effect->lpEnvelope);
586 effect->lpEnvelope = NULL; 592 effect->lpEnvelope = NULL;
587 } 593 }
601 607
602 608
603 /* 609 /*
604 * Gets the effect type from the generic SDL haptic effect wrapper. 610 * Gets the effect type from the generic SDL haptic effect wrapper.
605 */ 611 */
606 CFUUIDRef SDL_SYS_HapticEffectType(struct haptic_effect * effect) 612 CFUUIDRef
613 SDL_SYS_HapticEffectType(struct haptic_effect * effect)
607 { 614 {
608 switch (effect->effect.type) { 615 switch (effect->effect.type) {
609 case SDL_HAPTIC_CONSTANT: 616 case SDL_HAPTIC_CONSTANT:
610 return kFFEffectType_ConstantForce_ID; 617 return kFFEffectType_ConstantForce_ID;
611 618
701 708
702 709
703 /* 710 /*
704 * Updates an effect. 711 * Updates an effect.
705 */ 712 */
706 int SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic, 713 int
714 SDL_SYS_HapticUpdateEffect(SDL_Haptic * haptic,
707 struct haptic_effect * effect, SDL_HapticEffect * data) 715 struct haptic_effect * effect, SDL_HapticEffect * data)
708 { 716 {
709 /* TODO */ 717 /* TODO */
710 return -1; 718 return -1;
711 } 719 }