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

    newsound2.c
    read and play a wav file (blocking API)
    (no need to open a graphics window)
*/

#include <tscope.h>

int main()
{
    // make a sample pointer
    snd2_sample *samp;

    // read a sample from a file
    samp=snd2_readsample("example.wav");

    // play the sample
    snd2_stream *stream;
    stream=snd2_playsample(samp);
    while (snd2_querysample(stream)==1) 
        ts_wait(mtt(200));  // here you can do whatever you want (e.g. run a trial)
    snd2_stopsample(stream);

    // kill the sample
    snd2_killsample(samp);

    return 0;
}
END_OF_MAIN();



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