Example #1
0
int main(int argc, char **argv) {
  pd_t *pd1 = start_instance("test1.pd", &file1);
  pd_t *pd2 = start_instance("test2.pd", &file2);

  if(pd1==NULL || pd1==NULL)
    return -1;

  // now run pd for 14 seconds (logical time)
  int iterations;
  for(iterations=0;iterations<2;iterations++) {
    printf("Showing guis for 5 seconds\n");
    libpds_show_gui(pd1);
    libpds_show_gui(pd2);
    runawhile(pd1, pd2, 500);

    printf("Hiding guis for 2 seconds\n");
    libpds_hide_gui(pd1);
    libpds_hide_gui(pd2);
    runawhile(pd1, pd2, 2);
  }

  printf("Closing files\n");
  libpds_closefile(pd1, file1);
  libpds_closefile(pd2, file2);

  printf("Cleaning up\n");
  libpds_delete(pd1);
  libpds_delete(pd2);

  return 0;
}
Example #2
0
int main(int argc, char **argv) {
    if (argc < 3) {
    fprintf(stderr, "usage: %s file folder\n", argv[0]);
    return -1;
    }

    // init pd
    int srate = 44100, foo;
    libpd_set_printhook((t_libpd_printhook)pdprint);
    libpd_set_noteonhook((t_libpd_noteonhook)pdnoteon);
    libpd_init();
    libpd_init_audio(1, 2, srate);

    // compute audio    [; pd dsp 1(
    libpd_start_message(1); // one entry in list
    libpd_add_float(1.0f);
    libpd_finish_message("pd", "dsp");

    // open patch       [; pd open file folder(
    void *file = libpd_openfile(argv[1], argv[2]);

    // now run pd
    for (foo = 0; foo < 2; foo++)  /* note: doesn't yet work the second time */
    {
        printf("running nogui for 1000 ticks...\n");

        runawhile(1);

        printf("starting gui..\n");
        if (libpd_start_gui("../../../pure-data/"))
            printf("gui startup failed\n");

        printf("running for 2000 more ticks...\n");
        runawhile(2);

        libpd_stop_gui();
    }

    printf("Closing and exiting\n");
    libpd_closefile(file);

    return 0;
}
Example #3
0
  do {
    /* fake the current transfer speed */
    easy->progress.current_speed = speed;
    result = Curl_speedcheck(easy, now);
    if(result)
      break;
    /* step the time */
    now.tv_sec = ++counter;
    speed -= dec;
  } while(counter < 100);

  finaltime = (int)(now.tv_sec - 1);

  return finaltime;
}

UNITTEST_START
  fail_unless(runawhile(41, 41, 40, 0) == 41,
              "wrong low speed timeout");
  fail_unless(runawhile(21, 21, 20, 0) == 21,
              "wrong low speed timeout");
  fail_unless(runawhile(60, 60, 40, 0) == 60,
              "wrong log speed timeout");
  fail_unless(runawhile(50, 50, 40, 0) == 50,
              "wrong log speed timeout");
  fail_unless(runawhile(40, 40, 40, 0) == 99,
              "should not time out");
  fail_unless(runawhile(10, 50, 100, 2) == 36,
              "bad timeout");
UNITTEST_STOP