gamesnd

diff include/gamesnd.h @ 0:14e265e1cad8

initial
author John Tsiombikas <nuclear@mutantstargoat.com>
date Sun, 09 Sep 2012 02:55:47 +0300
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/include/gamesnd.h	Sun Sep 09 02:55:47 2012 +0300
     1.3 @@ -0,0 +1,62 @@
     1.4 +#ifndef GAMESND_H_
     1.5 +#define GAMESND_H_
     1.6 +
     1.7 +#include <stdio.h>
     1.8 +
     1.9 +struct gsnd_sample;
    1.10 +struct gsnd_source;
    1.11 +struct gsnd_track;
    1.12 +struct gsnd_io;
    1.13 +
    1.14 +typedef long (*gsnd_io_read_func)(void *file, void *buf, long sz);
    1.15 +typedef long (*gsnd_io_seek_func)(void *file, long offs, int whence);
    1.16 +
    1.17 +
    1.18 +/* ---- sound samples ---- */
    1.19 +int gsnd_init_sample(struct gsnd_sample *sam);
    1.20 +void gsnd_destroy_sample(struct gsnd_sample *sam);
    1.21 +
    1.22 +struct gsnd_sample *gsnd_create_sample(void);
    1.23 +void gsnd_free_sample(struct gsnd_sample *sam);
    1.24 +
    1.25 +int gsnd_load_sample(struct gsnd_sample *sam, const char *fname);
    1.26 +int gsnd_load_sample_file(struct gsnd_sample *sam, FILE *fp);
    1.27 +int gsnd_load_sample_io(struct gsnd_sample *sam, struct gsnd_io *io);
    1.28 +
    1.29 +void gsnd_play_sample(struct gsnd_sample *sam, float vol);
    1.30 +void gsnd_stop_sample(struct gsnd_sample *sam);
    1.31 +
    1.32 +/* ---- sound source ---- */
    1.33 +int gsnd_init_source(struct gsnd_source *src);
    1.34 +void gsnd_destroy_source(struct gsnd_source *src);
    1.35 +
    1.36 +struct gsnd_source *gsnd_create_source(void);
    1.37 +void gsnd_free_source(struct gsnd_source *src);
    1.38 +
    1.39 +void gsnd_source_position(struct gsnd_source *src, float x, float y, float z);
    1.40 +void gsnd_source_volume(struct gsnd_source *src, float vol);
    1.41 +void gsnd_source_pitch(struct gsnd_source *src, float pitch);
    1.42 +
    1.43 +void gsnd_play_source(struct gsnd_sample *sam);
    1.44 +void gsnd_stop_source(struct gsnd_sample *sam);
    1.45 +
    1.46 +/* ---- music tracks ---- */
    1.47 +int gsnd_init_track(struct gsnd_track *trk);
    1.48 +void gsnd_destroy_track(struct gsnd_track *trk);
    1.49 +
    1.50 +struct gsnd_track *gsnd_create_sample(void);
    1.51 +void gsnd_free_sample(struct gsnd_track *trk);
    1.52 +
    1.53 +int gsnd_open_track(struct gsnd_track *trk, const char *fname);
    1.54 +int gsnd_open_track_file(struct gsnd_track *trk, FILE *fp);
    1.55 +int gsnd_open_track_io(struct gsnd_track *trk, struct gsnd_io *io);
    1.56 +
    1.57 +void gsnd_play_track(struct gsnd_track *trk);
    1.58 +void gsnd_stop_track(struct gsnd_track *trk);
    1.59 +
    1.60 +
    1.61 +/* ---- file i/o ---- */
    1.62 +void gsnd_io(struct gsnd_io *io, void *file, gsnd_io_read_func rd, gsnd_io_seek_func seek);
    1.63 +
    1.64 +
    1.65 +#endif	/* GAMESND_H_ */