Esempio n. 1
0
int  CHAIN::setup(PFieldSet *inPFields)
{
	// Copy first 3 numeric args to new PFieldSet
	PFieldSet *newSet = new PFieldSet(3);
	for (int p = 0; p < 3; ++p)
		newSet->load(new ConstPField((*inPFields)[p].doubleValue(0.0)), p);
	// The remaining args are InstPFields
	int numChainedInstruments = (int)(*inPFields)[2].intValue(0.0);
	for (int p = 0; p < numChainedInstruments; ++p) {
		InstPField *ipf = (InstPField *) &(*inPFields)[p+3];
		Instrument *inst = ipf->instrument();
		if (inst == NULL) {
			return die("CHAIN", "NULL instrument passed as argument %d", p+3);
		}
		mInstVector.push_back(inst);
		// Instruments are referenced once when created.  Because CHAIN is the sole owner,
		// we do not do another reference.
	}
	if (Option::print() >= MMP_PRINTALL) {

		RTPrintfCat("Instrument chain: ");
		for (std::vector<Instrument *>::iterator it = mInstVector.begin(); it != mInstVector.end(); ++it) {
			RTPrintfCat("%s -> ", (*it)->name());
		}
		RTPrintf("Out\n");
	}
	delete inPFields;
	return Instrument::setup(newSet);
}
Esempio n. 2
0
/* ----------------------------------------------------- print_play_order --- */
void
RTcmix::print_play_order() {
  int i;
  RTPrintfCat("Output buffer playback order:  ");
  for(i=0;i<MAXBUS;i++) {
	pthread_mutex_lock(&aux_to_aux_lock);
	if (AuxToAuxPlayList[i] != -1) {
	  RTPrintfCat(" %d",AuxToAuxPlayList[i]);
	}
	pthread_mutex_unlock(&aux_to_aux_lock);
  }
  RTPrintf("\n");
}
Esempio n. 3
0
/* Prints config from Inst. point of view */
ErrCode
RTcmix::print_inst_bus_config() {
   BusQueue *qEntry;
   BusSlot *check_slot;

   pthread_mutex_lock(&inst_bus_config_lock);
   qEntry = Inst_Bus_Config;
   pthread_mutex_unlock(&inst_bus_config_lock);

   while (qEntry) {

	  RTPrintfCat("%s",qEntry->instName());
	  check_slot = qEntry->slot;
	  
	  if (check_slot == NULL) {
		 RTPrintf("done\n");
		 return NO_ERR;
	  }
	  
	  while (check_slot) {
		 print_bus_slot(check_slot);
		 check_slot = check_slot->next;
	  }
	  qEntry = qEntry->next; 
   }
   return NO_ERR;
}
Esempio n. 4
0
/* ------------------------------------------------------ print_children -----*/
void
RTcmix::print_children() {
  int i;
  RTPrintfCat("Aux buses w/o aux outputs:  "); 
  for(i=0;i<MAXBUS;i++) {
	pthread_mutex_lock(&aux_in_use_lock);
	if (AuxInUse[i]) {
	  pthread_mutex_lock(&has_child_lock);
	  if (!HasChild[i]) {
		RTPrintfCat(" %d",i);
	  }
	  pthread_mutex_unlock(&has_child_lock);
	}
	pthread_mutex_unlock(&aux_in_use_lock);
  }
  RTPrintf("\n");
}
Esempio n. 5
0
/* ------------------------------------------------------- print_parents -----*/
void
RTcmix::print_parents() {
  int i;
  RTPrintfCat("Aux buses w/o aux inputs:  ");
  for(i=0;i<MAXBUS;i++) {
	pthread_mutex_lock(&aux_in_use_lock);
	if (AuxInUse[i]) {
	  pthread_mutex_lock(&has_parent_lock);
	  if (!HasParent[i]) {
		RTPrintfCat(" %d",i);
	  }
	  pthread_mutex_unlock(&has_parent_lock);
	}
	pthread_mutex_unlock(&aux_in_use_lock);
  }
  RTPrintf("\n");
}
Esempio n. 6
0
/* ------------------------------------------------------- print_bus_slot --- */
static void
print_bus_slot(BusSlot *bs)
{
   int i;

   RTPrintfCat("\n   in_count=%d :", bs->in_count);
   for (i = 0; i < bs->in_count; i++)
      RTPrintfCat(" %d", bs->in[i]);
   RTPrintfCat("\n   out_count=%d :", bs->out_count);
   for (i = 0; i < bs->out_count; i++)
      RTPrintfCat(" %d", bs->out[i]);
   RTPrintfCat("\n   auxin_count=%d :", bs->auxin_count);
   for (i = 0; i < bs->auxin_count; i++)
      RTPrintfCat(" %d", bs->auxin[i]);
   RTPrintfCat("\n   auxout_count=%d :", bs->auxout_count);
   for (i = 0; i < bs->auxout_count; i++)
      RTPrintfCat(" %d", bs->auxout[i]);
   RTPrintf("\n");
}
Esempio n. 7
0
MincFloat
_minc_printf(const MincValue args[], const int nargs)
{
   int n;
   const char *p;

   if (get_print_option() < MMP_PRINTS) return 0.0;

   if (args[0].dataType() != MincStringType) {
      minc_warn("printf: first argument must be format string");
      goto err;
   }

   n = 1;
   p = (MincString) args[0];
   while (*p) {
      switch (*p) {
         case '%':
            p++;
            if (n >= nargs) {
               minc_warn("printf: not enough arguments for format string");
               goto err;
            }
            switch (*p) {
               case 'd':      /* print float object as integer */
                  if (args[n].dataType() != MincFloatType) {
                     minc_warn("printf: wrong argument type for format");
                     goto err;
                  }
                  RTPrintfCat("%d", (int) (MincFloat)args[n]);
                  break;
               case 'f':      /* print float object */
                  if (args[n].dataType() != MincFloatType) {
                     minc_warn("printf: wrong argument type for format");
                     goto err;
                  }
                  RTPrintfCat("%.12g", (MincFloat)args[n]);
                  break;
               case 'l':      /* print list object */
                  if (args[n].dataType() != MincListType) {
                     minc_warn("printf: wrong argument type for format");
                     goto err;
                  }
                  RTPrintfCat("[");
                  _do_print(((MincList *)args[n])->data, ((MincList *)args[n])->len);
                  RTPrintfCat("]");
                  break;
               case 's':      /* print string object */
                  if (args[n].dataType() != MincStringType) {
                     minc_warn("printf: wrong argument type for format");
                     goto err;
                  }
                  RTPrintfCat("%s", (MincString)args[n]);
                  break;
               case 't':      /* print type of object */
                  {
                     char *tstr = (char *) _make_type_string(args[n].dataType() );
                     RTPrintfCat("%s", tstr);
                     free(tstr);
                  }
                  break;
               case 'z':      /* print as appropriate for type */
                  _do_print(&args[n], 1);
                  break;
               case '\0':
                  minc_warn("printf: premature end of format string");
                  goto err;
                  break;
               default:
                  minc_warn("printf: invalid format specifier");
                  goto err;
                  break;
            }
            n++;
            p++;
            break;
         case '\\':
            p++;
            switch (*p) {
               case 'n':
                  RTPrintfCat("\n");
                  break;
               case 't':
                  RTPrintfCat("\t");
                  break;
//FIXME: currently, minc.l can't handle escaped quotes in strings
               case '\'':
                  RTPrintfCat("'");
                  break;
               case '"':
                  RTPrintfCat("\"");
                  break;
               case '\0':
                  minc_warn("printf: premature end of format string");
                  goto err;
                  break;
               default:
                  minc_warn("printf: invalid escape character");
                  goto err;
                  break;
            }
            p++;
            break;
         default:
            RTPrintfCat("%c", *p);
            p++;
            break;
      }
   }
   return 0.0;
err:
   RTPrintf("\n");
//   fflush(stdout);
   return -1.0;
}
Esempio n. 8
0
/* ------------------------------------------------------------- _do_print -- */
static void
_do_print(const MincValue args[], const int nargs)
{
   int i, last_arg;

   last_arg = nargs - 1;
   for (i = 0; i < nargs; i++) {
      switch (args[i].dataType()) {
         case MincFloatType:
            if (i == last_arg)
               RTPrintfCat("%.12g", (MincFloat)args[i]);
            else
               RTPrintfCat("%.12g, ", (MincFloat)args[i]);
            break;
         case MincStringType:
            if (i == last_arg)
               RTPrintfCat("\"%s\"", (MincString)args[i]);
            else
               RTPrintfCat("\"%s\", ", (MincString)args[i]);
            break;
         case MincHandleType:
            if (i == last_arg)
               RTPrintfCat("Handle:%p", (MincHandle)args[i]);
            else
               RTPrintfCat("Handle:%p, ", (MincHandle)args[i]);
            break;
         case MincListType:
		  {
			  MincList *list = (MincList *)args[i];
			if (list != NULL) {
				RTPrintfCat("[");
				_do_print(list->data, list->len);
				if (i == last_arg)
					RTPrintfCat("]");
				else
					RTPrintfCat("], ");
			}
			else {
				if (i == last_arg)
					RTPrintfCat("NULL");
				else
					RTPrintfCat("NULL, ");
			}
		  }
            break;
         case MincVoidType:
			  if (i == last_arg)
				  RTPrintfCat("(void)");
			  else
				  RTPrintfCat("(void), ");
           break;
      }
   }
}