X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?p=dosdemo;a=blobdiff_plain;f=libs%2Foldmik%2Fsrc%2Fdrv_raw.c;fp=libs%2Foldmik%2Fsrc%2Fdrv_raw.c;h=c6b25d7c2aacceb81a830499ef18cca775440174;hp=0000000000000000000000000000000000000000;hb=77db1ca18d5446dcda9e524261399b63c2cd1813;hpb=a714b8c4811627d874934b0a0387b8cb27fc5921 diff --git a/libs/oldmik/src/drv_raw.c b/libs/oldmik/src/drv_raw.c new file mode 100644 index 0000000..c6b25d7 --- /dev/null +++ b/libs/oldmik/src/drv_raw.c @@ -0,0 +1,87 @@ +/* + +Name: +DRV_RAW.C + +Description: +Mikmod driver for output to a file called MUSIC.RAW + +!! DO NOT CALL MD_UPDATE FROM A INTERRUPT IF YOU USE THIS DRIVER !! + +Portability: + +MSDOS: BC(y) Watcom(y) DJGPP(y) +Win95: BC(y) +Linux: y + +(y) - yes +(n) - no (not possible or not useful) +(?) - may be possible, but not tested + +*/ +#include +#include + +#include "mikmod.h" + +#define RAWBUFFERSIZE 8192 + +static FILE *rawout; + +static char RAW_DMABUF[RAWBUFFERSIZE]; + + +static BOOL RAW_IsThere(void) +{ + return 1; +} + + +static BOOL RAW_Init(void) +{ + if(!(rawout=fopen("music.raw","wb"))){ + myerr="Couldn't open output file 'music.raw'"; + return 0; + } + + if(!VC_Init()){ + fclose(rawout); + return 0; + } + + return 1; +} + + + +static void RAW_Exit(void) +{ + VC_Exit(); + fclose(rawout); +} + + +static void RAW_Update(void) +{ + VC_WriteBytes(RAW_DMABUF,RAWBUFFERSIZE); + fwrite(RAW_DMABUF,RAWBUFFERSIZE,1,rawout); +} + + +DRIVER drv_raw={ + NULL, + "music.raw file", + "MikMod music.raw file output driver v1.0", + RAW_IsThere, + VC_SampleLoad, + VC_SampleUnload, + RAW_Init, + RAW_Exit, + VC_PlayStart, + VC_PlayStop, + RAW_Update, + VC_VoiceSetVolume, + VC_VoiceSetFrequency, + VC_VoiceSetPanning, + VC_VoicePlay +};