home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: Multimed / Multimed.zip / rxwavsrc.zip / RxWav.h < prev    next >
C/C++ Source or Header  |  2000-03-06  |  6KB  |  213 lines

  1. /*  RxWav
  2.    Copyright (C) 1999  Giorgio Vicario
  3.  
  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 2 of the License, or
  7.    (at your option) any later version.
  8.  
  9.    This program is distributed in the hope that it will be useful,
  10.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  11.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12.    GNU General Public License for more details.
  13.  
  14.    You should have received a copy of the GNU General Public License
  15.    along with this program; if not, write to the Free Software
  16.    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA     */
  17.  
  18. #define  VALID_ROUTINE     0
  19. #define  INVALID_ROUTINE  40
  20.  
  21. #define MAX_DIGITS         9
  22. #define MAX              256
  23.  
  24. #define PI 3.141592654
  25. #define TWOPI 6.2831853
  26.  
  27. #define BUILDRXSTRING(t, s) { \
  28.   strcpy((t)->strptr,(s));\
  29.   (t)->strlength = strlen((s)); \
  30. }
  31.  
  32. #define fvec(name, size)\
  33. if ((name=(double *)calloc(size, sizeof(double)))==NULL) {\
  34.    SendMsg(0, ERR_ALLOCMEM);\
  35.    return INVALID_ROUTINE; }
  36.  
  37. #define FreqCamp       44100
  38. #define MAX_CAMPIONE   32767
  39. #define NBit              16
  40.  
  41. /* Formato file WAV */
  42.  
  43. struct wav
  44.   {
  45.     char w_riff[4];
  46.     int w_len_tot;
  47.     char w_wave[4];
  48.     char w_fmt[4];
  49.     int w_len_fmt;
  50.     short int w_format_tag;
  51.     short int w_stereo;
  52.     int w_freq_camp;
  53.     int w_byte_sec;
  54.     short int w_block_align;
  55.     short int w_bit_camp;
  56.     char w_data[4];
  57.     int w_len_data;
  58.   };
  59.  
  60.  
  61. typedef struct RxStemData
  62.   {
  63.     SHVBLOCK shvb;
  64.     CHAR varname[MAX];
  65.     CHAR ibuf[MAX];
  66.     ULONG stemlen;
  67.     ULONG count;
  68.  
  69.   }
  70. RXSTEMDATA;
  71.  
  72.  
  73.  
  74.  
  75.  
  76. /* errori procedurali */
  77. #define ERR_OK                         0
  78.  
  79. #define ERR_NUMERO_PARAMETRI           1
  80. #define ERR_VALORE_INVALIDO            2
  81. #define ERR_FILE_NOWAV                 3
  82. #define ERR_PUNTATORE_ERRATO           4
  83. #define ERR_TRACCIA_ERRATA             5
  84. #define ERR_TRACCIA_INSUFFICIENTE      6
  85. #define ERR_OFFSET_ERRATO              7
  86. #define ERR_NUMERO_CAMPIONI            8
  87. #define ERR_FREQUENZA_CENTRALE         9
  88. #define ERR_FREQUENZA_OSCILLATORE     10
  89. #define ERR_LARGHEZZA_BANDA           11
  90. #define ERR_AMPIEZZA                  12
  91. #define ERR_AMPIEZZA_FILTRO           13
  92. #define ERR_AMPIEZZA_OSCILLATORE      14
  93. #define ERR_INVILUPPO                 15
  94. #define ERR_RISOLUZIONE               16
  95. #define ERR_TIPO_COPIA                17
  96. #define ERR_RITARDO_REVERB            18
  97. #define ERR_BANDA_ANALISI             19
  98. #define ERR_LETTURA_STEM              20
  99. #define ERR_STEM_DIVERSI              21
  100. #define ERR_STEM_MASSIMO              22
  101.  
  102. #define ERR_REXXPOOL                 100
  103. #define ERR_OPEN_FILE                101
  104. #define ERR_CLOSE_FILE               102
  105. #define ERR_READ_WAV_STRUCT          103
  106. #define ERR_WRITE_WAV_STRUCT         104
  107. #define ERR_DOSALLOCMEM              105
  108. #define ERR_DOSFREEMEM               106
  109. #define ERR_ALLOCMEM                 107
  110. #define ERR_FREEMEM                  108
  111.  
  112.  
  113. /* errori in bseerr.h */
  114. #define  NO_ERROR                      0
  115. #define  ERROR_INVALID_ADDRESS       487
  116.  
  117.  
  118. /* funzioni definite                   */
  119.  
  120. static PSZ RxWavFunc[] =
  121. {
  122.   "WavLoadFuncs",
  123.   "WavDropFuncs",
  124.   "WavAllocTrac",
  125.   "WavDropTrac",
  126.   "WavQueryFile",
  127.   "WavReadStereo",
  128.   "WavWriteStereo",
  129.   "WavReadMono",
  130.   "WavWriteMono",
  131.   "WavCopyTrac",
  132.   "WavSinOsc",
  133.   "WavWhiteNoiseOsc",
  134.   "WavPinkNoiseOsc",
  135.   "WavMute",
  136.   "WavTestOsc",
  137.   "WavFilterBand",
  138.   "WavFilterHigh",
  139.   "WavFilterLow",
  140.   "WavReverb",
  141.   "WavRevert",
  142.   "WavEco",
  143.   "WavPeek",
  144.   "WavPoke",
  145.   "WavPeak",
  146.   "WavSeek",
  147.   "WavAnalyze",
  148.   "WavDyn",
  149.   "WavAvg",
  150.   "WavVocoder",
  151.   "WavConv",
  152.   "WavGraphEQ",
  153.   "WavTest",
  154. };
  155.  
  156.  
  157.  
  158. #define FUNC_LOAD_FUNCS                1
  159. #define FUNC_DROP_FUNCS                2
  160. #define FUNC_ALLOC_TRAC                3
  161. #define FUNC_DROP_TRAC                 4
  162. #define FUNC_QUERY_FILE                5
  163. #define FUNC_READ_STEREO               6
  164. #define FUNC_WRITE_STEREO              7
  165. #define FUNC_READ_MONO                 8
  166. #define FUNC_WRITE_MONO                9
  167. #define FUNC_COPY_TRAC                10
  168. #define FUNC_SIN_OSC                  11
  169. #define FUNC_TEST_OSC                 12
  170. #define FUNC_WHITE_NOISE              13
  171. #define FUNC_PINK_NOISE               14
  172. #define FUNC_MUTE                     15
  173. #define FUNC_FILTER_BAND              16
  174. #define FUNC_FILTER_HIGH              17
  175. #define FUNC_FILTER_LOW               18
  176. #define FUNC_REVERB                   19
  177. #define FUNC_REVERT                   20
  178. #define FUNC_ECO                      21
  179. #define FUNC_PEEK                     22
  180. #define FUNC_POKE                     23
  181. #define FUNC_PEAK                     24
  182. #define FUNC_SEEK                     25
  183. #define FUNC_ANALYZE                  26
  184. #define FUNC_DYN                      27
  185. #define FUNC_AVG                      28
  186. #define FUNC_VOCODER                  29
  187. #define FUNC_CONV                     30
  188. #define FUNC_GRAPHEQ                  31
  189. #define FUNC_TEST                    999
  190.  
  191.  
  192. /* Modi di copia e inviluppi */
  193. #define COPIA_NOMIX                    0
  194. #define COPIA_MIX                      1
  195. #define COPIA_INV_MIX                  2
  196. #define COPIA_INV_NOMIX                3
  197.  
  198. #define INVILUPPO_COSTANTE             0
  199. #define INVILUPPO_LINEARE              1
  200. #define INVILUPPO_LOGARITMICO          2
  201.  
  202. #define BANDA_LINEARE                  0
  203. #define BANDA_OTTAVE                   1
  204. #define BANDA_TERZE                    2
  205. #define BANDA_CROMATICA                3
  206. #define BANDA_LOGARITMICA              4
  207.  
  208. #define PUNTI_FFT_LINEARE          65536
  209. #define PUNTI_FFT_OTTAVE            8192
  210. #define PUNTI_FFT_TERZE            16384
  211. #define PUNTI_FFT_CROMATICA        32768
  212. #define PUNTI_FFT_LOGARITMICA      65536
  213.