int main() { //Create an instance of Csound Csound* csound = new Csound(); //compile instance of csound. csound->Compile("test2.csd"); //prepare Csound for performance csound->Start(); char tmp_string[4096] = {0}; //perform entire score while(csound->PerformKsmps()==0) { csound->GetStringChannel ("stringChannel", tmp_string); cout << tmp_string << " "; } //free Csound object delete csound; return 0; }
int main(int argc, char **argv) { if (argc == 1) { cout << "Usage:" << endl; cout << argv[0] << " [filename.csd] [instrument number] [ksmps offset]" << endl; return -1; } int ksmpsOffset = atoi(argv[3]); Csound* csound = new Csound(); csound->Compile(2, (const char **)argv); csound->Start(); csoundDebuggerInit(csound->GetCsound()); csoundSetBreakpointCallback(csound->GetCsound(), brkpt_cb, NULL); cout << "Csound filename: " << argv[1] << '\n'; cout << "Instr number:" << argv[2] << '\n'; double instr = atof(argv[2]); if (instr >= 1.0) { csoundSetInstrumentBreakpoint(csound->GetCsound(), instr, ksmpsOffset); } else { cout << "Invalid instrument breakpoint: " << instr; } csound->Perform(); csoundDebuggerClean(csound->GetCsound()); delete csound; }