MCPcopy Create free account
hub / github.com/csound/csound / CsPerfThreadMsg_ScoreEvent

Class CsPerfThreadMsg_ScoreEvent

interfaces/csPerfThread.cpp:305–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

303 */
304
305class CsPerfThreadMsg_ScoreEvent : public CsoundPerformanceThreadMessage {
306 private:
307 char opcod;
308 int absp2mode;
309 int pcnt;
310 MYFLT *pp;
311 MYFLT p[10];
312 public:
313 CsPerfThreadMsg_ScoreEvent(CsoundPerformanceThread *pt,
314 int absp2mode, char opcod,
315 int pcnt, const MYFLT *p)
316 : CsoundPerformanceThreadMessage(pt)
317 {
318 this->opcod = opcod;
319 this->absp2mode = absp2mode;
320 this->pcnt = pcnt;
321 if (pcnt <= 10)
322 this->pp = &(this->p[0]);
323 else
324 this->pp = new MYFLT[(unsigned int) pcnt];
325 for (int i = 0; i < pcnt; i++)
326 this->pp[i] = p[i];
327 }
328 int run() {
329 CSOUND *csound = pt_->GetCsound();
330 if (absp2mode && pcnt > 1) {
331 double p2 = (double) pp[1] - csoundGetScoreTime(csound);
332 if (p2 < 0.0) {
333 if (pcnt > 2 && pp[2] >= (MYFLT) 0 &&
334 (opcod == 'a' || opcod == 'i')) {
335 pp[2] = (MYFLT) ((double) pp[2] + p2);
336 if (pp[2] <= (MYFLT) 0)
337 return 0;
338 }
339 p2 = 0.0;
340 }
341 pp[1] = (MYFLT) p2;
342 }
343 if (csoundScoreEvent(csound, opcod, pp, (long) pcnt) != 0)
344 csoundMessageS(csound, CSOUNDMSG_WARNING,
345 "WARNING: could not create score event\n");
346 return 0;
347 }
348 ~CsPerfThreadMsg_ScoreEvent()
349 {
350 if (pcnt > 10)
351 delete[] pp;
352 }
353};
354
355/**
356 * Score event message as a string

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected