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

    sound1.c
    playing a wave file
*/

#include <tscope.h>

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

    // load a sample
    SAMPLE *spl;
    spl = ts_loadsample("example.wav");
    ts_loop(ON);

    // start playing the sample
    ts_printf_centre(0, 0, "press space to change the sound volume");
    ts_playsample(spl);         // samples play in the background

    // wait for a response  
    do {
    } while (!ts_respstatus());
    ts_flushresp();

    // adjust the sample
    ts_clrscr();
    ts_printf_centre(0, 0, "press space to stop the sound");
    ts_volume(64);
    ts_adjustsample(spl);

    // wait for a response  
    do {
    } while (!ts_respstatus());


    // clean up
    ts_stopsample(spl);
    ts_killsample(spl);

    return 0;
}

END_OF_MAIN();


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