| 1 |
root |
1.1 |
#ifndef SNDLIB_H |
| 2 |
|
|
#define SNDLIB_H |
| 3 |
|
|
|
| 4 |
|
|
|
| 5 |
|
|
/* taken from libtool's demo/foo.h to try to protect us from C++ and ancient C's */ |
| 6 |
|
|
#undef __BEGIN_DECLS |
| 7 |
|
|
#undef __END_DECLS |
| 8 |
|
|
#ifdef __cplusplus |
| 9 |
|
|
# define __BEGIN_DECLS extern "C" { |
| 10 |
|
|
# define __END_DECLS } |
| 11 |
|
|
#else |
| 12 |
|
|
# define __BEGIN_DECLS /* empty */ |
| 13 |
|
|
# define __END_DECLS /* empty */ |
| 14 |
|
|
#endif |
| 15 |
|
|
|
| 16 |
|
|
#undef __P |
| 17 |
|
|
#if defined (__STDC__) || defined (_AIX) || (defined (__mips) && defined (_SYSTYPE_SVR4)) || defined(WIN32) || defined(__cplusplus) |
| 18 |
|
|
# define __P(protos) protos |
| 19 |
|
|
#else |
| 20 |
|
|
# define __P(protos) () |
| 21 |
|
|
#endif |
| 22 |
|
|
|
| 23 |
|
|
|
| 24 |
|
|
#define SNDLIB_VERSION 8 |
| 25 |
|
|
#define SNDLIB_REVISION 2 |
| 26 |
|
|
#define SNDLIB_DATE "6-Dec-99" |
| 27 |
|
|
|
| 28 |
|
|
/* 1: Oct-98 |
| 29 |
|
|
* 2: Oct-98: removed header override functions |
| 30 |
|
|
* 3: Dec-98: removed output_scaler |
| 31 |
|
|
* 4: Jan-99: Sun-related word-alignment changes, C++ fixups |
| 32 |
|
|
* 5: Mar-99: changed float_sound to omit the scaling by SNDLIB_SNDFLT |
| 33 |
|
|
* removed perror calls |
| 34 |
|
|
* added sndlib2scm.c, sndlib-strings.h |
| 35 |
|
|
* 8: fixed windoze audio_output bug |
| 36 |
|
|
* 9: fixed Mac p2cstr potential bug |
| 37 |
|
|
* 6: Jun-99: moved clm-specific code out of sndlib files |
| 38 |
|
|
* changed many names to use "mus" prefix, or "SNDLIB" (and upper case) |
| 39 |
|
|
* added sound_frames |
| 40 |
|
|
* added clm.c, clm.h, vct.c, vct.h, clm2scm.c |
| 41 |
|
|
* added reopen_sound_output (arg order changed rev 6), mus_seek_frame, sound_seek_frame |
| 42 |
|
|
* Jul-99: added sound_max_amp, mus_error |
| 43 |
|
|
* Aug-99: old-sndlib.h for backwards compatibility, added mus_fwrite |
| 44 |
|
|
* Sep-99: added mus_set_raw_header_defaults, mus_probe_file |
| 45 |
|
|
* 7: Sep-99: ALSA port thanks to Paul Barton-Davis |
| 46 |
|
|
* fixed 2 bugs related to Sonorus Studio support |
| 47 |
|
|
* several clm.c/clm2scm.c bugs and oversights repaired. |
| 48 |
|
|
* added list2vct, mus_file2array, mus_array2file, dsp_devices. |
| 49 |
|
|
* 7: added configure files, README.sndlib, changed tar file to use sndlib directory |
| 50 |
|
|
* 8: added -1 as error return from various functions (void->int change in io.c and headers.c) |
| 51 |
|
|
* added mus_header_writable, mus_header_aiff_p, sound_aiff_p |
| 52 |
|
|
* 9: much more of sndlib tied into sndlib2scm |
| 53 |
|
|
* 10: tried to get SGI new AL default devices to work right |
| 54 |
|
|
* 11: USE_BYTESWAP in io.c (if you want to use the GLibC macros). |
| 55 |
|
|
* 14: added forget_sound to remove entry from sound data base. |
| 56 |
|
|
* 18: added more vct funcs, formant-bank, oscil-bank, etc. |
| 57 |
|
|
* 8: Nov-99: decided to make a non-compatible change: AIFF_sound file is now AIFC_sound_file, |
| 58 |
|
|
* and old_style_AIFF_sound_file is now AIFF_sound_file. |
| 59 |
|
|
*/ |
| 60 |
|
|
|
| 61 |
|
|
#ifndef HAVE_SNDLIB |
| 62 |
|
|
#define HAVE_SNDLIB 1 |
| 63 |
|
|
#endif |
| 64 |
|
|
|
| 65 |
|
|
/* try to figure out what type of machine (and in worst case, what OS) we're running on */ |
| 66 |
|
|
/* gcc has various compile-time macros like #cpu, but we're hoping to run in Metroworks C, Watcom C, MSC, CodeWarrior, MPW, etc */ |
| 67 |
|
|
|
| 68 |
|
|
#if defined(HAVE_CONFIG_H) |
| 69 |
|
|
#include "config.h" |
| 70 |
|
|
#if (!defined(WORDS_BIGENDIAN)) |
| 71 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 72 |
|
|
#endif |
| 73 |
|
|
#if (SIZEOF_INT_P != SIZEOF_INT) |
| 74 |
|
|
#define LONG_INT_P 1 |
| 75 |
|
|
#else |
| 76 |
|
|
#define LONG_INT_P 0 |
| 77 |
|
|
#endif |
| 78 |
|
|
#else |
| 79 |
|
|
#if defined(ALPHA) || defined(__alpha__) |
| 80 |
|
|
#define LONG_INT_P 1 |
| 81 |
|
|
#else |
| 82 |
|
|
#define LONG_INT_P 0 |
| 83 |
|
|
#endif |
| 84 |
|
|
#define RETSIGTYPE void |
| 85 |
|
|
#ifdef __LITTLE_ENDIAN__ |
| 86 |
|
|
/* NeXTStep on Intel */ |
| 87 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 88 |
|
|
#else |
| 89 |
|
|
#ifdef BYTE_ORDER |
| 90 |
|
|
#if (BYTE_ORDER == LITTLE_ENDIAN) |
| 91 |
|
|
/* SGI possibility (/usr/include/sys/endian.h), and Linux (/usr/include/bytesex.h and endian.h) */ |
| 92 |
|
|
/* Alpha is apparently /usr/include/alpha/endian.h */ |
| 93 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 94 |
|
|
#endif |
| 95 |
|
|
#endif |
| 96 |
|
|
#endif |
| 97 |
|
|
#endif |
| 98 |
|
|
|
| 99 |
|
|
#ifndef __GNUC__ |
| 100 |
|
|
#ifndef __FUNCTION__ |
| 101 |
|
|
#define __FUNCTION__ "" |
| 102 |
|
|
#endif |
| 103 |
|
|
#endif |
| 104 |
|
|
|
| 105 |
|
|
#if defined(ALPHA) || defined(WINDOZE) || defined(__alpha__) |
| 106 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 107 |
|
|
#endif |
| 108 |
|
|
|
| 109 |
|
|
#if (!(defined(MACOS))) && (defined(MPW_C) || defined(macintosh) || defined(__MRC__)) |
| 110 |
|
|
#define MACOS 1 |
| 111 |
|
|
#endif |
| 112 |
|
|
|
| 113 |
|
|
/* due to project builder stupidity, we can't always depend on -D flags here (maybe we need a SNDLIB_OS macro?) */ |
| 114 |
|
|
/* these wouldn't work with autoconf anyway, so we'll do it by hand */ |
| 115 |
|
|
|
| 116 |
|
|
#if (!defined(SGI)) && (!defined(NEXT)) && (!defined(LINUX)) && (!defined(MACOS)) && (!defined(BEOS)) && (!defined(SUN)) && (!defined(UW2)) && (!defined(SCO5)) && (!defined(ALPHA)) && (!defined(WINDOZE)) |
| 117 |
|
|
#if defined(__dest_os) |
| 118 |
|
|
/* we're in Metrowerks Land */ |
| 119 |
|
|
#if (__dest_os == __be_os) |
| 120 |
|
|
#define BEOS 1 |
| 121 |
|
|
#else |
| 122 |
|
|
#if (__dest_os == __mac_os) |
| 123 |
|
|
#define MACOS 1 |
| 124 |
|
|
#endif |
| 125 |
|
|
#endif |
| 126 |
|
|
#else |
| 127 |
|
|
#if macintosh |
| 128 |
|
|
#define MACOS 1 |
| 129 |
|
|
#else |
| 130 |
|
|
#if (__WINDOWS__) || (__NT__) || (_WIN32) || (__CYGWIN__) |
| 131 |
|
|
#define WINDOZE 1 |
| 132 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 133 |
|
|
#else |
| 134 |
|
|
#ifdef __alpha__ |
| 135 |
|
|
#define ALPHA 1 |
| 136 |
|
|
#define SNDLIB_LITTLE_ENDIAN 1 |
| 137 |
|
|
#endif |
| 138 |
|
|
#endif |
| 139 |
|
|
#endif |
| 140 |
|
|
#endif |
| 141 |
|
|
#endif |
| 142 |
|
|
|
| 143 |
|
|
/* others apparently are __QNX__ __bsdi__ __FreeBSD__ */ |
| 144 |
|
|
|
| 145 |
|
|
#if defined(LINUX) && defined(PPC) && (!(defined(MKLINUX))) |
| 146 |
|
|
#define MKLINUX 1 |
| 147 |
|
|
#endif |
| 148 |
|
|
|
| 149 |
|
|
#ifndef HAVE_ALSA |
| 150 |
|
|
#if defined(MKLINUX) || defined(LINUX) || defined(SCO5) || defined(UW2) || defined(HAVE_SOUNDCARD_H) || defined(HAVE_SYS_SOUNDCARD_H) || defined(HAVE_MACHINE_SOUNDCARD_H) |
| 151 |
|
|
#define HAVE_OSS 1 |
| 152 |
|
|
#else |
| 153 |
|
|
#define HAVE_OSS 0 |
| 154 |
|
|
#endif |
| 155 |
|
|
#else |
| 156 |
|
|
#define HAVE_OSS 0 |
| 157 |
|
|
#endif |
| 158 |
|
|
|
| 159 |
|
|
#if (!defined(M_PI)) |
| 160 |
|
|
#define M_PI 3.14159265358979323846264338327 |
| 161 |
|
|
#define M_PI_2 (M_PI/2.0) |
| 162 |
|
|
#endif |
| 163 |
|
|
|
| 164 |
|
|
#define TWO_PI (2.0*M_PI) |
| 165 |
|
|
|
| 166 |
|
|
#ifndef SEEK_SET |
| 167 |
|
|
#define SEEK_SET 0 |
| 168 |
|
|
#endif |
| 169 |
|
|
|
| 170 |
|
|
#ifndef SEEK_CUR |
| 171 |
|
|
#define SEEK_CUR 1 |
| 172 |
|
|
#endif |
| 173 |
|
|
|
| 174 |
|
|
#ifndef SEEK_END |
| 175 |
|
|
#define SEEK_END 2 |
| 176 |
|
|
#endif |
| 177 |
|
|
|
| 178 |
|
|
#define SNDLIB_DAC_CHANNEL 252525 |
| 179 |
|
|
#define SNDLIB_DAC_REVERB 252520 |
| 180 |
|
|
#define SNDLIB_SNDFIX 32768.0 |
| 181 |
|
|
#define SNDLIB_SNDFLT 0.000030517578 |
| 182 |
|
|
|
| 183 |
|
|
#define unsupported_sound_file -1 |
| 184 |
|
|
#define NeXT_sound_file 0 |
| 185 |
|
|
#define AIFC_sound_file 1 |
| 186 |
|
|
#define RIFF_sound_file 2 |
| 187 |
|
|
#define BICSF_sound_file 3 |
| 188 |
|
|
#define NIST_sound_file 4 |
| 189 |
|
|
#define INRS_sound_file 5 |
| 190 |
|
|
#define ESPS_sound_file 6 |
| 191 |
|
|
#define SVX_sound_file 7 |
| 192 |
|
|
#define VOC_sound_file 8 |
| 193 |
|
|
#define SNDT_sound_file 9 |
| 194 |
|
|
#define raw_sound_file 10 |
| 195 |
|
|
#define SMP_sound_file 11 |
| 196 |
|
|
#define SD2_sound_file 12 |
| 197 |
|
|
#define AVR_sound_file 13 |
| 198 |
|
|
#define IRCAM_sound_file 14 |
| 199 |
|
|
#define SD1_sound_file 15 |
| 200 |
|
|
#define SPPACK_sound_file 16 |
| 201 |
|
|
#define MUS10_sound_file 17 |
| 202 |
|
|
#define HCOM_sound_file 18 |
| 203 |
|
|
#define PSION_sound_file 19 |
| 204 |
|
|
#define MAUD_sound_file 20 |
| 205 |
|
|
#define IEEE_sound_file 21 |
| 206 |
|
|
#define DeskMate_sound_file 22 |
| 207 |
|
|
#define DeskMate_2500_sound_file 23 |
| 208 |
|
|
#define Matlab_sound_file 24 |
| 209 |
|
|
#define ADC_sound_file 25 |
| 210 |
|
|
#define SoundEdit_sound_file 26 |
| 211 |
|
|
#define SoundEdit_16_sound_file 27 |
| 212 |
|
|
#define DVSM_sound_file 28 |
| 213 |
|
|
#define MIDI_file 29 |
| 214 |
|
|
#define Esignal_file 30 |
| 215 |
|
|
#define soundfont_sound_file 31 |
| 216 |
|
|
#define gravis_sound_file 32 |
| 217 |
|
|
#define comdisco_sound_file 33 |
| 218 |
|
|
#define goldwave_sound_file 34 |
| 219 |
|
|
#define srfs_sound_file 35 |
| 220 |
|
|
#define MIDI_sample_dump 36 |
| 221 |
|
|
#define DiamondWare_sound_file 37 |
| 222 |
|
|
#define RealAudio_sound_file 38 |
| 223 |
|
|
#define ADF_sound_file 39 |
| 224 |
|
|
#define SBStudioII_sound_file 40 |
| 225 |
|
|
#define Delusion_sound_file 41 |
| 226 |
|
|
#define Farandole_sound_file 42 |
| 227 |
|
|
#define Sample_dump_sound_file 43 |
| 228 |
|
|
#define Ultratracker_sound_file 44 |
| 229 |
|
|
#define Yamaha_SY85_sound_file 45 |
| 230 |
|
|
#define Yamaha_TX16_sound_file 46 |
| 231 |
|
|
#define digiplayer_sound_file 47 |
| 232 |
|
|
#define Covox_sound_file 48 |
| 233 |
|
|
#define SPL_sound_file 49 |
| 234 |
|
|
#define AVI_sound_file 50 |
| 235 |
|
|
#define OMF_sound_file 51 |
| 236 |
|
|
#define Quicktime_sound_file 52 |
| 237 |
|
|
#define asf_sound_file 53 |
| 238 |
|
|
#define Yamaha_SY99_sound_file 54 |
| 239 |
|
|
#define Kurzweil_2000_sound_file 55 |
| 240 |
|
|
#define AIFF_sound_file 56 |
| 241 |
|
|
|
| 242 |
|
|
|
| 243 |
|
|
#define SNDLIB_UNSUPPORTED -1 |
| 244 |
|
|
#define SNDLIB_NO_SND 0 |
| 245 |
|
|
#define SNDLIB_16_LINEAR 1 |
| 246 |
|
|
#define SNDLIB_8_MULAW 2 |
| 247 |
|
|
#define SNDLIB_8_LINEAR 3 |
| 248 |
|
|
#define SNDLIB_32_FLOAT 4 |
| 249 |
|
|
#define SNDLIB_32_LINEAR 5 |
| 250 |
|
|
#define SNDLIB_8_ALAW 6 |
| 251 |
|
|
#define SNDLIB_8_UNSIGNED 7 |
| 252 |
|
|
#define SNDLIB_24_LINEAR 8 |
| 253 |
|
|
#define SNDLIB_64_DOUBLE 9 |
| 254 |
|
|
#define SNDLIB_16_LINEAR_LITTLE_ENDIAN 10 |
| 255 |
|
|
#define SNDLIB_32_LINEAR_LITTLE_ENDIAN 11 |
| 256 |
|
|
#define SNDLIB_32_FLOAT_LITTLE_ENDIAN 12 |
| 257 |
|
|
#define SNDLIB_64_DOUBLE_LITTLE_ENDIAN 13 |
| 258 |
|
|
#define SNDLIB_16_UNSIGNED 14 |
| 259 |
|
|
#define SNDLIB_16_UNSIGNED_LITTLE_ENDIAN 15 |
| 260 |
|
|
#define SNDLIB_24_LINEAR_LITTLE_ENDIAN 16 |
| 261 |
|
|
#define SNDLIB_32_VAX_FLOAT 17 |
| 262 |
|
|
#define SNDLIB_12_LINEAR 18 |
| 263 |
|
|
#define SNDLIB_12_LINEAR_LITTLE_ENDIAN 19 |
| 264 |
|
|
#define SNDLIB_12_UNSIGNED 20 |
| 265 |
|
|
#define SNDLIB_12_UNSIGNED_LITTLE_ENDIAN 21 |
| 266 |
|
|
/* 64-bit ints apparently can occur in ESPS files */ |
| 267 |
|
|
|
| 268 |
|
|
#ifdef SNDLIB_LITTLE_ENDIAN |
| 269 |
|
|
#define SNDLIB_COMPATIBLE_FORMAT SNDLIB_16_LINEAR_LITTLE_ENDIAN |
| 270 |
|
|
#else |
| 271 |
|
|
#define SNDLIB_COMPATIBLE_FORMAT SNDLIB_16_LINEAR |
| 272 |
|
|
#endif |
| 273 |
|
|
|
| 274 |
|
|
#define SNDLIB_NIST_shortpack 2 |
| 275 |
|
|
#define SNDLIB_AIFF_IMA_ADPCM 99 |
| 276 |
|
|
|
| 277 |
|
|
#define SNDLIB_DEFAULT_DEVICE 0 |
| 278 |
|
|
#define SNDLIB_READ_WRITE_DEVICE 1 |
| 279 |
|
|
#define SNDLIB_ADAT_IN_DEVICE 2 |
| 280 |
|
|
#define SNDLIB_AES_IN_DEVICE 3 |
| 281 |
|
|
#define SNDLIB_LINE_OUT_DEVICE 4 |
| 282 |
|
|
#define SNDLIB_LINE_IN_DEVICE 5 |
| 283 |
|
|
#define SNDLIB_MICROPHONE_DEVICE 6 |
| 284 |
|
|
#define SNDLIB_SPEAKERS_DEVICE 7 |
| 285 |
|
|
#define SNDLIB_DIGITAL_IN_DEVICE 8 |
| 286 |
|
|
#define SNDLIB_DIGITAL_OUT_DEVICE 9 |
| 287 |
|
|
#define SNDLIB_DAC_OUT_DEVICE 10 |
| 288 |
|
|
#define SNDLIB_ADAT_OUT_DEVICE 11 |
| 289 |
|
|
#define SNDLIB_AES_OUT_DEVICE 12 |
| 290 |
|
|
#define SNDLIB_DAC_FILTER_DEVICE 13 |
| 291 |
|
|
#define SNDLIB_MIXER_DEVICE 14 |
| 292 |
|
|
#define SNDLIB_LINE1_DEVICE 15 |
| 293 |
|
|
#define SNDLIB_LINE2_DEVICE 16 |
| 294 |
|
|
#define SNDLIB_LINE3_DEVICE 17 |
| 295 |
|
|
#define SNDLIB_AUX_INPUT_DEVICE 18 |
| 296 |
|
|
#define SNDLIB_CD_IN_DEVICE 19 |
| 297 |
|
|
#define SNDLIB_AUX_OUTPUT_DEVICE 20 |
| 298 |
|
|
#define SNDLIB_SPDIF_IN_DEVICE 21 |
| 299 |
|
|
#define SNDLIB_SPDIF_OUT_DEVICE 22 |
| 300 |
|
|
|
| 301 |
|
|
#define SNDLIB_AUDIO_SYSTEM(n) ((n)<<16) |
| 302 |
|
|
#define SNDLIB_SYSTEM(n) (((n)>>16)&0xffff) |
| 303 |
|
|
#define SNDLIB_DEVICE(n) ((n)&0xffff) |
| 304 |
|
|
|
| 305 |
|
|
#define SNDLIB_NO_ERROR 0 |
| 306 |
|
|
#define SNDLIB_CHANNELS_NOT_AVAILABLE 1 |
| 307 |
|
|
#define SNDLIB_SRATE_NOT_AVAILABLE 2 |
| 308 |
|
|
#define SNDLIB_FORMAT_NOT_AVAILABLE 3 |
| 309 |
|
|
#define SNDLIB_NO_INPUT_AVAILABLE 4 |
| 310 |
|
|
#define SNDLIB_NO_OUTPUT_AVAILABLE 5 |
| 311 |
|
|
#define SNDLIB_INPUT_BUSY 6 |
| 312 |
|
|
#define SNDLIB_OUTPUT_BUSY 7 |
| 313 |
|
|
#define SNDLIB_CONFIGURATION_NOT_AVAILABLE 8 |
| 314 |
|
|
#define SNDLIB_INPUT_CLOSED 9 |
| 315 |
|
|
#define SNDLIB_OUTPUT_CLOSED 10 |
| 316 |
|
|
#define SNDLIB_IO_INTERRUPTED 11 |
| 317 |
|
|
#define SNDLIB_NO_LINES_AVAILABLE 12 |
| 318 |
|
|
#define SNDLIB_WRITE_ERROR 13 |
| 319 |
|
|
#define SNDLIB_SIZE_NOT_AVAILABLE 14 |
| 320 |
|
|
#define SNDLIB_DEVICE_NOT_AVAILABLE 15 |
| 321 |
|
|
#define SNDLIB_CANT_CLOSE 16 |
| 322 |
|
|
#define SNDLIB_CANT_OPEN 17 |
| 323 |
|
|
#define SNDLIB_READ_ERROR 18 |
| 324 |
|
|
#define SNDLIB_AMP_NOT_AVAILABLE 19 |
| 325 |
|
|
#define SNDLIB_AUDIO_NO_OP 20 |
| 326 |
|
|
#define SNDLIB_CANT_WRITE 21 |
| 327 |
|
|
#define SNDLIB_CANT_READ 22 |
| 328 |
|
|
#define SNDLIB_NO_READ_PERMISSION 23 |
| 329 |
|
|
|
| 330 |
|
|
#define SNDLIB_AMP_FIELD 0 |
| 331 |
|
|
#define SNDLIB_SRATE_FIELD 1 |
| 332 |
|
|
#define SNDLIB_CHANNEL_FIELD 2 |
| 333 |
|
|
#define SNDLIB_FORMAT_FIELD 3 |
| 334 |
|
|
#define SNDLIB_DEVICE_FIELD 4 |
| 335 |
|
|
#define SNDLIB_IMIX_FIELD 5 |
| 336 |
|
|
#define SNDLIB_IGAIN_FIELD 6 |
| 337 |
|
|
#define SNDLIB_RECLEV_FIELD 7 |
| 338 |
|
|
#define SNDLIB_PCM_FIELD 8 |
| 339 |
|
|
#define SNDLIB_PCM2_FIELD 9 |
| 340 |
|
|
#define SNDLIB_OGAIN_FIELD 10 |
| 341 |
|
|
#define SNDLIB_LINE_FIELD 11 |
| 342 |
|
|
#define SNDLIB_MIC_FIELD 12 |
| 343 |
|
|
#define SNDLIB_LINE1_FIELD 13 |
| 344 |
|
|
#define SNDLIB_LINE2_FIELD 14 |
| 345 |
|
|
#define SNDLIB_LINE3_FIELD 15 |
| 346 |
|
|
#define SNDLIB_SYNTH_FIELD 16 |
| 347 |
|
|
#define SNDLIB_BASS_FIELD 17 |
| 348 |
|
|
#define SNDLIB_TREBLE_FIELD 18 |
| 349 |
|
|
#define SNDLIB_CD_FIELD 19 |
| 350 |
|
|
|
| 351 |
|
|
enum {MUS_NO_ERROR,MUS_NO_FREQUENCY,MUS_NO_PHASE,MUS_NO_GEN,MUS_NO_LENGTH, |
| 352 |
|
|
MUS_NO_FREE,MUS_NO_DESCRIBE,MUS_NO_EQUALP,MUS_NO_DATA,MUS_NO_SCALER, |
| 353 |
|
|
MUS_MEMORY_ALLOCATION_FAILED,MUS_UNSTABLE_TWO_POLE_ERROR, |
| 354 |
|
|
MUS_INVALID_CHANNEL_FOR_FRAME,MUS_CANT_OPEN_FILE,MUS_NO_SAMPLE_INPUT, |
| 355 |
|
|
MUS_NO_SAMPLE_OUTPUT,MUS_NO_FRAME_INPUT,MUS_NO_FRAME_OUTPUT, |
| 356 |
|
|
MUS_NO_SUCH_CHANNEL,MUS_NO_FILE_NAME_PROVIDED,MUS_NO_LOCATION,MUS_NO_CHANNEL, |
| 357 |
|
|
MUS_NO_SUCH_FFT_WINDOW, |
| 358 |
|
|
MUS_UNSUPPORTED_DATA_FORMAT,MUS_HEADER_READ_FAILED,MUS_HEADER_TOO_MANY_AUXILIARY_COMMENTS,MUS_UNSUPPORTED_HEADER_TYPE, |
| 359 |
|
|
MUS_FILE_DESCRIPTORS_NOT_INITIALIZED,MUS_NOT_A_SOUND_FILE,MUS_FILE_CLOSED,MUS_WRITE_ERROR, |
| 360 |
|
|
MUS_BOGUS_FREE,MUS_BUFFER_OVERFLOW,MUS_BUFFER_UNDERFLOW,MUS_FILE_OVERFLOW,MUS_EXPONENT_OVERFLOW, |
| 361 |
|
|
MUS_INITIAL_ERROR_TAG}; |
| 362 |
|
|
|
| 363 |
|
|
/* realloc is enough of a mess that I'll handle each case individually */ |
| 364 |
|
|
|
| 365 |
|
|
#ifdef MACOS |
| 366 |
|
|
/* C's calloc/free are incompatible with Mac's SndDisposeChannel (which we can't avoid using) */ |
| 367 |
|
|
#define CALLOC(a,b) NewPtrClear((a) * (b)) |
| 368 |
|
|
#define MALLOC(a) NewPtr((a)) |
| 369 |
|
|
#define FREE(a) DisposePtr((Ptr)(a)) |
| 370 |
|
|
#else |
| 371 |
|
|
#ifdef DEBUG_MEMORY |
| 372 |
|
|
#define CALLOC(a,b) mem_calloc(a,b,__FUNCTION__,__FILE__,__LINE__) |
| 373 |
|
|
#define MALLOC(a) mem_malloc(a,__FUNCTION__,__FILE__,__LINE__) |
| 374 |
|
|
#define FREE(a) mem_free(a,__FUNCTION__,__FILE__,__LINE__) |
| 375 |
|
|
#define REALLOC(a,b) mem_realloc(a,b,__FUNCTION__,__FILE__,__LINE__) |
| 376 |
|
|
#else |
| 377 |
|
|
#define CALLOC(a,b) calloc(a,b) |
| 378 |
|
|
#define MALLOC(a) malloc(a) |
| 379 |
|
|
#define FREE(a) free(a) |
| 380 |
|
|
#define REALLOC(a,b) realloc(a,b) |
| 381 |
|
|
#endif |
| 382 |
|
|
#endif |
| 383 |
|
|
|
| 384 |
|
|
#define SNDLIB_MAX_FILE_NAME 128 |
| 385 |
|
|
|
| 386 |
|
|
__BEGIN_DECLS |
| 387 |
|
|
|
| 388 |
|
|
#ifdef __GNUC__ |
| 389 |
|
|
void mus_error(int error, char *format, ...) __attribute__ ((format (printf, 2, 3))); |
| 390 |
|
|
void mus_fwrite(int fd, char *format, ...) __attribute__ ((format (printf, 2, 3))); |
| 391 |
|
|
#else |
| 392 |
|
|
void mus_error __P((int error, char *format, ...)); |
| 393 |
|
|
void mus_fwrite __P((int fd, char *format, ...)); |
| 394 |
|
|
#endif |
| 395 |
|
|
void mus_set_error_handler(void (*new_error_handler)(int err_type, char *err_msg)); |
| 396 |
|
|
int mus_make_error_tag __P((void)); |
| 397 |
|
|
|
| 398 |
|
|
int sound_samples __P((char *arg)); |
| 399 |
|
|
int sound_frames __P((char *arg)); |
| 400 |
|
|
int sound_datum_size __P((char *arg)); |
| 401 |
|
|
int sound_data_location __P((char *arg)); |
| 402 |
|
|
int sound_chans __P((char *arg)); |
| 403 |
|
|
int sound_srate __P((char *arg)); |
| 404 |
|
|
int sound_header_type __P((char *arg)); |
| 405 |
|
|
int sound_data_format __P((char *arg)); |
| 406 |
|
|
int sound_original_format __P((char *arg)); |
| 407 |
|
|
int sound_comment_start __P((char *arg)); |
| 408 |
|
|
int sound_comment_end __P((char *arg)); |
| 409 |
|
|
int sound_length __P((char *arg)); |
| 410 |
|
|
int sound_fact_samples __P((char *arg)); |
| 411 |
|
|
int sound_distributed __P((char *arg)); |
| 412 |
|
|
int sound_write_date __P((char *arg)); |
| 413 |
|
|
int sound_type_specifier __P((char *arg)); |
| 414 |
|
|
int sound_align __P((char *arg)); |
| 415 |
|
|
int sound_bits_per_sample __P((char *arg)); |
| 416 |
|
|
char *sound_type_name __P((int type)); |
| 417 |
|
|
char *sound_format_name __P((int format)); |
| 418 |
|
|
char *sound_comment __P((char *name)); |
| 419 |
|
|
int sound_bytes_per_sample __P((int format)); |
| 420 |
|
|
float sound_duration __P((char *arg)); |
| 421 |
|
|
int initialize_sndlib __P((void)); |
| 422 |
|
|
int override_sound_header __P((char *arg, int srate, int chans, int format, int type, int location, int size)); |
| 423 |
|
|
int forget_sound __P((char *name)); |
| 424 |
|
|
|
| 425 |
|
|
int open_sound_input __P((char *arg)); |
| 426 |
|
|
int open_sound_output __P((char *arg, int srate, int chans, int data_format, int header_type, char *comment)); |
| 427 |
|
|
int reopen_sound_output __P((char *arg, int chans, int format, int type, int data_loc)); |
| 428 |
|
|
int close_sound_input __P((int fd)); |
| 429 |
|
|
int close_sound_output __P((int fd, int bytes_of_data)); |
| 430 |
|
|
int read_sound __P((int fd, int beg, int end, int chans, int **bufs)); |
| 431 |
|
|
int write_sound __P((int tfd, int beg, int end, int chans, int **bufs)); |
| 432 |
|
|
int seek_sound __P((int tfd, long offset, int origin)); |
| 433 |
|
|
int seek_sound_frame __P((int tfd, int frame)); |
| 434 |
|
|
|
| 435 |
|
|
void describe_audio_state __P((void)); |
| 436 |
|
|
char *report_audio_state __P((void)); |
| 437 |
|
|
int open_audio_output __P((int dev, int srate, int chans, int format, int size)); |
| 438 |
|
|
int open_audio_input __P((int dev, int srate, int chans, int format, int size)); |
| 439 |
|
|
int write_audio __P((int line, char *buf, int bytes)); |
| 440 |
|
|
int close_audio __P((int line)); |
| 441 |
|
|
int read_audio __P((int line, char *buf, int bytes)); |
| 442 |
|
|
int read_audio_state __P((int dev, int field, int chan, float *val)); |
| 443 |
|
|
int write_audio_state __P((int dev, int field, int chan, float *val)); |
| 444 |
|
|
void save_audio_state __P((void)); |
| 445 |
|
|
void restore_audio_state __P((void)); |
| 446 |
|
|
int audio_error __P((void)); |
| 447 |
|
|
int initialize_audio __P((void)); |
| 448 |
|
|
char *audio_error_name __P((int err)); |
| 449 |
|
|
void set_audio_error __P((int err)); |
| 450 |
|
|
int audio_systems __P((void)); |
| 451 |
|
|
char *audio_system_name __P((int system)); |
| 452 |
|
|
char *audio_moniker __P((void)); |
| 453 |
|
|
#if (HAVE_OSS || HAVE_ALSA) |
| 454 |
|
|
void set_dsp_devices __P((int cards, int *dsps, int *mixers)); |
| 455 |
|
|
void dsp_devices __P((int cards, int *dsps, int *mixers)); |
| 456 |
|
|
void set_oss_buffers __P((int num,int size)); |
| 457 |
|
|
#endif |
| 458 |
|
|
void write_mixer_state __P((char *file)); |
| 459 |
|
|
void read_mixer_state __P((char *file)); |
| 460 |
|
|
|
| 461 |
|
|
#ifdef CLM |
| 462 |
|
|
void reset_io_c __P((void)); |
| 463 |
|
|
void reset_headers_c __P((void)); |
| 464 |
|
|
void reset_audio_c __P((void)); |
| 465 |
|
|
void set_rt_audio_p __P((int rt)); |
| 466 |
|
|
int get_shift_24_choice __P((void)); |
| 467 |
|
|
void set_shift_24_choice __P((int choice)); |
| 468 |
|
|
int net_mix __P((int fd, int loc, char *buf1, char *buf2, int bytes)); |
| 469 |
|
|
#endif |
| 470 |
|
|
|
| 471 |
|
|
int mus_open_file_descriptors __P((int tfd, int df, int ds, int dl)); |
| 472 |
|
|
int mus_set_file_descriptors __P((int tfd, int df, int ds, int dl, int dc, int dt)); |
| 473 |
|
|
int mus_close_file_descriptors __P((int tfd)); |
| 474 |
|
|
int mus_cleanup_file_descriptors __P((void)); |
| 475 |
|
|
int mus_open_read __P((char *arg)); |
| 476 |
|
|
int mus_probe_file __P((char *arg)); |
| 477 |
|
|
int mus_open_write __P((char *arg)); |
| 478 |
|
|
int mus_create __P((char *arg)); |
| 479 |
|
|
int mus_reopen_write __P((char *arg)); |
| 480 |
|
|
int mus_close __P((int fd)); |
| 481 |
|
|
long mus_seek __P((int tfd, long offset, int origin)); |
| 482 |
|
|
int mus_seek_frame __P((int tfd, int frame)); |
| 483 |
|
|
int mus_read __P((int fd, int beg, int end, int chans, int **bufs)); |
| 484 |
|
|
int mus_read_chans __P((int fd, int beg, int end, int chans, int **bufs, int *cm)); |
| 485 |
|
|
int mus_write_zeros __P((int tfd, int num)); |
| 486 |
|
|
int mus_write __P((int tfd, int beg, int end, int chans, int **bufs)); |
| 487 |
|
|
int mus_float_sound __P((char *charbuf, int samps, int charbuf_format, float *buffer)); |
| 488 |
|
|
int mus_header_samples __P((void)); |
| 489 |
|
|
int mus_header_data_location __P((void)); |
| 490 |
|
|
int mus_header_chans __P((void)); |
| 491 |
|
|
int mus_header_srate __P((void)); |
| 492 |
|
|
int mus_header_type __P((void)); |
| 493 |
|
|
int mus_header_format __P((void)); |
| 494 |
|
|
int mus_header_distributed __P((void)); |
| 495 |
|
|
int mus_header_comment_start __P((void)); |
| 496 |
|
|
int mus_header_comment_end __P((void)); |
| 497 |
|
|
int mus_header_type_specifier __P((void)); |
| 498 |
|
|
int mus_header_bits_per_sample __P((void)); |
| 499 |
|
|
int mus_header_fact_samples __P((void)); |
| 500 |
|
|
int mus_header_block_align __P((void)); |
| 501 |
|
|
int mus_header_loop_mode __P((int which)); |
| 502 |
|
|
int mus_header_loop_start __P((int which)); |
| 503 |
|
|
int mus_header_loop_end __P((int which)); |
| 504 |
|
|
int mus_header_mark_position __P((int id)); |
| 505 |
|
|
int mus_header_base_note __P((void)); |
| 506 |
|
|
int mus_header_base_detune __P((void)); |
| 507 |
|
|
void mus_set_raw_header_defaults __P((int sr, int chn, int frm)); |
| 508 |
|
|
int mus_true_file_length __P((void)); |
| 509 |
|
|
int mus_header_original_format __P((void)); |
| 510 |
|
|
int mus_format2bytes __P((int format)); |
| 511 |
|
|
int mus_header_format2bytes __P((void)); |
| 512 |
|
|
int mus_samples2bytes __P((int format, int size)); |
| 513 |
|
|
int mus_bytes2samples __P((int format, int size)); |
| 514 |
|
|
int mus_write_next_header __P((int chan, int srate, int chans, int loc, int siz, int format, char *comment, int len)); |
| 515 |
|
|
int mus_read_header_with_fd __P((int chan)); |
| 516 |
|
|
int mus_read_header __P((char *name)); |
| 517 |
|
|
int mus_write_header __P((char *name, int type, int srate, int chans, int loc, int size, int format, char *comment, int len)); |
| 518 |
|
|
int mus_write_header_with_fd __P((int chan, int type, int in_srate, int in_chans, int loc, int size, int format, char *comment, int len)); |
| 519 |
|
|
void mus_set_aifc_header __P((int val)); |
| 520 |
|
|
int mus_update_header_with_fd __P((int chan, int type, int siz)); |
| 521 |
|
|
int mus_update_header __P((char *name, int type, int size, int srate, int format, int chans, int loc)); |
| 522 |
|
|
int mus_header_aux_comment_start __P((int n)); |
| 523 |
|
|
int mus_header_aux_comment_end __P((int n)); |
| 524 |
|
|
int mus_update_header_comment __P((char *name, int loc, char *comment, int len, int typ)); |
| 525 |
|
|
int mus_create_header_buffer __P((void)); |
| 526 |
|
|
int mus_create_descriptors __P((void)); |
| 527 |
|
|
int mus_read_any __P((int tfd, int beg, int chans, int nints, int **bufs, int *cm)); |
| 528 |
|
|
void mus_set_snd_header __P((int in_srate, int in_chans, int in_format)); |
| 529 |
|
|
int mus_unshort_sound __P((short *in_buf, int samps, int new_format, char *out_buf)); |
| 530 |
|
|
int sound_max_amp __P((char *ifile, int *vals)); |
| 531 |
|
|
|
| 532 |
|
|
int mus_header_aiff_p __P((void)); |
| 533 |
|
|
int sound_aiff_p __P((char *arg)); |
| 534 |
|
|
int mus_header_writable __P((int type, int format)); |
| 535 |
|
|
char *mus_header_type2string __P((int type)); |
| 536 |
|
|
char *mus_header_data_format2string __P((int format)); |
| 537 |
|
|
|
| 538 |
|
|
void mus_set_big_endian_int __P((unsigned char *j, int x)); |
| 539 |
|
|
int mus_big_endian_int __P((unsigned char *inp)); |
| 540 |
|
|
void mus_set_little_endian_int __P((unsigned char *j, int x)); |
| 541 |
|
|
int mus_little_endian_int __P((unsigned char *inp)); |
| 542 |
|
|
int mus_uninterpreted_int __P((unsigned char *inp)); |
| 543 |
|
|
void mus_set_big_endian_float __P((unsigned char *j, float x)); |
| 544 |
|
|
float mus_big_endian_float __P((unsigned char *inp)); |
| 545 |
|
|
void mus_set_little_endian_float __P((unsigned char *j, float x)); |
| 546 |
|
|
float mus_little_endian_float __P((unsigned char *inp)); |
| 547 |
|
|
void mus_set_big_endian_short __P((unsigned char *j, short x)); |
| 548 |
|
|
short mus_big_endian_short __P((unsigned char *inp)); |
| 549 |
|
|
void mus_set_little_endian_short __P((unsigned char *j, short x)); |
| 550 |
|
|
short mus_little_endian_short __P((unsigned char *inp)); |
| 551 |
|
|
void mus_set_big_endian_unsigned_short __P((unsigned char *j, unsigned short x)); |
| 552 |
|
|
unsigned short mus_big_endian_unsigned_short __P((unsigned char *inp)); |
| 553 |
|
|
void mus_set_little_endian_unsigned_short __P((unsigned char *j, unsigned short x)); |
| 554 |
|
|
unsigned short mus_little_endian_unsigned_short __P((unsigned char *inp)); |
| 555 |
|
|
double mus_little_endian_double __P((unsigned char *inp)); |
| 556 |
|
|
double mus_big_endian_double __P((unsigned char *inp)); |
| 557 |
|
|
void mus_set_big_endian_double __P((unsigned char *j, double x)); |
| 558 |
|
|
void mus_set_little_endian_double __P((unsigned char *j, double x)); |
| 559 |
|
|
unsigned int mus_big_endian_unsigned_int __P((unsigned char *inp)); |
| 560 |
|
|
unsigned int mus_little_endian_unsigned_int __P((unsigned char *inp)); |
| 561 |
|
|
|
| 562 |
|
|
#ifdef SUN |
| 563 |
|
|
void sun_outputs __P((int speakers, int headphones, int line_out)); |
| 564 |
|
|
#endif |
| 565 |
|
|
|
| 566 |
|
|
#if (defined(HAVE_CONFIG_H)) && (!defined(HAVE_STRERROR)) |
| 567 |
|
|
char *strerror __P((int errnum)); |
| 568 |
|
|
#endif |
| 569 |
|
|
|
| 570 |
|
|
void init_sndlib2scm __P((void)); |
| 571 |
|
|
char *mus_complete_filename __P((char *tok)); |
| 572 |
|
|
|
| 573 |
|
|
#if LONG_INT_P |
| 574 |
|
|
int *delist_ptr __P((int arr)); |
| 575 |
|
|
int list_ptr __P((int *arr)); |
| 576 |
|
|
void freearray __P((int ip_1)); |
| 577 |
|
|
#else |
| 578 |
|
|
void freearray __P((int *ip)); |
| 579 |
|
|
#endif |
| 580 |
|
|
|
| 581 |
|
|
int mus_set_data_clipped __P((int tfd, int clipped)); |
| 582 |
|
|
int mus_set_header_type __P((int tfd, int type)); |
| 583 |
|
|
int mus_get_header_type __P((int tfd)); |
| 584 |
|
|
int mus_set_chans __P((int tfd, int chans)); |
| 585 |
|
|
int mus_file2array __P((char *filename, int chan, int start, int samples, int *array)); |
| 586 |
|
|
int mus_array2file __P((char *filename, int *ddata, int len, int srate, int channels)); |
| 587 |
|
|
|
| 588 |
|
|
#ifdef DEBUG_MEMORY |
| 589 |
|
|
void *mem_calloc __P((size_t len, size_t size, char *func, char *file, int line)); |
| 590 |
|
|
void *mem_malloc __P((size_t len, char *func, char *file, int line)); |
| 591 |
|
|
void mem_free __P((void *ptr, char *func, char *file, int line)); |
| 592 |
|
|
void *mem_realloc __P((void *ptr, size_t size, char *func, char *file, int line)); |
| 593 |
|
|
#endif |
| 594 |
|
|
|
| 595 |
|
|
__END_DECLS |
| 596 |
|
|
|
| 597 |
|
|
#endif |