34 cout<<
"\nUseage: \n"<<endl;
35 cout<<name<<
" [-t duration] [-o num] [-i num] [-I num] [-g num] outputFileName.ext : the output file name with ext replaced by a known output format extension (see below)"<<endl;
36 cout<<name<<
" -t num : duration in seconds"<<endl;
37 cout<<name<<
" -o num : number of output channels to open at the same time on the audio device"<<endl;
38 cout<<name<<
" -i num : number of input channels to open at the same time on the audio device"<<endl;
39 cout<<name<<
" -I num : total number of test input channels to record"<<endl;
40 cout<<name<<
" -g num : the output gain"<<endl;
43 cout<<
"The known output file extensions (output file formats) are the following :"<<endl;
44 for (
int i=0; i<formats.size(); i++)
45 cout<<formats[i]<<
' ';
58 if (written!=crossAudio.
audio.rows()*crossAudio.
audio.cols()) {
60 cout<<
"written "<<written<<endl;
61 cout<<
"Output matrix size (rows, cols) = ("<<crossAudio.
audio.rows()<<
", "<<crossAudio.
audio.cols()<<
")"<<endl;
62 cout<<
"Matrix is a total of "<<crossAudio.
audio.rows()*crossAudio.
audio.cols()<<
" samples"<<endl;
63 cout<<
"Error writing, exiting."<<endl;
70 int main(
int argc,
char *argv[]) {
75 if (op.
getArg<
string>(
"h", argc, argv, help, i=0)!=0)
81 op.
getArg<
float>(
"t", argc, argv, t, i=0);
82 cout<<
"running for "<<t<<
" seconds"<<endl;
86 op.
getArg<
float>(
"g", argc, argv, g, i=0);
87 cout<<
"using a gain="<<g<<endl;
91 op.
getArg<
int>(
"i", argc, argv, inChCnt, i=0);
92 cout<<
"recording "<<inChCnt<<
" channels of physical input audio to record each time"<<endl;
95 op.
getArg<
int>(
"I", argc, argv, inTestChCnt, i=0);
96 cout<<
"recording "<<inTestChCnt<<
" channels of input audio total, maximum of "<<inChCnt<<
" channels each run."<<endl;
99 op.
getArg<
int>(
"o", argc, argv, outChCnt, i=0);
100 cout<<
"playing "<<outChCnt<<
" channels of output random noise"<<endl;
102 crossAudio.
setChannels(outChCnt, inChCnt, inTestChCnt);
104 cout<<
"Jack : sample rate set to : "<<crossAudio.
getSampleRate()<<
" Hz"<<endl;
105 cout<<
"Jack : block size set to : "<<crossAudio.
getBlockSize()<<
" samples"<<endl;
109 cout<<
"Please press enter to start."<<endl;
120 getline(cin, userInput);
129 cout<<
"\rDone, now going to write to the file "<<argv[argc-1]<<endl;
134 cout<<
"\n\nStart the analysis and press any key to record a new crossover\n"<<endl;
virtual int openWrite(const string &fileName, double fs, int channels, double maxVal)
int getArg(string key, int argc, char *argv[], TYPE &ret, int i)
virtual int getBlockSize()
virtual int evaluateError(int errorNum)
int main(int argc, char *argv[])
vector< string > availableFormats(void)
#define NO_ERROR
There is no error.
int printUsage(string name)
virtual int getNumberOfRecordedChannels()
int setChannels(int outCnt, int inCnt, int testInCnt)
int getSampleRate(void) const
int recordNextChannelSet()
Eigen::Matrix< float, Eigen::Dynamic, Eigen::Dynamic > audio
The first channel is the same data sent over each output channel, then the output channels...
int saveAudioToFile(const char *fn, const CrossoverAudio &crossAudio, const int chCnt)
virtual int write(const vector< vector< FP_TYPE_ > > &audioData)