soundio.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef CSOUND_SOUNDIO_H
00025 #define CSOUND_SOUNDIO_H
00026
00027 #include <sndfile.h>
00028
00029 #ifdef WIN32
00030 #define IOBUFSAMPS 4096
00031 #define IODACSAMPS 16384
00032 #elif defined(NeXT) || defined(__MACH__)
00033 #define IOBUFSAMPS 1024
00034 #define IODACSAMPS 4096
00035 #else
00036 #define IOBUFSAMPS 256
00037 #define IODACSAMPS 1024
00038 #endif
00039
00040 #define SNDINBUFSIZ 4096
00041
00042
00043
00044
00045 #define AE_CHAR SF_FORMAT_PCM_S8
00046 #define AE_SHORT SF_FORMAT_PCM_16
00047 #define AE_24INT SF_FORMAT_PCM_24
00048 #define AE_LONG SF_FORMAT_PCM_32
00049 #define AE_UNCH SF_FORMAT_PCM_U8
00050 #define AE_FLOAT SF_FORMAT_FLOAT
00051 #define AE_DOUBLE SF_FORMAT_DOUBLE
00052 #define AE_ULAW SF_FORMAT_ULAW
00053 #define AE_ALAW SF_FORMAT_ALAW
00054 #define AE_IMA_ADPCM SF_FORMAT_IMA_ADPCM
00055 #define AE_MS_ADPCM SF_FORMAT_MS_ADPCM
00056 #define AE_GSM610 SF_FORMAT_GSM610
00057 #define AE_VOX SF_FORMAT_VOX_ADPCM
00058 #define AE_G721_32 SF_FORMAT_G721_32
00059 #define AE_G723_24 SF_FORMAT_G723_24
00060 #define AE_G723_40 SF_FORMAT_G723_40
00061 #define AE_DWVW_12 SF_FORMAT_DWVW_12
00062 #define AE_DWVW_16 SF_FORMAT_DWVW_16
00063 #define AE_DWVW_24 SF_FORMAT_DWVW_24
00064 #define AE_DWVW_N SF_FORMAT_DWVW_N
00065 #define AE_DPCM_8 SF_FORMAT_DPCM_8
00066 #define AE_DPCM_16 SF_FORMAT_DPCM_16
00067
00068 #define AE_LAST SF_FORMAT_DPCM_16
00069
00070
00071
00072 #define TYP_WAV (SF_FORMAT_WAV >> 16)
00073 #define TYP_AIFF (SF_FORMAT_AIFF >> 16)
00074 #define TYP_AU (SF_FORMAT_AU >> 16)
00075 #define TYP_RAW (SF_FORMAT_RAW >> 16)
00076 #define TYP_PAF (SF_FORMAT_PAF >> 16)
00077 #define TYP_SVX (SF_FORMAT_SVX >> 16)
00078 #define TYP_NIST (SF_FORMAT_NIST >> 16)
00079 #define TYP_VOC (SF_FORMAT_VOC >> 16)
00080 #define TYP_IRCAM (SF_FORMAT_IRCAM >> 16)
00081 #define TYP_W64 (SF_FORMAT_W64 >> 16)
00082 #define TYP_MAT4 (SF_FORMAT_MAT4 >> 16)
00083 #define TYP_MAT5 (SF_FORMAT_MAT5 >> 16)
00084 #define TYP_PVF (SF_FORMAT_PVF >> 16)
00085 #define TYP_XI (SF_FORMAT_XI >> 16)
00086 #define TYP_HTK (SF_FORMAT_HTK >> 16)
00087 #define TYP_SDS (SF_FORMAT_SDS >> 16)
00088 #define TYP_AVR (SF_FORMAT_AVR >> 16)
00089 #define TYP_WAVEX (SF_FORMAT_WAVEX >> 16)
00090 #if defined(HAVE_LIBSNDFILE) && HAVE_LIBSNDFILE >= 1011
00091 # define TYP_SD2 (SF_FORMAT_SD2 >> 16)
00092 # if HAVE_LIBSNDFILE >= 1013
00093 # define TYP_FLAC (SF_FORMAT_FLAC >> 16)
00094 # define TYP_CAF (SF_FORMAT_CAF >> 16)
00095 # endif
00096 #endif
00097
00098 #define FORMAT2SF(x) ((int) (x))
00099 #define SF2FORMAT(x) ((int) (x) & 0xFFFF)
00100 #define TYPE2SF(x) ((int) (x) << 16)
00101 #define SF2TYPE(x) ((int) (x& SF_FORMAT_TYPEMASK) >> 16)
00102
00103 #ifdef USE_DOUBLE
00104 #define sf_write_MYFLT sf_write_double
00105 #define sf_read_MYFLT sf_read_double
00106 #else
00107 #define sf_write_MYFLT sf_write_float
00108 #define sf_read_MYFLT sf_read_float
00109 #endif
00110
00111 #ifdef __cplusplus
00112 extern "C" {
00113 #endif
00114
00115
00116
00117 typedef struct {
00118 SNDFILE *sinfd;
00119 MYFLT *inbufp, *bufend;
00120 void *fd;
00121 int bufsmps;
00122 int format;
00123 int channel;
00124 int nchanls;
00125 int sampframsiz;
00126 int filetyp;
00127 int analonly;
00128 int endfile;
00129 int sr;
00130 int do_floatscaling;
00131 int64_t audrem, framesrem, getframes;
00132 MYFLT fscalefac;
00133 MYFLT skiptime;
00134 char sfname[512];
00135 MYFLT inbuf[SNDINBUFSIZ];
00136 } SOUNDIN;
00137
00138 #ifdef __cplusplus
00139 }
00140 #endif
00141
00142 #endif
00143