/*
          __
         / /_______________  ____  ___
        / __/ ___/ ___/ __ \/ __ \/ _ \
       / /_(__  ) /__/ /_/ / /_/ /  __/
       \__/____/\___/\____/ .___/\___/
                         /_/

    sound2.c
    generating sounds on the fly
*/

#include <tscope.h>
#include <tscope/internal.h>

#define MAXTM mtt(3500)

struct {
    __int64 t1, t2;
    __int64 e1, e2;
} tmp;

int main()
{
    // open tscope
    ts_init();
    ts_defkey(KEY_SPACE);

    // don't play sine waves too loud
    // it can damage your speakers or ears
    ts_volume(128);

    // wait for a first response
    ts_vsync(&tmp.t1, &tmp.e1);
    ts_printf_centre(0, 0, "press space");
    ts_rtstream(&tmp.t2, &tmp.e2, MAXTM);
    ts_flushresp();

    // wait for a first response
    ts_sinefreq(400);
    ts_volume(64);
    ts_vsync(&tmp.t1, &tmp.e1);
    ts_clrscr();
    ts_printf_centre(0, 0, "press space again");
    ts_rtstream(&tmp.t2, &tmp.e2, MAXTM);

    ts_button(XMAX - 20, -YMAX + 20);
    return 0;
}

END_OF_MAIN();


top
Persoonlijke pagina Universiteit GentTscope
Allegro | Cygwin | Gcc
© See license.html for copyright information