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; }
void test_server(void) { const char *instrument = "instr 1 \n" "k1 expon p4, p3, p4*0.001 \n" "a1 randi k1, p5 \n" "out a1 \n" "endin \n"; Csound csound; csound.SetOption((char*)"-odac"); csound.SetOption((char*)"--port=44100"); csound.Start(); CsoundPerformanceThread performanceThread(csound.GetCsound()); performanceThread.Play(); udp_send(instrument); udp_send("$i1 0 2 1000 1000"); csoundSleep(3000); udp_send("##close##"); performanceThread.Join(); csound.Cleanup(); csound.Reset(); }