/*
            __
           / /_______________  ____  ___
          / __/ ___/ ___/ __ \/ __ \/ _ \
         / /_(__  ) /__/ /_/ / /_/ /  __/
         \__/____/\___/\____/ .___/\___/
                           /_/
    
    new sound api, based on libsndfile and portaudio (not allegro)

    By Michael Stevens

    See license.html for copyright information
*/

#ifndef TSCOPE_SOUND2_H
#define TSCOPE_SOUND2_H

#ifdef __cplusplus
extern "C" {
#endif

    // parameter functions      
    int snd2_channels(int channels);
    int snd2_samplerate(int rate);
    int snd2_sampleformat(int format);
    
    // memory management functions
    snd2_sample *snd2_makesample(sf_count_t length);
    void snd2_allocatesample(snd2_sample *samp);
    void snd2_killsample (snd2_sample *samp);
    
    // file io functions
    snd2_sample *snd2_readsample (char *file);
    int snd2_writesample(snd2_sample *samp, char *file);
    
    // card io functions - blocking
    void snd2_playsample_blocking(snd2_sample *samp);
    void snd2_recordsample_blocking(snd2_sample *samp);
    
    // card io functions - non blocking
    snd2_stream *snd2_playsample(snd2_sample *samp);
    snd2_stream *snd2_recordsample(snd2_sample *samp);

    // non blocking api - helper functions
    void snd2_stopsample(snd2_stream *stream);
    int snd2_querysample(snd2_stream *stream);
    
    float snd2_getstreamtime(snd2_stream *stream);
    __int64 snd2_getsampletime(snd2_sample *samp);
    
    // disk buffer functions
    void snd2_tobuffer(snd2_sample * samp);
    void snd2_frombuffer(snd2_sample *samp);

#ifdef __cplusplus
}
#endif

// sound parameters 
#define MONO                        1
#define STEREO                      2

#define SAMPLE_INTEGER              1
#define SAMPLE_FLOAT                2

#define FRAMES_PER_BUFFER (1024)


#endif                          //      TSCOPE_SOUND2_H






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