1 /*------------ Telecommunications & Signal Processing Lab -------------- 2 McGill University 3 4 Routine: 5 CopyAudio.h 6 7 Description: 8 Declarations for CopyAudio 9 10 Author / revision: 11 P. Kabal Copyright (C) 2003 12 $Revision: 1.79 $ $Date: 2003/05/13 01:32:38 $ 13 14 ----------------------------------------------------------------------*/ 15 16 #ifndef CopyAudio_h_ 17 #define CopyAudio_h_ 18 19 #define PROGRAM "CopyAudio" 20 #define VERSION "v6r0 2003-05-08" 21 22 #include <libtsp.h> /* typedef for AFILE */ 23 #include <libtsp/AFpar.h> /* struct AF_NHpar */ 24 #include <AO.h> /* struct AO_FIpar, AO_FOpar */ 25 26 #define AFPATH_ENV "$AUDIOPATH" 27 28 #define MAXNI 20 29 #define MAXNO 12 30 #define MAXIFILE 10 31 #define MAXFILE (MAXIFILE+1) 32 #define M_COMB 0 /* Combine mode */ 33 #define M_CONCAT 1 /* Concatenate mode */ 34 35 #define CP_LIM_UNDEF AO_LIM_UNDEF /* Undefined Limits */ 36 #define CP_FIpar AO_FIpar /* Input file structure */ 37 #define CP_FOpar AO_FOpar /* Output file structure */ 38 39 /* y(n,k) = SUM Gain[k][i] * x(n,i) + Offset[k] 40 i 41 */ 42 struct CP_Chgain { 43 int NI; 44 int NO; 45 double Offset[MAXNO]; 46 double Gain[MAXNO][MAXNI]; 47 }; 48 49 #define Chgain_INIT(p) { \ 50 int i__; \ 51 (p)->NI = 0; \ 52 (p)->NO = 0; \ 53 VRdZero ((p)->Offset, MAXNO); \ 54 for (i__ = 0; i__ < MAXNO; ++i__) \ 55 VRdZero ((p)->Gain[i__], MAXNI); } 56 57 /* Warning messages */ 58 #define CPM_DiffSFreq "Input sampling frequencies differ" 59 60 /* Error messages */ 61 #define CPM_BadChanEx "Invalid channel expression" 62 #define CPM_DiffNChan "Different numbers of input channels" 63 #define CPM_EmptyChan "Empty channel expression" 64 #define CPM_ConfNFrame "Sample limits and number of samples conflict" 65 #define CPM_LateFPar "Input file parameter specified after input files" 66 #define CPM_MFName "Too few filenames specified" 67 #define CPM_NoChanSpec "No specification for output channel" 68 #define CPM_NSampNChan "No. samples not a multiple of no. channels" 69 #define CPM_XFName "Too many filenames specified" 70 71 /* Error message formats */ 72 #define CPMF_MNChan "%s: Too few input channels, need %d input channels" 73 74 /* Usage */ 75 #define CPMF_Usage "\ 76 Usage: %s [options] AFileI1 AFileI2 ... AFileO\n\ 77 Options:\n\ 78 -c, --combine Combine samples from multiple input files.\n\ 79 -C, --concatenate Concatenate samples from multiple input files.\n\ 80 -g GAIN, --gain=GAIN Gain factor applied to input files.\n\ 81 -l L:U, --limits=L:U Input file sample limits.\n\ 82 -t FTYPE, --type=FTYPE Input file type,\n\ 83 \"auto\", \"AU\", \"WAVE\", \"AIFF\", \"noheader\",\n\ 84 \"SPHERE\", \"ESPS\", \"IRCAM\", \"SPPACK\",\n\ 85 \"INRS\", \"SPW\", \"NSP\", or \"text\".\n\ 86 -P PARMS, --parameters=PARMS Parameters for headerless input files,\n\ 87 \"Format,Start,Sfreq,Swapb,Nchan,ScaleF\".\n\ 88 -s SFREQ, --srate=SFREQ Sampling frequency for the output file.\n\ 89 -n NSAMPLE, --number_samples=NSAMPLE Number of output samples.\n\ 90 -cA CGAINS, --chanA=CGAINS Scaling factors for output channel A.\n\ 91 ... ...\n\ 92 -cL CGAINS, --chanL=CGAINS Scaling factors for output channel L.\n\ 93 -F FTYPE, --file_type=FTYPE Output file type,\n\ 94 \"AU\", \"WAVE\", \"AIFF\", \"AIFF-C\",\n\ 95 \"noheader\", or \"noheader_swap\".\n\ 96 -D DFORMAT, --data_format=DFORMAT Data format for the output file,\n\ 97 \"mu-law\", \"A-law\", \"unsigned8\", \"integer8\",\n\ 98 \"integer16\", \"integer24\", \"float32\",\n\ 99 \"float64\", or \"text\".\n\ 100 -S SPEAKERS, --speakers=SPEAKERS Loudspeaker positions,\n\ 101 \"FL\", \"FR\", \"FC\", \"LF\", \"BL\", \"BR\", \"FLC\",\n\ 102 \"FRC\", \"BC\", \"SL\", \"SR\", \"TC\", \"TFL\", \"TFC\",\n\ 103 \"TFR\", \"TBL\", \"TBC\", \"TBR\", \"-\"\n\ 104 -I INFO, --info=INFO Header information string.\n\ 105 -h, --help Print a list of options and exit.\n\ 106 -v, --version Print the version number and exit." 107 108 109 #ifdef __cplusplus 110 extern "C" { 111 #endif 112 113 /* Prototypes */ 114 long int 115 CPcombChan (AFILE *AFp[], const long int StartF[], int Nifiles, 116 long int Nframe, const struct CP_Chgain *Chgain, 117 long int MaxNframe, AFILE *AFpO); 118 void 119 CPcopy (int Mode, AFILE *AFp[], const struct CP_FIpar FI[], int Nifiles, 120 const struct CP_Chgain *Chgain, long int Nframe, AFILE *AFpO); 121 long int 122 CPcopyChan (AFILE *AFp[], const long int StartF[], int Nifiles, 123 long int Nframe, long int MaxNframe, AFILE *AFpO); 124 void 125 CPdecChan (const char String[], int Ichan, struct CP_Chgain *Chgain); 126 long int 127 CPlim (int Mode, AFILE *AFp[], const struct CP_FIpar FI[], int Nifiles, 128 long int Nframe); 129 void 130 CPoptions (int argc, const char *argv[], int *Mode, 131 struct CP_FIpar FI[MAXIFILE], int *Nifiles, struct CP_FOpar *FO, 132 struct CP_Chgain *Chgain); 133 134 #ifdef __cplusplus 135 } 136 #endif 137 138 #endif /* CopyAudio_h_ */ 139