home *** CD-ROM | disk | FTP | other *** search
/ ftp.whtech.com / ftp.whtech.com.7z / ftp.whtech.com / emulators / v9t9 / linux / sources / V9t9 / source / mix_server.h < prev    next >
Encoding:
C/C++ Source or Header  |  2006-10-19  |  1.5 KB  |  65 lines

  1. #ifndef __MIX_SERVER_H__
  2. #define __MIX_SERVER_H__
  3.  
  4. /*        MIXER SERVER        */
  5.  
  6. /*    This is a OS-generic module for mixing digitized samples together. 
  7.     Internally, it operates as a 24-bit mixer, scaled down to the desired
  8.     format.
  9. */
  10.  
  11. #include "16bit.h"
  12. #include "clstandardtypes.h"
  13.  
  14. #include "centry.h"
  15.  
  16. /*    values for the channel argument. */
  17. enum
  18. {
  19.     mix_CHN0, mix_CHN1, mix_CHN2, mix_Noise,     /* tone channels */
  20.     mix_Speech,                                    /* data channels */
  21.     mix_AudioGate                                /* toggle channels */
  22. };
  23.  
  24. typedef struct 
  25. {
  26.     s8        *data;                    /* circular buffer (may be NULL) */
  27.     u32        len, used;                /* total alloc'd len */
  28.     u32        st, en;                    /* start and end of buffer */
  29.     u32        div, delta, clock, vol;    /* timing info */
  30.     u32        iswhite, ns1, ns2;        /* noise info */
  31. }    sample;
  32.  
  33. // v0-v2 are tones
  34. // v3 is noise
  35. // v4 is speech
  36. // v5 is audio gate
  37. typedef struct
  38. {
  39.     sample    voices[6];
  40.     u32        soundhz;
  41.     s32        *buffer;
  42.     u32        bufsize;
  43.     bool    issigned, eightbit, swapendian;
  44. }    mix_context;
  45.  
  46. void     mix_init(mix_context *m, u32 hertz, u32 bufsize,
  47.                 bool issigned, bool eightbit, bool bigendian);
  48. void     mix_term(mix_context *m);
  49. void     mix_restart(mix_context *m);
  50.  
  51. void    mix_mixit(mix_context *m, u32 advance, u32 samples);
  52. void    mix_advance(mix_context *m, int samples);
  53.  
  54. void     mix_handle_voice(mix_context *m, u8 channel, u32 hertz, u8 volume);
  55. void     mix_handle_noise(mix_context *m, u8 channel, u32 hertz, u8 volume, 
  56.                          int iswhite);
  57. void     mix_handle_data(mix_context *m, u8 channel, u32 hertz, u8 volume, 
  58.                         u32 len, s8 *data);
  59.  
  60. void    mixer_init_commands(void);
  61.  
  62. #include "cexit.h"
  63.  
  64. #endif
  65.