You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

436 satır
21KB

  1. #ifndef SNDLIB_H
  2. #define SNDLIB_H
  3. #define SNDLIB_VERSION 24
  4. #define SNDLIB_REVISION 4
  5. #define SNDLIB_DATE "1-Sep-15"
  6. #include <stdio.h>
  7. #include <time.h>
  8. #include <sys/types.h>
  9. /* not sure how to handle this one cleanly: */
  10. #ifndef __cplusplus
  11. #ifndef _MSC_VER
  12. #include <stdbool.h>
  13. #else
  14. #ifndef true
  15. #define bool unsigned char
  16. #define true 1
  17. #define false 0
  18. #endif
  19. #endif
  20. #endif
  21. typedef double mus_float_t;
  22. typedef long long int mus_long_t;
  23. #if defined(__sun) && defined(__SVR4)
  24. #define HAVE_SUN 1
  25. #endif
  26. #ifdef _MSC_VER
  27. /* I got these from gmp.h */
  28. #if defined (__GNUC__)
  29. #define MUS_EXPORT __declspec(__dllexport__)
  30. #else
  31. #define MUS_EXPORT __declspec(dllexport)
  32. #endif
  33. #else
  34. #define MUS_EXPORT
  35. #endif
  36. #ifndef MUS_LITTLE_ENDIAN
  37. #if WORDS_BIGENDIAN
  38. #define MUS_LITTLE_ENDIAN 0
  39. #else
  40. #define MUS_LITTLE_ENDIAN 1
  41. #endif
  42. #endif
  43. typedef enum {MUS_UNKNOWN_HEADER, MUS_NEXT, MUS_AIFC, MUS_RIFF, MUS_RF64, MUS_BICSF, MUS_NIST, MUS_INRS, MUS_ESPS, MUS_SVX, MUS_VOC,
  44. MUS_SNDT, MUS_RAW, MUS_SMP, MUS_AVR, MUS_IRCAM, MUS_SD1, MUS_SPPACK, MUS_MUS10, MUS_HCOM, MUS_PSION, MUS_MAUD,
  45. MUS_IEEE, MUS_MATLAB, MUS_ADC, MUS_MIDI, MUS_SOUNDFONT, MUS_GRAVIS, MUS_COMDISCO, MUS_GOLDWAVE, MUS_SRFS,
  46. MUS_MIDI_SAMPLE_DUMP, MUS_DIAMONDWARE, MUS_ADF, MUS_SBSTUDIOII, MUS_DELUSION,
  47. MUS_FARANDOLE, MUS_SAMPLE_DUMP, MUS_ULTRATRACKER, MUS_YAMAHA_SY85, MUS_YAMAHA_TX16W, MUS_DIGIPLAYER,
  48. MUS_COVOX, MUS_AVI, MUS_OMF, MUS_QUICKTIME, MUS_ASF, MUS_YAMAHA_SY99, MUS_KURZWEIL_2000,
  49. MUS_AIFF, MUS_PAF, MUS_CSL, MUS_FILE_SAMP, MUS_PVF, MUS_SOUNDFORGE, MUS_TWINVQ, MUS_AKAI4,
  50. MUS_IMPULSETRACKER, MUS_KORG, MUS_NVF, MUS_CAFF, MUS_MAUI, MUS_SDIF, MUS_OGG, MUS_FLAC, MUS_SPEEX, MUS_MPEG,
  51. MUS_SHORTEN, MUS_TTA, MUS_WAVPACK, MUS_SOX,
  52. MUS_NUM_HEADERS} mus_header_t;
  53. typedef enum {MUS_UNKNOWN_SAMPLE, MUS_BSHORT, MUS_MULAW, MUS_BYTE, MUS_BFLOAT, MUS_BINT, MUS_ALAW, MUS_UBYTE, MUS_B24INT,
  54. MUS_BDOUBLE, MUS_LSHORT, MUS_LINT, MUS_LFLOAT, MUS_LDOUBLE, MUS_UBSHORT, MUS_ULSHORT, MUS_L24INT,
  55. MUS_BINTN, MUS_LINTN, MUS_BFLOAT_UNSCALED, MUS_LFLOAT_UNSCALED, MUS_BDOUBLE_UNSCALED, MUS_LDOUBLE_UNSCALED,
  56. MUS_NUM_SAMPLES} mus_sample_t;
  57. #ifndef MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE
  58. #if WORDS_BIGENDIAN
  59. #if __APPLE__
  60. #define MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE MUS_BFLOAT
  61. #else
  62. #define MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE MUS_BSHORT
  63. #endif
  64. #else
  65. #if __APPLE__
  66. #define MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE MUS_LFLOAT
  67. #else
  68. #define MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE MUS_LSHORT
  69. #endif
  70. #endif
  71. #endif
  72. #ifndef MUS_OUT_SAMPLE_TYPE
  73. #if WORDS_BIGENDIAN
  74. #define MUS_OUT_SAMPLE_TYPE MUS_BDOUBLE
  75. #else
  76. #define MUS_OUT_SAMPLE_TYPE MUS_LDOUBLE
  77. #endif
  78. #endif
  79. #define MUS_IGNORE_SAMPLE MUS_NUM_SAMPLES
  80. /* MUS_LINTN and MUS_BINTN refer to 32 bit ints with 31 bits of fraction -- the data is left justified */
  81. /* "unscaled" means the float value is used directly (i.e. not as -1.0 to 1.0, but (probably) -32768.0 to 32768.0) */
  82. #define MUS_NIST_SHORTPACK 2
  83. #define MUS_AIFF_IMA_ADPCM 99
  84. #define MUS_AUDIO_PACK_SYSTEM(n) ((n) << 16)
  85. #define MUS_AUDIO_SYSTEM(n) (((n) >> 16) & 0xffff)
  86. #define MUS_AUDIO_DEVICE(n) ((n) & 0xffff)
  87. #define MUS_AUDIO_DEFAULT 0
  88. #define MUS_ERROR -1
  89. enum {MUS_NO_ERROR, MUS_NO_FREQUENCY, MUS_NO_PHASE, MUS_NO_GEN, MUS_NO_LENGTH,
  90. MUS_NO_DESCRIBE, MUS_NO_DATA, MUS_NO_SCALER,
  91. MUS_MEMORY_ALLOCATION_FAILED,
  92. MUS_CANT_OPEN_FILE, MUS_NO_SAMPLE_INPUT, MUS_NO_SAMPLE_OUTPUT,
  93. MUS_NO_SUCH_CHANNEL, MUS_NO_FILE_NAME_PROVIDED, MUS_NO_LOCATION, MUS_NO_CHANNEL,
  94. MUS_NO_SUCH_FFT_WINDOW, MUS_UNSUPPORTED_SAMPLE_TYPE, MUS_HEADER_READ_FAILED,
  95. MUS_UNSUPPORTED_HEADER_TYPE,
  96. MUS_FILE_DESCRIPTORS_NOT_INITIALIZED, MUS_NOT_A_SOUND_FILE, MUS_FILE_CLOSED, MUS_WRITE_ERROR,
  97. MUS_HEADER_WRITE_FAILED, MUS_CANT_OPEN_TEMP_FILE, MUS_INTERRUPTED, MUS_BAD_ENVELOPE,
  98. MUS_AUDIO_CHANNELS_NOT_AVAILABLE, MUS_AUDIO_SRATE_NOT_AVAILABLE, MUS_AUDIO_SAMPLE_TYPE_NOT_AVAILABLE,
  99. MUS_AUDIO_NO_INPUT_AVAILABLE, MUS_AUDIO_CONFIGURATION_NOT_AVAILABLE,
  100. MUS_AUDIO_WRITE_ERROR, MUS_AUDIO_SIZE_NOT_AVAILABLE, MUS_AUDIO_DEVICE_NOT_AVAILABLE,
  101. MUS_AUDIO_CANT_CLOSE, MUS_AUDIO_CANT_OPEN, MUS_AUDIO_READ_ERROR,
  102. MUS_AUDIO_CANT_WRITE, MUS_AUDIO_CANT_READ, MUS_AUDIO_NO_READ_PERMISSION,
  103. MUS_CANT_CLOSE_FILE, MUS_ARG_OUT_OF_RANGE,
  104. MUS_NO_CHANNELS, MUS_NO_HOP, MUS_NO_WIDTH, MUS_NO_FILE_NAME, MUS_NO_RAMP, MUS_NO_RUN,
  105. MUS_NO_INCREMENT, MUS_NO_OFFSET,
  106. MUS_NO_XCOEFF, MUS_NO_YCOEFF, MUS_NO_XCOEFFS, MUS_NO_YCOEFFS, MUS_NO_RESET, MUS_BAD_SIZE, MUS_CANT_CONVERT,
  107. MUS_READ_ERROR,
  108. MUS_NO_FEEDFORWARD, MUS_NO_FEEDBACK, MUS_NO_INTERP_TYPE, MUS_NO_POSITION, MUS_NO_ORDER, MUS_NO_COPY,
  109. MUS_CANT_TRANSLATE,
  110. MUS_NUM_ERRORS};
  111. /* keep this list in sync with mus_error_names in sound.c and snd-test.scm|rb */
  112. #define MUS_LOOP_INFO_SIZE 8
  113. #ifdef __cplusplus
  114. extern "C" {
  115. #endif
  116. /* -------- sound.c -------- */
  117. #ifdef __GNUC__
  118. MUS_EXPORT int mus_error(int error, const char *format, ...) __attribute__ ((format (printf, 2, 3)));
  119. MUS_EXPORT void mus_print(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
  120. MUS_EXPORT char *mus_format(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
  121. #else
  122. MUS_EXPORT int mus_error(int error, const char *format, ...);
  123. MUS_EXPORT void mus_print(const char *format, ...);
  124. MUS_EXPORT char *mus_format(const char *format, ...);
  125. #endif
  126. typedef void mus_error_handler_t(int type, char *msg);
  127. MUS_EXPORT mus_error_handler_t *mus_error_set_handler(mus_error_handler_t *new_error_handler);
  128. MUS_EXPORT const char *mus_error_type_to_string(int err);
  129. typedef void mus_print_handler_t(char *msg);
  130. MUS_EXPORT mus_print_handler_t *mus_print_set_handler(mus_print_handler_t *new_print_handler);
  131. typedef mus_float_t mus_clip_handler_t(mus_float_t val);
  132. MUS_EXPORT mus_clip_handler_t *mus_clip_set_handler(mus_clip_handler_t *new_clip_handler);
  133. MUS_EXPORT mus_clip_handler_t *mus_clip_set_handler_and_checker(mus_clip_handler_t *new_clip_handler, bool (*checker)(void));
  134. MUS_EXPORT mus_long_t mus_sound_samples(const char *arg);
  135. MUS_EXPORT mus_long_t mus_sound_framples(const char *arg);
  136. MUS_EXPORT int mus_sound_datum_size(const char *arg);
  137. MUS_EXPORT mus_long_t mus_sound_data_location(const char *arg);
  138. MUS_EXPORT int mus_sound_chans(const char *arg);
  139. MUS_EXPORT int mus_sound_srate(const char *arg);
  140. MUS_EXPORT mus_header_t mus_sound_header_type(const char *arg);
  141. MUS_EXPORT mus_sample_t mus_sound_sample_type(const char *arg);
  142. MUS_EXPORT int mus_sound_original_sample_type(const char *arg);
  143. MUS_EXPORT mus_long_t mus_sound_comment_start(const char *arg);
  144. MUS_EXPORT mus_long_t mus_sound_comment_end(const char *arg);
  145. MUS_EXPORT mus_long_t mus_sound_length(const char *arg);
  146. MUS_EXPORT int mus_sound_fact_samples(const char *arg);
  147. MUS_EXPORT time_t mus_sound_write_date(const char *arg);
  148. MUS_EXPORT int mus_sound_type_specifier(const char *arg);
  149. MUS_EXPORT int mus_sound_block_align(const char *arg);
  150. MUS_EXPORT int mus_sound_bits_per_sample(const char *arg);
  151. MUS_EXPORT int mus_sound_set_chans(const char *arg, int val);
  152. MUS_EXPORT int mus_sound_set_srate(const char *arg, int val);
  153. MUS_EXPORT mus_header_t mus_sound_set_header_type(const char *arg, mus_header_t val);
  154. MUS_EXPORT mus_sample_t mus_sound_set_sample_type(const char *arg, mus_sample_t val);
  155. MUS_EXPORT int mus_sound_set_data_location(const char *arg, mus_long_t val);
  156. MUS_EXPORT int mus_sound_set_samples(const char *arg, mus_long_t val);
  157. MUS_EXPORT const char *mus_header_type_name(mus_header_t type);
  158. MUS_EXPORT const char *mus_header_type_to_string(mus_header_t type);
  159. MUS_EXPORT const char *mus_sample_type_name(mus_sample_t samp_type);
  160. MUS_EXPORT const char *mus_sample_type_to_string(mus_sample_t samp_type);
  161. MUS_EXPORT const char *mus_sample_type_short_name(mus_sample_t samp_type);
  162. MUS_EXPORT char *mus_sound_comment(const char *name);
  163. MUS_EXPORT int mus_bytes_per_sample(mus_sample_t samp_type);
  164. MUS_EXPORT float mus_sound_duration(const char *arg);
  165. MUS_EXPORT int mus_sound_initialize(void);
  166. MUS_EXPORT int mus_sound_override_header(const char *arg, int srate, int chans, mus_sample_t samp_type, mus_header_t type, mus_long_t location, mus_long_t size);
  167. MUS_EXPORT int mus_sound_forget(const char *name);
  168. MUS_EXPORT int mus_sound_prune(void);
  169. MUS_EXPORT void mus_sound_report_cache(FILE *fp);
  170. MUS_EXPORT int *mus_sound_loop_info(const char *arg);
  171. MUS_EXPORT void mus_sound_set_loop_info(const char *arg, int *loop);
  172. MUS_EXPORT int mus_sound_mark_info(const char *arg, int **mark_ids, int **mark_positions);
  173. MUS_EXPORT int mus_sound_open_input(const char *arg);
  174. MUS_EXPORT int mus_sound_open_output(const char *arg, int srate, int chans, mus_sample_t sample_type, mus_header_t header_type, const char *comment);
  175. MUS_EXPORT int mus_sound_reopen_output(const char *arg, int chans, mus_sample_t samp_type, mus_header_t type, mus_long_t data_loc);
  176. MUS_EXPORT int mus_sound_close_input(int fd);
  177. MUS_EXPORT int mus_sound_close_output(int fd, mus_long_t bytes_of_data);
  178. #define mus_sound_read(Fd, Beg, End, Chans, Bufs) mus_file_read(Fd, Beg, End, Chans, Bufs)
  179. #define mus_sound_write(Fd, Beg, End, Chans, Bufs) mus_file_write(Fd, Beg, End, Chans, Bufs)
  180. MUS_EXPORT mus_long_t mus_sound_maxamps(const char *ifile, int chans, mus_float_t *vals, mus_long_t *times);
  181. MUS_EXPORT int mus_sound_set_maxamps(const char *ifile, int chans, mus_float_t *vals, mus_long_t *times);
  182. MUS_EXPORT bool mus_sound_maxamp_exists(const char *ifile);
  183. MUS_EXPORT bool mus_sound_channel_maxamp_exists(const char *file, int chan);
  184. MUS_EXPORT mus_float_t mus_sound_channel_maxamp(const char *file, int chan, mus_long_t *pos);
  185. MUS_EXPORT void mus_sound_channel_set_maxamp(const char *file, int chan, mus_float_t mx, mus_long_t pos);
  186. MUS_EXPORT mus_long_t mus_file_to_array(const char *filename, int chan, mus_long_t start, mus_long_t samples, mus_float_t *array);
  187. MUS_EXPORT int mus_array_to_file(const char *filename, mus_float_t *ddata, mus_long_t len, int srate, int channels);
  188. MUS_EXPORT const char *mus_array_to_file_with_error(const char *filename, mus_float_t *ddata, mus_long_t len, int srate, int channels);
  189. MUS_EXPORT mus_long_t mus_file_to_float_array(const char *filename, int chan, mus_long_t start, mus_long_t samples, mus_float_t *array);
  190. MUS_EXPORT int mus_float_array_to_file(const char *filename, mus_float_t *ddata, mus_long_t len, int srate, int channels);
  191. MUS_EXPORT mus_float_t **mus_sound_saved_data(const char *arg);
  192. MUS_EXPORT void mus_sound_set_saved_data(const char *arg, mus_float_t **data);
  193. MUS_EXPORT void mus_file_save_data(int tfd, mus_long_t framples, mus_float_t **data);
  194. /* -------- audio.c -------- */
  195. MUS_EXPORT int mus_audio_open_output(int dev, int srate, int chans, mus_sample_t samp_type, int size);
  196. MUS_EXPORT int mus_audio_open_input(int dev, int srate, int chans, mus_sample_t samp_type, int size);
  197. MUS_EXPORT int mus_audio_write(int line, char *buf, int bytes);
  198. MUS_EXPORT int mus_audio_close(int line);
  199. MUS_EXPORT int mus_audio_read(int line, char *buf, int bytes);
  200. MUS_EXPORT int mus_audio_initialize(void);
  201. MUS_EXPORT char *mus_audio_moniker(void);
  202. MUS_EXPORT int mus_audio_api(void);
  203. MUS_EXPORT mus_sample_t mus_audio_compatible_sample_type(int dev);
  204. #if HAVE_OSS || HAVE_ALSA
  205. MUS_EXPORT void mus_oss_set_buffers(int num, int size);
  206. MUS_EXPORT char *mus_alsa_playback_device(void);
  207. MUS_EXPORT char *mus_alsa_set_playback_device(const char *name);
  208. MUS_EXPORT char *mus_alsa_capture_device(void);
  209. MUS_EXPORT char *mus_alsa_set_capture_device(const char *name);
  210. MUS_EXPORT char *mus_alsa_device(void);
  211. MUS_EXPORT char *mus_alsa_set_device(const char *name);
  212. MUS_EXPORT int mus_alsa_buffer_size(void);
  213. MUS_EXPORT int mus_alsa_set_buffer_size(int size);
  214. MUS_EXPORT int mus_alsa_buffers(void);
  215. MUS_EXPORT int mus_alsa_set_buffers(int num);
  216. MUS_EXPORT bool mus_alsa_squelch_warning(void);
  217. MUS_EXPORT bool mus_alsa_set_squelch_warning(bool val);
  218. #endif
  219. #if __APPLE__
  220. MUS_EXPORT bool mus_audio_output_properties_mutable(bool mut);
  221. #endif
  222. MUS_EXPORT int mus_audio_device_channels(int dev);
  223. MUS_EXPORT mus_sample_t mus_audio_device_sample_type(int dev);
  224. /* -------- io.c -------- */
  225. MUS_EXPORT int mus_file_open_descriptors(int tfd, const char *arg, mus_sample_t df, int ds, mus_long_t dl, int dc, mus_header_t dt);
  226. MUS_EXPORT int mus_file_open_read(const char *arg);
  227. MUS_EXPORT bool mus_file_probe(const char *arg);
  228. MUS_EXPORT int mus_file_open_write(const char *arg);
  229. MUS_EXPORT int mus_file_create(const char *arg);
  230. MUS_EXPORT int mus_file_reopen_write(const char *arg);
  231. MUS_EXPORT int mus_file_close(int fd);
  232. MUS_EXPORT mus_long_t mus_file_seek_frample(int tfd, mus_long_t frample);
  233. MUS_EXPORT mus_long_t mus_file_read(int fd, mus_long_t beg, mus_long_t end, int chans, mus_float_t **bufs);
  234. MUS_EXPORT mus_long_t mus_file_read_chans(int fd, mus_long_t beg, mus_long_t end, int chans, mus_float_t **bufs, mus_float_t **cm);
  235. MUS_EXPORT int mus_file_write(int tfd, mus_long_t beg, mus_long_t end, int chans, mus_float_t **bufs);
  236. MUS_EXPORT mus_long_t mus_file_read_any(int tfd, mus_long_t beg, int chans, mus_long_t nints, mus_float_t **bufs, mus_float_t **cm);
  237. MUS_EXPORT mus_long_t mus_file_read_file(int tfd, mus_long_t beg, int chans, mus_long_t nints, mus_float_t **bufs);
  238. MUS_EXPORT mus_long_t mus_file_read_buffer(int charbuf_sample_type, mus_long_t beg, int chans, mus_long_t nints, mus_float_t **bufs, char *charbuf);
  239. MUS_EXPORT int mus_file_write_file(int tfd, mus_long_t beg, mus_long_t end, int chans, mus_float_t **bufs);
  240. MUS_EXPORT int mus_file_write_buffer(int charbuf_sample_type, mus_long_t beg, mus_long_t end, int chans, mus_float_t **bufs, char *charbuf, bool clipped);
  241. MUS_EXPORT char *mus_expand_filename(const char *name);
  242. MUS_EXPORT char *mus_getcwd(void);
  243. MUS_EXPORT bool mus_clipping(void);
  244. MUS_EXPORT bool mus_set_clipping(bool new_value);
  245. MUS_EXPORT bool mus_file_clipping(int tfd);
  246. MUS_EXPORT int mus_file_set_clipping(int tfd, bool clipped);
  247. MUS_EXPORT int mus_file_set_header_type(int tfd, mus_header_t type);
  248. MUS_EXPORT mus_header_t mus_file_header_type(int tfd);
  249. MUS_EXPORT char *mus_file_fd_name(int tfd);
  250. MUS_EXPORT int mus_file_set_chans(int tfd, int chans);
  251. MUS_EXPORT int mus_iclamp(int lo, int val, int hi);
  252. MUS_EXPORT mus_long_t mus_oclamp(mus_long_t lo, mus_long_t val, mus_long_t hi);
  253. MUS_EXPORT mus_float_t mus_fclamp(mus_float_t lo, mus_float_t val, mus_float_t hi);
  254. /* for CLM */
  255. /* these are needed to clear a saved lisp image to the just-initialized state */
  256. MUS_EXPORT void mus_reset_io_c(void);
  257. MUS_EXPORT void mus_reset_headers_c(void);
  258. MUS_EXPORT void mus_reset_audio_c(void);
  259. MUS_EXPORT int mus_samples_bounds(unsigned char *data, int bytes, int chan, int chans, mus_sample_t samp_type, mus_float_t *min_samp, mus_float_t *max_samp);
  260. MUS_EXPORT mus_long_t mus_max_malloc(void);
  261. MUS_EXPORT mus_long_t mus_set_max_malloc(mus_long_t new_max);
  262. MUS_EXPORT mus_long_t mus_max_table_size(void);
  263. MUS_EXPORT mus_long_t mus_set_max_table_size(mus_long_t new_max);
  264. MUS_EXPORT char *mus_strdup(const char *str);
  265. MUS_EXPORT int mus_strlen(const char *str);
  266. MUS_EXPORT bool mus_strcmp(const char *str1, const char *str2);
  267. MUS_EXPORT char *mus_strcat(char *errmsg, const char *str, int *err_size);
  268. /* -------- headers.c -------- */
  269. MUS_EXPORT bool mus_is_sample_type(int n);
  270. MUS_EXPORT bool mus_is_header_type(int n);
  271. MUS_EXPORT mus_long_t mus_header_samples(void);
  272. MUS_EXPORT mus_long_t mus_header_data_location(void);
  273. MUS_EXPORT int mus_header_chans(void);
  274. MUS_EXPORT int mus_header_srate(void);
  275. MUS_EXPORT mus_header_t mus_header_type(void);
  276. MUS_EXPORT mus_sample_t mus_header_sample_type(void);
  277. MUS_EXPORT mus_long_t mus_header_comment_start(void);
  278. MUS_EXPORT mus_long_t mus_header_comment_end(void);
  279. MUS_EXPORT int mus_header_type_specifier(void);
  280. MUS_EXPORT int mus_header_bits_per_sample(void);
  281. MUS_EXPORT int mus_header_fact_samples(void);
  282. MUS_EXPORT int mus_header_block_align(void);
  283. MUS_EXPORT int mus_header_loop_mode(int which);
  284. MUS_EXPORT int mus_header_loop_start(int which);
  285. MUS_EXPORT int mus_header_loop_end(int which);
  286. MUS_EXPORT int mus_header_mark_position(int id);
  287. MUS_EXPORT int mus_header_mark_info(int **marker_ids, int **marker_positions);
  288. MUS_EXPORT int mus_header_base_note(void);
  289. MUS_EXPORT int mus_header_base_detune(void);
  290. MUS_EXPORT void mus_header_set_raw_defaults(int sr, int chn, mus_sample_t frm);
  291. MUS_EXPORT void mus_header_raw_defaults(int *sr, int *chn, mus_sample_t *frm);
  292. MUS_EXPORT mus_long_t mus_header_true_length(void);
  293. MUS_EXPORT int mus_header_original_sample_type(void);
  294. MUS_EXPORT mus_long_t mus_samples_to_bytes(mus_sample_t samp_type, mus_long_t size);
  295. MUS_EXPORT mus_long_t mus_bytes_to_samples(mus_sample_t samp_type, mus_long_t size);
  296. MUS_EXPORT int mus_header_read(const char *name);
  297. MUS_EXPORT int mus_header_write(const char *name, mus_header_t type, int srate, int chans, mus_long_t loc, mus_long_t size_in_samples,
  298. mus_sample_t samp_type, const char *comment, int len);
  299. MUS_EXPORT int mus_write_header(const char *name, mus_header_t type, int in_srate, int in_chans, mus_long_t size_in_samples,
  300. mus_sample_t samp_type, const char *comment);
  301. MUS_EXPORT mus_long_t mus_header_aux_comment_start(int n);
  302. MUS_EXPORT mus_long_t mus_header_aux_comment_end(int n);
  303. MUS_EXPORT int mus_header_initialize(void);
  304. MUS_EXPORT bool mus_header_writable(mus_header_t type, mus_sample_t samp_type);
  305. MUS_EXPORT void mus_header_set_aiff_loop_info(int *data);
  306. MUS_EXPORT int mus_header_sf2_entries(void);
  307. MUS_EXPORT char *mus_header_sf2_name(int n);
  308. MUS_EXPORT int mus_header_sf2_start(int n);
  309. MUS_EXPORT int mus_header_sf2_end(int n);
  310. MUS_EXPORT int mus_header_sf2_loop_start(int n);
  311. MUS_EXPORT int mus_header_sf2_loop_end(int n);
  312. MUS_EXPORT const char *mus_header_original_sample_type_name(int samp_type, mus_header_t type);
  313. MUS_EXPORT bool mus_header_no_header(const char *name);
  314. MUS_EXPORT char *mus_header_riff_aux_comment(const char *name, mus_long_t *starts, mus_long_t *ends);
  315. MUS_EXPORT char *mus_header_aiff_aux_comment(const char *name, mus_long_t *starts, mus_long_t *ends);
  316. MUS_EXPORT int mus_header_change_chans(const char *filename, mus_header_t type, int new_chans);
  317. MUS_EXPORT int mus_header_change_srate(const char *filename, mus_header_t type, int new_srate);
  318. MUS_EXPORT int mus_header_change_type(const char *filename, mus_header_t new_type, mus_sample_t new_sample_type);
  319. MUS_EXPORT int mus_header_change_sample_type(const char *filename, mus_header_t type, mus_sample_t new_sample_type);
  320. MUS_EXPORT int mus_header_change_location(const char *filename, mus_header_t type, mus_long_t new_location);
  321. MUS_EXPORT int mus_header_change_comment(const char *filename, mus_header_t type, const char *new_comment);
  322. MUS_EXPORT int mus_header_change_data_size(const char *filename, mus_header_t type, mus_long_t bytes);
  323. typedef void mus_header_write_hook_t(const char *filename);
  324. MUS_EXPORT mus_header_write_hook_t *mus_header_write_set_hook(mus_header_write_hook_t *new_hook);
  325. /* these are internal to sndlib */
  326. void mus_bint_to_char(unsigned char *j, int x);
  327. void mus_lint_to_char(unsigned char *j, int x);
  328. void mus_bfloat_to_char(unsigned char *j, float x);
  329. void mus_lfloat_to_char(unsigned char *j, float x);
  330. void mus_bshort_to_char(unsigned char *j, short x);
  331. void mus_lshort_to_char(unsigned char *j, short x);
  332. void mus_bdouble_to_char(unsigned char *j, double x);
  333. void mus_blong_to_char(unsigned char *j, mus_long_t x);
  334. void mus_llong_to_char(unsigned char *j, mus_long_t x);
  335. int mus_char_to_bint(const unsigned char *inp);
  336. int mus_char_to_lint(const unsigned char *inp);
  337. mus_long_t mus_char_to_llong(const unsigned char *inp);
  338. mus_long_t mus_char_to_blong(const unsigned char *inp);
  339. int mus_char_to_uninterpreted_int(const unsigned char *inp);
  340. float mus_char_to_bfloat(const unsigned char *inp);
  341. float mus_char_to_lfloat(const unsigned char *inp);
  342. short mus_char_to_bshort(const unsigned char *inp);
  343. short mus_char_to_lshort(const unsigned char *inp);
  344. unsigned short mus_char_to_ubshort(const unsigned char *inp);
  345. unsigned short mus_char_to_ulshort(const unsigned char *inp);
  346. double mus_char_to_ldouble(const unsigned char *inp);
  347. double mus_char_to_bdouble(const unsigned char *inp);
  348. unsigned int mus_char_to_ubint(const unsigned char *inp);
  349. unsigned int mus_char_to_ulint(const unsigned char *inp);
  350. #ifdef __cplusplus
  351. }
  352. #endif
  353. #if (!DISABLE_DEPRECATED)
  354. #define mus_header_format mus_header_sample_type
  355. #define mus_header_original_format mus_header_original_sample_type
  356. #define mus_header_original_format_name mus_header_original_sample_type_name
  357. #define mus_header_change_format mus_header_change_sample_type
  358. #define mus_sound_original_format mus_sound_original_sample_type
  359. #define MUS_AUDIO_COMPATIBLE_FORMAT MUS_AUDIO_COMPATIBLE_SAMPLE_TYPE
  360. #define MUS_OUT_FORMAT MUS_OUT_SAMPLE_TYPE
  361. #define MUS_AUDIO_FORMAT_NOT_AVAILABLE MUS_AUDIO_SAMPLE_TYPE_NOT_AVAILABLE
  362. #define mus_audio_compatible_format mus_audio_compatible_sample_type
  363. #define mus_audio_device_format mus_audio_device_sample_type
  364. #endif
  365. #endif