aubio_wavetable_t *new_aubio_wavetable(uint_t samplerate, uint_t blocksize) { uint_t i = 0; aubio_wavetable_t *s = AUBIO_NEW(aubio_wavetable_t); if ((sint_t)samplerate <= 0) { AUBIO_ERR("Can not create wavetable with samplerate %d\n", samplerate); goto beach; } s->samplerate = samplerate; s->blocksize = blocksize; s->wavetable_length = WAVETABLE_LEN; s->wavetable = new_fvec(s->wavetable_length + 3); for (i = 0; i < s->wavetable_length; i++) { s->wavetable->data[i] = SIN(TWO_PI * i / (smpl_t) s->wavetable_length ); } s->wavetable->data[s->wavetable_length] = s->wavetable->data[0]; s->wavetable->data[s->wavetable_length + 1] = s->wavetable->data[1]; s->wavetable->data[s->wavetable_length + 2] = s->wavetable->data[2]; s->playing = 0; s->last_pos = 0.; s->freq = new_aubio_parameter( 0., s->samplerate / 2., 10 ); s->amp = new_aubio_parameter( 0., 1., 100 ); return s; beach: AUBIO_FREE(s); return NULL; }
int lfoset(CSOUND *csound, LFO *p) { /* Types: 0: sine 1: triangles 2: square (biplar) 3: square (unipolar) 4: saw-tooth 5: saw-tooth(down) */ int type = (int)*p->type; if (type == 0) { /* Sine wave so need to create */ int i; if (p->auxd.auxp==NULL) { csound->AuxAlloc(csound, sizeof(MYFLT)*4097L, &p->auxd); p->sine = (MYFLT*)p->auxd.auxp; } for (i=0; i<4096; i++) p->sine[i] = SIN(TWOPI_F*(MYFLT)i/FL(4096.0)); /* csound->Message(csound,"Table set up (max is %d)\n", MAXPHASE>>10); */ } else if (UNLIKELY(type>5 || type<0)) { return csound->InitError(csound, Str("LFO: unknown oscilator type %d"), type); } p->lasttype = type; p->phs = 0; return OK; }
void DCT::calcDCTI(float *data) { int n = 1 << _bits; float next = -0.5f * (data[0] - data[n]); for (int i = 0; i < (n / 2); i++) { float tmp1 = data[i ]; float tmp2 = data[n - i]; float s = SIN(n, 2 * i); float c = COS(n, 2 * i); c *= tmp1 - tmp2; s *= tmp1 - tmp2; next += c; tmp1 = (tmp1 + tmp2) * 0.5f; data[i ] = tmp1 - s; data[n - i] = tmp1 + s; } _rdft->calc(data); data[n] = data[1]; data[1] = next; for (int i = 3; i <= n; i += 2) data[i] = data[i - 2] - data[i]; }
static void ff_dct_calc_III_c(DCTContext *ctx, FFTSample *data) { int n = 1 << ctx->nbits; int i; float next = data[n - 1]; float inv_n = 1.0f / n; for (i = n - 2; i >= 2; i -= 2) { float val1 = data[i]; float val2 = data[i - 1] - data[i + 1]; float c = COS(ctx, n, i); float s = SIN(ctx, n, i); data[i] = c * val1 + s * val2; data[i + 1] = s * val1 - c * val2; } data[1] = 2 * next; ctx->rdft.rdft_calc(&ctx->rdft, data); for (i = 0; i < n / 2; i++) { float tmp1 = data[i] * inv_n; float tmp2 = data[n - i - 1] * inv_n; float csc = ctx->csc2[i] * (tmp1 - tmp2); tmp1 += tmp2; data[i] = tmp1 + csc; data[n - i - 1] = tmp1 - csc; } }
void aubio_fft_get_imag(cvec_t * spectrum, fvec_t * compspec) { uint_t i; for (i = 1; i < ( compspec->length + 1 ) / 2 /*- 1 + 1*/; i++) { compspec->data[compspec->length - i] = spectrum->norm[i]*SIN(spectrum->phas[i]); } }
void spRegionAttachment_updateOffset (spRegionAttachment* self) { float regionScaleX = self->width / self->regionOriginalWidth * self->scaleX; float regionScaleY = self->height / self->regionOriginalHeight * self->scaleY; float localX = -self->width / 2 * self->scaleX + self->regionOffsetX * regionScaleX; float localY = -self->height / 2 * self->scaleY + self->regionOffsetY * regionScaleY; float localX2 = localX + self->regionWidth * regionScaleX; float localY2 = localY + self->regionHeight * regionScaleY; float radians = self->rotation * DEG_RAD; float cosine = COS(radians), sine = SIN(radians); float localXCos = localX * cosine + self->x; float localXSin = localX * sine; float localYCos = localY * cosine + self->y; float localYSin = localY * sine; float localX2Cos = localX2 * cosine + self->x; float localX2Sin = localX2 * sine; float localY2Cos = localY2 * cosine + self->y; float localY2Sin = localY2 * sine; self->offset[SP_VERTEX_X1] = localXCos - localYSin; self->offset[SP_VERTEX_Y1] = localYCos + localXSin; self->offset[SP_VERTEX_X2] = localXCos - localY2Sin; self->offset[SP_VERTEX_Y2] = localY2Cos + localXSin; self->offset[SP_VERTEX_X3] = localX2Cos - localY2Sin; self->offset[SP_VERTEX_Y3] = localY2Cos + localX2Sin; self->offset[SP_VERTEX_X4] = localX2Cos - localYSin; self->offset[SP_VERTEX_Y4] = localYCos + localX2Sin; }
void DCT::calcDSTI(float *data) { int n = 1 << _bits; data[0] = 0; for (int i = 1; i < (n / 2); i++) { float tmp1 = data[i ]; float tmp2 = data[n - i]; float s = SIN(n, 2 * i); s *= tmp1 + tmp2; tmp1 = (tmp1 - tmp2) * 0.5; data[i ] = s + tmp1; data[n - i] = s - tmp1; } data[n / 2] *= 2; _rdft->calc(data); data[0] *= 0.5; for (int i = 1; i < (n - 2); i += 2) { data[i + 1] += data[i - 1]; data[i ] = -data[i + 2]; } data[n - 1] = 0; }
static void ff_dst_calc_I_c(DCTContext *ctx, FFTSample *data) { int n = 1 << ctx->nbits; int i; data[0] = 0; for (i = 1; i < n / 2; i++) { float tmp1 = data[i ]; float tmp2 = data[n - i]; float s = SIN(ctx, n, 2 * i); s *= tmp1 + tmp2; tmp1 = (tmp1 - tmp2) * 0.5f; data[i] = s + tmp1; data[n - i] = s - tmp1; } data[n / 2] *= 2; ctx->rdft.rdft_calc(&ctx->rdft, data); data[0] *= 0.5f; for (i = 1; i < n - 2; i += 2) { data[i + 1] += data[i - 1]; data[i] = -data[i + 2]; } data[n - 1] = 0; }
static void ff_dct_calc_I_c(DCTContext *ctx, FFTSample *data) { int n = 1 << ctx->nbits; int i; float next = -0.5f * (data[0] - data[n]); for (i = 0; i < n / 2; i++) { float tmp1 = data[i]; float tmp2 = data[n - i]; float s = SIN(ctx, n, 2 * i); float c = COS(ctx, n, 2 * i); c *= tmp1 - tmp2; s *= tmp1 - tmp2; next += c; tmp1 = (tmp1 + tmp2) * 0.5f; data[i] = tmp1 - s; data[n - i] = tmp1 + s; } ctx->rdft.rdft_calc(&ctx->rdft, data); data[n] = data[1]; data[1] = next; for (i = 3; i <= n; i += 2) data[i] = data[i - 2] - data[i]; }
void spTransformConstraint_apply (spTransformConstraint* self) { float rotateMix = self->rotateMix, translateMix = self->translateMix, scaleMix = self->scaleMix, shearMix = self->shearMix; spBone* target = self->target; float ta = target->a, tb = target->b, tc = target->c, td = target->d; int i; for (i = 0; i < self->bonesCount; ++i) { spBone* bone = self->bones[i]; if (rotateMix > 0) { float a = bone->a, b = bone->b, c = bone->c, d = bone->d; float r = ATAN2(tc, ta) - ATAN2(c, a) + self->data->offsetRotation * DEG_RAD; float cosine, sine; if (r > PI) r -= PI2; else if (r < -PI) r += PI2; r *= rotateMix; cosine = COS(r); sine = SIN(r); CONST_CAST(float, bone->a) = cosine * a - sine * c; CONST_CAST(float, bone->b) = cosine * b - sine * d; CONST_CAST(float, bone->c) = sine * a + cosine * c; CONST_CAST(float, bone->d) = sine * b + cosine * d; } if (translateMix > 0) { float x, y; spBone_localToWorld(target, self->data->offsetX, self->data->offsetY, &x, &y); CONST_CAST(float, bone->worldX) += (x - bone->worldX) * translateMix; CONST_CAST(float, bone->worldY) += (y - bone->worldY) * translateMix; }
int esweep_imag(esweep_object *obj) { /* UNTESTED */ Complex *cpx; Polar *polar; int i; ESWEEP_OBJ_NOTEMPTY(obj, ERR_EMPTY_OBJECT); switch (obj->type) { case COMPLEX: cpx=(Complex*) obj->data; for (i=0; i<obj->size; i++) cpx[i].real=0; break; case POLAR: polar=(Polar*) obj->data; cpx=(Complex*) polar; for (i=0; i<obj->size; i++) { cpx[i].imag=polar[i].abs*SIN(polar[i].arg); cpx[i].real=0; } obj->type=COMPLEX; break; default: ESWEEP_NOT_THIS_TYPE(obj->type, ERR_NOT_ON_THIS_TYPE); } ESWEEP_ASSERT(correctFpException(obj), ERR_FP); return ERR_OK; }
static void DrawSpans(UBYTE *bpl) { UBYTE *frame = anim->frame[anim->current]; WORD f = normfx(SIN(frameCount * 32) * 48); WORD n = anim->height; WORD stride = screen->bytesPerRow; WaitBlitter(); while (--n >= 0) { WORD m = *frame++; while (--m >= 0) { WORD x = *frame++; x += f; bset(bpl + (x >> 3), ~x); } bpl += stride; } anim->current++; if (anim->current >= anim->count) anim->current -= anim->count; }
Vector3D Vector3D::rotateAroundAxis(const Vector3D& axis, const Angle& theta) const { const double u = axis._x; const double v = axis._y; const double w = axis._z; // const double cosTheta = theta.cosinus(); // const double sinTheta = theta.sinus(); const double cosTheta = COS(theta._radians); const double sinTheta = SIN(theta._radians); const double ms = axis.squaredLength(); const double m = IMathUtils::instance()->sqrt(ms); return Vector3D( ((u * (u * _x + v * _y + w * _z)) + (((_x * (v * v + w * w)) - (u * (v * _y + w * _z))) * cosTheta) + (m * ((-w * _y) + (v * _z)) * sinTheta)) / ms, ((v * (u * _x + v * _y + w * _z)) + (((_y * (u * u + w * w)) - (v * (u * _x + w * _z))) * cosTheta) + (m * ((w * _x) - (u * _z)) * sinTheta)) / ms, ((w * (u * _x + v * _y + w * _z)) + (((_z * (u * u + v * v)) - (w * (u * _x + v * _y))) * cosTheta) + (m * (-(v * _x) + (u * _y)) * sinTheta)) / ms ); }
Vec2 Vec2::rotateBy(REAL angle) const { REAL c,s; c=COS(angle); s=SIN(angle); return Vec2(x*c-y*s,y*c+x*s); }
void DCT::calcDCTIII(float *data) { int n = 1 << _bits; float next = data[n - 1]; float inv_n = 1.0 / n; for (int i = n - 2; i >= 2; i -= 2) { float val1 = data[i ]; float val2 = data[i - 1] - data[i + 1]; float c = COS(n, i); float s = SIN(n, i); data[i ] = c * val1 + s * val2; data[i + 1] = s * val1 - c * val2; } data[1] = 2 * next; _rdft->calc(data); for (int i = 0; i < (n / 2); i++) { float tmp1 = data[i ] * inv_n; float tmp2 = data[n - i - 1] * inv_n; float csc = _csc2[i] * (tmp1 - tmp2); tmp1 += tmp2; data[i ] = tmp1 + csc; data[n - i - 1] = tmp1 - csc; } }
/** * gnome_vfs_address_get_sockaddr: * @address: A #GnomeVFSAddress * @port: A valid port in host byte order to set in the returned sockaddr * structure. * @len: A pointer to an int which will contain the length of the * return sockaddr structure. * * This function tanslates @address into a equivalent * sockaddr structure. The port specified at @port will * be set in the structure and @len will be set to the length * of the structure. * * * Return value: A newly allocated sockaddr structure the caller must free * or %NULL if @address did not point to a valid #GnomeVFSAddress. **/ struct sockaddr * gnome_vfs_address_get_sockaddr (GnomeVFSAddress *address, guint16 port, int *len) { struct sockaddr *sa; g_return_val_if_fail (address != NULL, NULL); sa = g_memdup (address->sa, SA_SIZE (address->sa)); switch (address->sa->sa_family) { #ifdef ENABLE_IPV6 case AF_INET6: SIN6 (sa)->sin6_port = g_htons (port); if (len != NULL) { *len = SIN6_LEN; } break; #endif case AF_INET: SIN (sa)->sin_port = g_htons (port); if (len != NULL) { *len = SIN_LEN; } break; } return sa; }
/** * gnome_vfs_address_to_string: * @address: A pointer to a #GnomeVFSAddress * * Translate @address to a printable string. * * Returns: A newly alloced string representation of @address which * the caller must free. * * Since: 2.8 **/ char * gnome_vfs_address_to_string (GnomeVFSAddress *address) { #ifdef G_OS_WIN32 char text_addr[100]; DWORD text_length = sizeof (text_addr); if (WSAAddressToString (address->sa, SA_SIZE (address->sa), NULL, text_addr, &text_length) == 0) return g_strdup (text_addr); return NULL; #else const char *text_addr; #ifdef HAVE_INET_NTOP char buf[MAX_ADDRSTRLEN]; #endif g_return_val_if_fail (address != NULL, NULL); text_addr = NULL; switch (address->sa->sa_family) { #if defined (ENABLE_IPV6) && defined (HAVE_INET_NTOP) case AF_INET6: text_addr = inet_ntop (AF_INET6, &SIN6 (address->sa)->sin6_addr, buf, sizeof (buf)); break; #endif case AF_INET: #if HAVE_INET_NTOP text_addr = inet_ntop (AF_INET, &SIN (address->sa)->sin_addr, buf, sizeof (buf)); #else text_addr = inet_ntoa (SIN (address->sa)->sin_addr); #endif /* HAVE_INET_NTOP */ break; } return text_addr != NULL ? g_strdup (text_addr) : NULL; #endif }
void adjust_speed(FLOAT *speedx, FLOAT *speedy, double adjust) { double angle; angle = ATAN2(*speedy, *speedx); *speedx += (FLOAT)(adjust * COS(angle)); *speedy += (FLOAT)(adjust * SIN(angle)); }
void SimulatorStereoDisplay (void) { float fltEyeX, fltEyeY, fltEyeZ, fltCenterX, fltCenterY, fltCenterZ; glDrawBuffer(GL_BACK_LEFT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glDrawBuffer(GL_BACK_RIGHT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glViewport (0, 0, (GLsizei) g_nSimulatorWindowWidth, (GLsizei) g_nSimulatorWindowHeight); glMatrixMode (GL_PROJECTION); glLoadIdentity (); gluPerspective (g_fltSimulatorFovy, (float) g_nSimulatorWindowWidth / (float) g_nSimulatorWindowHeight, g_fltSimulatorNear, g_fltSimulatorFar); glMatrixMode (GL_MODELVIEW); glLoadIdentity (); glDrawBuffer (GL_BACK_LEFT); fltEyeX = g_pRobot->position.x + g_pRobot->leftEye->position.z * SIN (g_pRobot->rotation.z * M_PI / 180.0) + g_pRobot->leftEye->position.x * COS (g_pRobot->rotation.z * M_PI / 180.0); fltEyeY = g_pRobot->position.y + g_pRobot->leftEye->position.y; fltEyeZ = g_pRobot->position.z + g_pRobot->leftEye->position.z * COS (g_pRobot->rotation.z * M_PI / 180.0) - g_pRobot->leftEye->position.x * SIN (g_pRobot->rotation.z * M_PI / 180.0); fltCenterX = fltEyeX + SIN (g_pRobot->rotation.z * M_PI / 180.0); fltCenterY = fltEyeY; fltCenterZ = fltEyeZ + COS (g_pRobot->rotation.z * M_PI / 180.0); gluLookAt (fltEyeX,fltEyeY, fltEyeZ, fltCenterX, fltCenterY, fltCenterZ, 0.0, 1.0, 0.0); g_pTerrain->Draw (); g_pTarget->Draw (); glDrawBuffer (GL_BACK_RIGHT); fltEyeX = g_pRobot->position.x + g_pRobot->rightEye->position.z * SIN (g_pRobot->rotation.z * M_PI / 180.0) + g_pRobot->rightEye->position.x * COS (g_pRobot->rotation.z * M_PI / 180.0); fltEyeY = g_pRobot->position.y + g_pRobot->rightEye->position.y; fltEyeZ = g_pRobot->position.z + g_pRobot->rightEye->position.z * COS (g_pRobot->rotation.z * M_PI / 180.0) - g_pRobot->rightEye->position.x * SIN (g_pRobot->rotation.z * M_PI / 180.0); fltCenterX = fltEyeX + SIN (g_pRobot->rotation.z * M_PI / 180.0); fltCenterY = fltEyeY; fltCenterZ = fltEyeZ + COS (g_pRobot->rotation.z * M_PI / 180.0); gluLookAt (fltEyeX,fltEyeY, fltEyeZ, fltCenterX, fltCenterY, fltCenterZ, 0.0, 1.0, 0.0); g_pTerrain->Draw (); g_pTarget->Draw (); glutSwapBuffers(); return; }
coord polartorect(int radius, int degrees) { coord cc; cc.x = radius * COS(degrees); cc.y = radius * SIN(degrees); return cc; }
void points_arc(Arc a, int *sx, int *sy, int *ex, int *ey) { int cx = valInt(a->position->x); int cy = valInt(a->position->y); float start = valReal(a->start_angle); float size = valReal(a->size_angle); if ( sx ) *sx = cx + rfloat((float) valInt(a->size->w) * COS(start)); if ( sy ) *sy = cy - rfloat((float) valInt(a->size->h) * SIN(start)); if ( ex ) *ex = cx + rfloat((float) valInt(a->size->w) * COS(start + size)); if ( ey ) *ey = cy - rfloat((float) valInt(a->size->h) * SIN(start + size)); }
void init (char **argv) { int argc = 0; while (argv[++argc]); if (3 > argc) usage(argv[0]); /* convert degrees to rotation matrix and store for later */ theta = strtold(argv[1], NULL) * M_PI / 180; theta = COS(theta) + SIN(theta) * I; real_sample = (sampler())get_sampler(&argv[2]); }
Bool AnimateObject(object_node *obj, int dt) { Bool need_redraw = False; list_type over_list; if (OF_FLICKERING == (OF_FLICKERING & obj->flags)) { obj->lightAdjust = rand() % FLICKER_LEVEL; need_redraw = TRUE; } if (OF_FLASHING == (OF_FLASHING & obj->flags)) { DWORD angleFlash; obj->bounceTime += min(dt,50); if (obj->bounceTime > TIME_FLASH) obj->bounceTime -= TIME_FLASH; angleFlash = NUMDEGREES * obj->bounceTime / TIME_FLASH; obj->lightAdjust = FIXED_TO_INT(fpMul(FLASH_LEVEL, SIN(angleFlash))); need_redraw = TRUE; } if (obj->animate->animation != ANIMATE_NONE) { object_bitmap_type obj_bmap; obj_bmap = FindObjectBitmap(obj->icon_res); if (obj_bmap != NULL) need_redraw |= AnimateSingle(obj->animate, BitmapsNumGroups(obj_bmap->bmaps), dt); } if (OF_PHASING == (OF_PHASING & obj->flags)) { int anglePhase; obj->phaseTime += min(dt,40); if (obj->phaseTime > TIME_FULL_OBJECT_PHASE) obj->phaseTime -= TIME_FULL_OBJECT_PHASE; anglePhase = numPhases * obj->phaseTime / TIME_FULL_OBJECT_PHASE; obj->drawingtype = phaseStates[anglePhase]; need_redraw = TRUE; } // Animate object's overlays for (over_list = *(obj->overlays); over_list != NULL; over_list = over_list->next) { object_bitmap_type obj_bmap; Overlay *overlay = (Overlay *) (over_list->data); if (overlay->animate.animation == ANIMATE_NONE) continue; obj_bmap = FindObjectBitmap(overlay->icon_res); if (obj_bmap != NULL) { need_redraw |= AnimateSingle(&overlay->animate, BitmapsNumGroups(obj_bmap->bmaps), dt); } } return need_redraw; }
void pmove(void) { int i,j; double dir, dx,dy ; if (rotcore) for (j =0; j < 4; j++) for (i =0; i < 4; i++) { dir =(atan2((double) (planets[pl_core[j][i]].pl_y - planets[pl_home[j]].pl_y), (double) (planets[pl_core[j][i]].pl_x - planets[pl_home[j]].pl_x)) ); if (dir > pi) dir = dir - 2.0*pi; if (dir >= 0.0) dir = (dir*incrementrecip+1.5); else dir = (dir*incrementrecip+0.5); planets[pl_core[j][i]].pl_x = planets[pl_home[j]].pl_x + pl_dist1[j][i] * COS(dir); planets[pl_core[j][i]].pl_y = planets[pl_home[j]].pl_y + pl_dist1[j][i] * SIN(dir); dx = (double) (planets[pl_core[j][i]].pl_x - GWIDTH/2); dy = (double) (GWIDTH/2 - planets[pl_core[j][i]].pl_y); pl_dist[i] = sqrt(dx * dx + dy * dy); planets[pl_core[j][i]].pl_flags |= PLREDRAW; } if (rotall) for (i = 0; i < MAXPLANETS; i++) { dir = atan2((double) (planets[i].pl_y - GWIDTH/2), (double) (planets[i].pl_x - GWIDTH/2)); /* printf("Atan2 Dir is %f (%d,%d).\n", dir, planets[i].pl_x, planets[i].pl_y);*/ if (dir > pi) dir = dir - 2.0*pi; /* printf("dir = %f, dir*100 = %f, rint() = %f. %f = %d.\n", dir, dir*100.0, rint(dir*100.0), rint(dir*100.0+1.5), (int) (rint(dir*100.0) + 1.0));*/ if (dir >= 0.0) dir = (dir*incrementrecip+1.5); else dir = (dir*incrementrecip+0.5); planets[i].pl_x = GWIDTH/2 + (int) (pl_dist[i] * COS(dir)); planets[i].pl_y = GWIDTH/2 + (int) (pl_dist[i] * SIN(dir)); planets[i].pl_flags |= PLREDRAW; } }
int main() { double a, r; a = __VERIFIER_nondet_double(); __VERIFIER_assume(a >= -1e10 && a <= 1e10); r = SIN(a); return 0; }
void SinSampler::sample(long* result, long sample, long nsamples) { long max_sample = MIN(END(this), sample + nsamples); nsamples = max_sample - sample; sample = sampler_offset(this, sample); for(int ii = 0; ii < nsamples; ++ii) { result[ii] += amp * SIN(phase + radians_per_sample * (sample + ii)); } }
int vibraphnset(CSOUND *csound, VIBRAPHN *p) { Modal4 *m = &(p->m4); MYFLT temp; FUNC *ftp; if (LIKELY((ftp = csound->FTnp2Find(csound, p->ifn)) != NULL)) p->m4.wave = ftp; /* Expect an impulslything */ else { return csound->InitError(csound, Str("No table for Vibraphone strike")); } if (UNLIKELY(make_Modal4(csound, m, p->ivfn, *p->vibAmt, *p->vibFreq)==NOTOK)) return NOTOK; p->m4.w_phaseOffset = FL(0.0); /* p->m4.w_rate = 13.33; */ OnePole_setPole(&p->m4.onepole, FL(0.2)); Modal4_setRatioAndReson(csound, m, 0, FL(1.0), FL(0.99995)); /* Set */ Modal4_setRatioAndReson(csound, m, 1, FL(2.01),FL(0.99991)); /* our */ Modal4_setRatioAndReson(csound, m, 2, FL(3.9), FL(0.99992)); /* resonance */ Modal4_setRatioAndReson(csound, m, 3,FL(14.37),FL(0.99990)); /* values here */ Modal4_setFiltGain(m, 0, FL(0.025)); Modal4_setFiltGain(m, 1, FL(0.015)); Modal4_setFiltGain(m, 2, FL(0.015)); Modal4_setFiltGain(m, 3, FL(0.015)); p->m4.directGain = FL(0.0); /* vibrGain = 0.2; */ p->m4.w_rate = FL(2.0) + (FL(22.66) * *p->hardness); p->m4.masterGain = FL(0.2) + (*p->hardness * FL(1.6)); /* Set Strike position */ temp = (p->strikePosition = *p->spos) * PI_F; BiQuad_setGain(p->m4.filters[0], FL(0.025) * SIN(temp)); BiQuad_setGain(p->m4.filters[1], FL(0.015) * SIN(FL(0.1) + (FL(2.01) * temp))); BiQuad_setGain(p->m4.filters[2], FL(0.015) * SIN(FL(3.95) * temp)); /* Strike */ Modal4_strike(csound, m, *p->amplitude * AMP_RSCALE); Modal4_setFreq(csound, m, *p->frequency); p->first = 1; return OK; }
static void DrawPlotter() { WORD i, a; WORD t = frameCount * 5; WORD da = 2 * SIN_PI / NUM; for (i = 0, a = t; i < NUM; i++, a += da) { WORD g = SIN(ARMS * a); WORD x = normfx(normfx(SIN(t + a) * g) * 96) + 96; WORD y = normfx(normfx(COS(t + a) * g) * 96) + 96; WORD f = normfx(g * 3); if (f < 0) f = -f; if ((i & 1) && (frameCount & 15) < 3) f = 7; BitmapAddSaturated(screen[active], x, y, flare[f], carry); } }
/** * gnome_vfs_address_get_ipv4: * @address: A #GnomeVFSAddress. * * Returns: The associated IPv4 address in network byte order. * * Note that you should avoid using this function because newly written * code should be protocol independent. * * Since: 2.8 **/ guint32 gnome_vfs_address_get_ipv4 (GnomeVFSAddress *address) { g_return_val_if_fail (address != NULL, 0); g_return_val_if_fail (address->sa != NULL, 0); if (address->sa->sa_family != AF_INET) return 0; return (guint32) SIN (address->sa)->sin_addr.s_addr; }
///////////////////////////////////// // Name: // Purpose: // Output: // Return: ///////////////////////////////////// PUBLIC void CameraYawPitchRoll(hCAMERA cam, angle yaw, angle pitch, angle roll) { cam->aYaw+=yaw; cam->aPitch+=pitch; cam->aRoll+=roll; float cosY,cosP,cosR, sinY,sinP,sinR; cosY = COS(cam->aYaw); sinY = SIN(cam->aYaw); cosP = COS(cam->aPitch); sinP = SIN(cam->aPitch); cosR = COS(cam->aRoll); sinR = SIN(cam->aRoll); //set up dir(fwd vect) float *dir = (float*)cam->vDir; dir[eX] = sinY*cosP; dir[eY] = sinP; dir[eZ] = cosP*-cosY; //set up look-at cam->vTarget = cam->vDir+cam->vEye; }