X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=src%2Faudio.h;fp=src%2Faudio.h;h=f362781fb8fbb755e9617da1b025f90da0bef0a2;hp=0000000000000000000000000000000000000000;hb=d956a9d9273eebfacfda58cb3bafff017269d5dc;hpb=93f68e445b0a4f10f2b15383aafed8a216a4a228 diff --git a/src/audio.h b/src/audio.h new file mode 100644 index 0000000..f362781 --- /dev/null +++ b/src/audio.h @@ -0,0 +1,54 @@ +#ifndef AUDIO_H_ +#define AUDIO_H_ + +enum { AU_STOPPED, AU_PLAYING }; + +enum { + AU_CUR = 0x7000, + AU_VOLUP = 0x7100, + AU_VOLDN = 0x7200 +}; + +struct au_module { + char *name; + void *impl; +}; + +int au_init(void); +void au_shutdown(void); + +struct au_module *au_load_module(const char *fname); +void au_free_module(struct au_module *mod); + +int au_play_module(struct au_module *mod); +void au_update(void); +int au_stop_module(struct au_module *mod); +int au_module_state(struct au_module *mod); + +int au_volume(int vol); +int au_sfx_volume(int vol); +int au_music_volume(int vol); + +/* pay no attention to the man behind the curtain */ +#define AU_VOLADJ(vol, newvol) \ + do { \ + int d; \ + switch(newvol & 0xff00) { \ + case AU_CUR: \ + return (vol); \ + case AU_VOLUP: \ + d = newvol & 0xff; \ + (newvol) = (vol) + (d ? d : 16); \ + if((newvol) >= 256) (newvol) = 255; \ + break; \ + case AU_VOLDN: \ + d = newvol & 0xff; \ + (newvol) = (vol) - (d ? d : 16); \ + if((newvol) < 0) (newvol) = 0; \ + break; \ + default: \ + break; \ + } \ + } while(0) + +#endif /* AUDIO_H_ */