void le_retirada(FILE* arq, T_Retirada* retirada) { memset(retirada, 0, sizeof(T_Retirada)); le_str(arq, &(retirada->nome)); le_str(arq, &(retirada->cnh)); le_float(arq, &(retirada->vl_diaria)); le_int(arq, &(retirada->limite_km)); le_int(arq, &(retirada->km_retirada)); le_float(arq, &(retirada->vl_km_extra)); le_str(arq, &(retirada->data_retirada)); le_boolean(arq, &(retirada->devolvido)); }
int main (int argc, char * argv[]) { const int N = 16; const int iters = 1; float *x, *y, *z; posix_memalign((void **)&x, VECTOR_SIZE, N*sizeof(float)); posix_memalign((void **)&y, VECTOR_SIZE, N*sizeof(float)); posix_memalign((void **)&z, VECTOR_SIZE, N*sizeof(float)); int i, j; for (i=0; i<N; i++) { x[i] = i; y[i] = i+1; z[i] = 0.0f; } lt_float(x, y, z, N); test((void *)z, N); gt_float(y, x, z, N); test((void *)z, N); le_float(x, y, z, N); test((void *)z, N); ge_float(y, x, z, N); test((void *)z, N); diff_float(y, x, z, N); test((void *)z, N); for (i=0; i<N; i++) { x[i] = i; y[i] = i; } eq_float(y, x, z, N); test((void *)z, N); printf("SUCCESS!\n"); return 0; }
/* * xsynth_voice_import_patch * * import a patch in old Xsynth format */ void xsynth_voice_import_patch(xsynth_patch_t *xsynth_patch, unsigned char *old_patch, int unpack_name, unsigned long bank, unsigned long program) { if (!unpack_name) { strcpy(xsynth_patch->name, "imported patch"); } /* Unpack patch data */ /* Continuous knobs */ /* VCO 1 */ xsynth_patch->osc1_pitch = le_float(old_patch + 4); xsynth_patch->osc1_pulsewidth = le_float(old_patch + 12); /* VCO 2 */ xsynth_patch->osc2_pitch = le_float(old_patch + 20); xsynth_patch->osc2_pulsewidth = le_float(old_patch + 28); /* LFO */ xsynth_patch->lfo_frequency = le_float(old_patch + 36); xsynth_patch->lfo_amount_o = le_float(old_patch + 44); xsynth_patch->lfo_amount_f = le_float(old_patch + 52); /* BALANCE */ xsynth_patch->osc_balance = le_float(old_patch + 60); /* PORTAMENTO */ /* glide_time: compensate for different control-value-recalulation rates */ xsynth_patch->glide_time = 1.0f - pow((1.0f - le_float(old_patch + 68)), (float)XSYNTH_NUGGET_SIZE / 256.0f); /* EG 1 */ xsynth_patch->eg1_attack_time = le_float(old_patch + 76); xsynth_patch->eg1_decay_time = le_float(old_patch + 84); xsynth_patch->eg1_sustain_level = le_float(old_patch + 92); xsynth_patch->eg1_release_time = le_float(old_patch + 100); xsynth_patch->eg1_vel_sens = 0.0f; xsynth_patch->eg1_amount_o = le_float(old_patch + 108); xsynth_patch->eg1_amount_f = le_float(old_patch + 116); /* EG 2 */ xsynth_patch->eg2_attack_time = le_float(old_patch + 124); xsynth_patch->eg2_decay_time = le_float(old_patch + 132); xsynth_patch->eg2_sustain_level = le_float(old_patch + 140); xsynth_patch->eg2_release_time = le_float(old_patch + 148); xsynth_patch->eg2_vel_sens = 0.0f; xsynth_patch->eg2_amount_o = le_float(old_patch + 156); xsynth_patch->eg2_amount_f = le_float(old_patch + 164); /* VCF */ xsynth_patch->vcf_cutoff = le_float(old_patch + 172); xsynth_patch->vcf_qres = 2.0f - le_float(old_patch + 180); /* VOLUME */ xsynth_patch->volume = le_float(old_patch + 188); /* Detent knobs */ xsynth_patch->osc1_waveform = waveform_bit_to_number(old_patch[196]); xsynth_patch->osc2_waveform = waveform_bit_to_number(old_patch[201]); xsynth_patch->lfo_waveform = waveform_bit_to_number(old_patch[206]); /* Buttons */ xsynth_patch->osc_sync = old_patch[207]; xsynth_patch->vcf_mode = old_patch[208]; /* Name */ if (unpack_name) { int i; for (i = 0; i < 15; i++) { /* Yes, 15: old banks had only 15 character names */ xsynth_patch->name[i] = *(old_patch + 209 + i); } xsynth_patch->name[15] = '\0'; } }