25static char *
Version =
"stereorize 1.1, November 5th 2000";
27"Usage: stereorize [options] infile-left infile-right outfile\n\n"
30" stereorize left.wav right.wav stereo.wav -h\n\n"
32"Creates stereo.wav (with WAV-header, option -h) from data in mono files\n"
33"left.wav and right.wav.\n"
38 int i, k[2], maxk, stdin_in_use=
FALSE;
39 short *leftsample, *rightsample, *stereosample;
41 char *filename[2], *tempname;
51 for (i = 0; i < 2; i++)
54 if (filename[i] ==
NULL)
56 if (strcmp (filename[i],
"-") == 0)
60 "Cannot use <stdin> for both input files");
61 filename[i] =
"<stdin>";
67 channel[i] = fopen(filename[i],
"rb");
69 if (channel[i] ==
NULL)
70 fatalerror(
"Error opening input file '%s': %s\n", filename[i],strerror(
errno));
72 inform(
"Using file '%s' as input\n", filename[i]);
74 for (i = 0; i < 2; i++)
76 assert ( channel[i] !=
NULL);
79 inform(
"Warning: '%s' is no mono file\n", filename[i]);
106 if (leftsample ==
NULL || rightsample ==
NULL || stereosample ==
NULL)
112 if ((strcmp(
outfilename,
"<stdout>")!=0) && (fseek(
out, 0, SEEK_SET) != 0))
121 for (i = 0; i < 2; i++)
123 k[i] = fread(i==0? leftsample : rightsample,
128 fatalerror(
"Error reading file '%s': %s\n", filename[i],strerror(
errno));
138 for (i = 0; i < k[0]; i++)
139 stereosample[2 * i] = leftsample[i];
143 for (; i < maxk; i++)
144 stereosample[2 * i] = 0;
149 for (i = 0; i < k[1]; i++)
150 stereosample[2 * i + 1] = rightsample[i];
154 for (; i < maxk; i++)
155 stereosample[2 * i + 1] = 0;
157 if (!fwrite(stereosample,
sizeof(*leftsample), 2 * maxk,
out)) {
158 fatalerror(
"Error writing to file '%s': %s\n",
static char version[AST_MAX_EXTENSION]
static struct channel_usage channels
int main(int argcount, char *args[])
Time-related functions and macros.
void argerrornum(char *s, Errornum code)
void fatalperror(const char *string)
void readwavheader(FILE *anyin)
void argerrortxt(char *s, char *message)
void fatalerror(const char *format,...)
int inform(const char *format,...)
void checknoargs(int argcount, char *args[])
char * parsefilearg(int argcount, char *args[])
void parseargs(int argcount, char *args[], int fileswitch)
void startstopwatch(void)