Fixed DspDac not working like the pd dac~

Because the PdMessage::initWithString function puts a bang in the init
message if it is empty. So when you create a DspDac with no argument, the
init message will contain a bang.

2014-11-03 23:32 GMT+01:00 Martin Roth <notifications@github.com>:

> In src/DspDac.cpp:
>
> >  }
> >
> > -DspDac::DspDac(PdGraph *graph) : DspObject(0, graph->getNumOutputChannels(), 0, 0, graph) {
> > -  // cache pointers to global output buffers in dspBufferAtOutlet
> > -  int numInlets = graph->getNumOutputChannels();
> > -  if (numInlets > 2) dspBufferAtOutlet[2] = (float *) calloc(numInlets-2, sizeof(float *));
> > -
> > -  for (int i = 0; i < numInlets; i++) {
> > -    setDspBufferAtOutlet(graph->getGlobalDspBufferAtOutlet(i), i);
> > +DspDac::DspDac(PdMessage *initMessage, PdGraph *graph)
> > +  : DspObject(0, 1, 0, 0, graph) {
> > +
> > +  // empty init message will always contains a bang (cf. PdMessage::initWithString)
> > +  if (initMessage->getNumElements() == 1 && initMessage->isBang(0)) {
> > +    outputBuffers.reserve(graph->getNumOutputChannels());
>
> But why would you ever get an initialisation message with a bang? Wouldn't
> the message just be a list of floats?
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/mhroth/ZenGarden/pull/53/files#r19772291>.
>



-- 
SAUVAGEOT Paul-Arthur.
Développeur C \ C++ \ C#.