int t_atone(sp_test *tst, sp_data *sp, const char *hash) { sp_srand(sp, 0); uint32_t n; int fail = 0; SPFLOAT noise = 0, atone = 0; sp_atone *atone_d; sp_noise *noise_d; sp_atone_create(&atone_d); sp_noise_create(&noise_d); sp_atone_init(sp, atone_d); sp_noise_init(sp, noise_d); for(n = 0; n < tst->size; n++) { noise = 0, atone = 0; sp_noise_compute(sp, noise_d, NULL, &noise); sp_atone_compute(sp, atone_d, &noise, &atone); sp_test_add_sample(tst, atone); } fail = sp_test_verify(tst, hash); sp_atone_destroy(&atone_d); sp_noise_destroy(&noise_d); if(fail) return SP_NOT_OK; else return SP_OK; }
int sporth_atone(sporth_stack *stack, void *ud) { plumber_data *pd = ud; SPFLOAT in; SPFLOAT out; SPFLOAT hp; sp_atone *atone; switch(pd->mode) { case PLUMBER_CREATE: #ifdef DEBUG_MODE fprintf(stderr, "atone: Creating\n"); #endif sp_atone_create(&atone); plumber_add_ugen(pd, SPORTH_ATONE, atone); if(sporth_check_args(stack, "f") != SPORTH_OK) { fprintf(stderr,"Not enough arguments for atone\n"); stack->error++; return PLUMBER_NOTOK; } hp = sporth_stack_pop_float(stack); in = sporth_stack_pop_float(stack); sporth_stack_push_float(stack, 0); break; case PLUMBER_INIT: #ifdef DEBUG_MODE fprintf(stderr, "atone: Initialising\n"); #endif hp = sporth_stack_pop_float(stack); in = sporth_stack_pop_float(stack); atone = pd->last->ud; sp_atone_init(pd->sp, atone); sporth_stack_push_float(stack, 0); break; case PLUMBER_COMPUTE: hp = sporth_stack_pop_float(stack); in = sporth_stack_pop_float(stack); atone = pd->last->ud; atone->hp = hp; sp_atone_compute(pd->sp, atone, &in, &out); sporth_stack_push_float(stack, out); break; case PLUMBER_DESTROY: atone = pd->last->ud; sp_atone_destroy(&atone); break; default: fprintf(stderr, "atone: Uknown mode!\n"); break; } return PLUMBER_OK; }
void destroy() { sp_atone_destroy(&atone0); sp_atone_destroy(&atone1); AKSoundpipeKernel::destroy(); }
void destroy() { sp_atone_destroy(&atone); sp_destroy(&sp); }