static int update_pres_notes(presentity_t *p, str *etag, time_t expires) { int found = 0; pa_presence_note_t *note = get_first_note(p); while (note) { if (str_case_equals(¬e->etag, etag) == 0) { note->expires = expires; found++; db_update_pres_note(p, note); } note = get_next_note(note); } return found; }
int main(){ u8 i; oscillator osc = {SQUARE, 0, 0, 0}; osc.period = (u8*)malloc(SAMPLING_FREQ / notes[0] ); // use length of longest note notelist nl = {0, 0, 72, 0,0,0}; u8 *song = (u8*)malloc(84);//{a2, b2, c3, r, e3, f3, g3}; u8 *durs = (u8*)malloc(84);//{q, q, q, q, q, e, e}; for (i = 0; i< 84; i++){ song[i] = i; durs[i] = e; } nl.list = song; nl.durations = durs; channel chan = {0, &nl, &osc, 0}; adsr adsr = {0,0,0}; chan.a = &adsr; get_next_note(&chan); chan.channel_block = (u8*)malloc(BLOCK_LEN); printf("setting up main loop\n"); FILE * ofile = fopen("auout.au", "w"); FILE * plotfile = fopen("plotfile.dat", "w"); //auwritehead(ofile); // main loop: u8 cont = 1; u8 blocks = 0xff; u16 index = 0; // u16 block_count = 0; while (cont){ // printf("block nr: %d\n", block_count++); cont = next_chan_block(&chan); adsr_block(chan.a, chan.channel_block, BLOCK_LEN); fwrite(chan.channel_block, 1, BLOCK_LEN, ofile); write_for_plot(plotfile, chan.channel_block, BLOCK_LEN, &index, chan.a->current_phase); //fprintf(plotfile, "%d\n", chan.a->current_phase); blocks--; } /* int i, j, k; k = 0; u8 am; for (j = 0; j < 0x100; j += 0x10){ for(i = 0; i < 0x100; i++){ am = scale_amplitude(i, j); fprintf(plotfile, "%d\t%d\n", k++, am); } } printf("testing scale_amplitude %x %x\n", scale_amplitude(0xc0, 0xf0), scale_amplitude(0x40, 0xf0)); */ printf("closing\n"); fclose(ofile); fclose(plotfile); free(osc.period); free(chan.channel_block); free(song); free(durs); return 0; }