Skip to content

Commit

Permalink
suppressed enqueueing of messages with -m0
Browse files Browse the repository at this point in the history
  • Loading branch information
vlazzarini committed Dec 17, 2017
1 parent ef21135 commit b17534c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
15 changes: 10 additions & 5 deletions Engine/insert.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ static void print_messages(CSOUND *csound, int attr, const char *str){
if ((attr & CSOUNDMSG_TYPE_MASK) == CSOUNDMSG_STDOUT)
fp = stdout;
if (!attr || !csound->enableMsgAttr) {
fprintf(fp, str);
fprintf(fp, "%s", str);
return;
}
if ((attr & CSOUNDMSG_TYPE_MASK) == CSOUNDMSG_ORCH)
Expand All @@ -75,14 +75,14 @@ static void print_messages(CSOUND *csound, int attr, const char *str){
}
if (attr & CSOUNDMSG_FG_COLOR_MASK)
fprintf(fp, "\033[3%cm", (attr & 7) + '0');
fprintf(fp, str);
fprintf(fp, "%s", str);
fprintf(fp, "\033[m");
#endif
}

#define QUEUESIZ 64

void message_string_enqueue(CSOUND *csound, int attr,
static void message_string_enqueue(CSOUND *csound, int attr,
const char *str) {
unsigned long wp = csound->message_string_queue_wp;
csound->message_string_queue[wp].attr = attr;
Expand All @@ -91,6 +91,8 @@ void message_string_enqueue(CSOUND *csound, int attr,
ATOMIC_INCR(csound->message_string_queue_items);
}

static void no_op(CSOUND *csound, int attr,
const char *format, va_list args) { };

/*
* creates a thread to process instance allocations
Expand All @@ -109,6 +111,7 @@ uintptr_t event_insert_thread(void *p) {
const char *format,
va_list args)
= csound->csoundMessageCallback_;
if(csound->oparms_.msglevel){
if(csound->message_string_queue == NULL)
csound->message_string_queue = (message_string_queue_t *)
csound->Calloc(csound, QUEUESIZ*sizeof(message_string_queue_t));
Expand All @@ -117,6 +120,8 @@ uintptr_t event_insert_thread(void *p) {
csoundMessageStringCallback = csound->csoundMessageStringCallback;
else csoundMessageStringCallback = print_messages;
csoundSetMessageStringCallback(csound, message_string_enqueue);
} else
csoundSetMessageCallback(csound, no_op);

while(csound->event_insert_loop) {
// get the value of items_to_alloc
Expand Down Expand Up @@ -439,7 +444,7 @@ int insert_event(CSOUND *csound, int insno, EVTBLK *newevtp)
#ifdef BETA
if (UNLIKELY(O->odebug))
csound->Message(csound, "In insert: %d %lf %lf\n",
__LINE__, ip->p3, ip->offtim); /* *********** */
__LINE__, ip->p3.value, ip->offtim); /* *********** */
#endif
if (ip->p3.value > FL(0.0) && ip->offtim > 0.0) { /* if still finite time, */
double p2 = (double) ip->p2.value + csound->timeOffs;
Expand Down Expand Up @@ -808,7 +813,7 @@ static void schedofftim(CSOUND *csound, INSDS *ip)
}
#ifdef BETA
if (UNLIKELY(csound->oparms->odebug))
csound->Message(csound,"schedofftim: %lf %lf\n", ip->offtim,
csound->Message(csound,"schedofftim: %lf %lf %lf \n", ip->offtim,
(csound->icurTime + (0.505 * csound->ksmps))/csound->esr,
csound->ekr*((csound->icurTime +
(0.505 * csound->ksmps))/csound->esr));
Expand Down
2 changes: 1 addition & 1 deletion OOps/ugens2.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ int phsor(CSOUND *csound, PHSOR *p)
uint32_t n, nsmps = CS_KSMPS;
MYFLT *rs, onedsr = csound->onedsr;
double incr;

rs = p->sr;
if (UNLIKELY(offset)) memset(rs, '\0', offset*sizeof(MYFLT));
if (UNLIKELY(early)) {
Expand Down
2 changes: 1 addition & 1 deletion Top/csound.c
Original file line number Diff line number Diff line change
Expand Up @@ -1656,7 +1656,7 @@ int kperf_nodebug(CSOUND *csound)
ip->spout = csound->spraw;
ip->kcounter = csound->kcounter;
if (ip->ksmps == csound->ksmps) {
while ((opstart = opstart->nxtp) != NULL) {
while ((opstart = opstart->nxtp) != NULL && ip->actflg) {
opstart->insdshead->pds = opstart;
(*opstart->opadr)(csound, opstart); /* run each opcode */
opstart = opstart->insdshead->pds;
Expand Down

0 comments on commit b17534c

Please sign in to comment.