home *** CD-ROM | disk | FTP | other *** search
/ The Games Machine 25 / GNOME_DEMO.iso / amiga / music / mikmod.lzx / mikmod / drv_raw.c < prev    next >
C/C++ Source or Header  |  2000-01-05  |  1KB  |  88 lines

  1. /*
  2.  
  3. Name:
  4. DRV_RAW.C
  5.  
  6. Description:
  7. Mikmod driver for output to a file called MUSIC.RAW
  8.  
  9. !! DO NOT CALL MD_UPDATE FROM A INTERRUPT IF YOU USE THIS DRIVER !!
  10.  
  11. Portability:
  12.  
  13. MSDOS:    BC(y)    Watcom(y)    DJGPP(y)
  14. Win95:    BC(y)
  15. Linux:    y
  16.  
  17. (y) - yes
  18. (n) - no (not possible or not useful)
  19. (?) - may be possible, but not tested
  20.  
  21. */
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24.  
  25. #include "mikmod.h"
  26.  
  27. #define RAWBUFFERSIZE 8192
  28.  
  29. static FILE *rawout;
  30.  
  31. static char RAW_DMABUF[RAWBUFFERSIZE];
  32.  
  33.  
  34. static BOOL RAW_IsThere(void)
  35. {
  36.     return 1;
  37. }
  38.  
  39.  
  40. static BOOL RAW_Init(void)
  41. {
  42.     if(!(rawout=fopen("music.raw","wb"))){
  43.         myerr="Couldn't open output file 'music.raw'";
  44.         return 0;
  45.     }
  46.  
  47.     if(!VC_Init()){
  48.         fclose(rawout);
  49.         return 0;
  50.     }
  51.  
  52.     return 1;
  53. }
  54.  
  55.  
  56.  
  57. static void RAW_Exit(void)
  58. {
  59.     VC_Exit();
  60.     fclose(rawout);
  61. }
  62.  
  63.  
  64. static void RAW_Update(void)
  65. {
  66.     VC_WriteBytes(RAW_DMABUF,RAWBUFFERSIZE);
  67.     fwrite(RAW_DMABUF,RAWBUFFERSIZE,1,rawout);
  68. }
  69.  
  70.  
  71. DRIVER drv_raw={
  72.     NULL,
  73.     "music.raw file",
  74.     "MikMod music.raw file output driver v1.0",
  75.     RAW_IsThere,
  76.     VC_SampleLoad,
  77.     VC_SampleUnload,
  78.     RAW_Init,
  79.     RAW_Exit,
  80.     VC_PlayStart,
  81.     VC_PlayStop,
  82.     RAW_Update,
  83.     VC_VoiceSetVolume,
  84.     VC_VoiceSetFrequency,
  85.     VC_VoiceSetPanning,
  86.     VC_VoicePlay
  87. };
  88.