Program: 76063
Project: 76063
Buggy source:
/** 
 * Invoke <i>count</i> iterations of this actor. This method causes audio samples to be captured from the audio source, which can be a sound file or live capture from the audio input device (e.g., the microphone or line-in). One token is written to the output port in an iteration.  When live capture mode is used, this method should be invoked  often enough to prevent overflow of the internal audio capture  buffer. Overflow should be avoided, since it will result in loss  of data.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Return STOP_ITERATING if the end of the soundfile is reached.
 * @exception IllegalActionException If audio cannot be captured.
 */
public int iterate(int count) throws IllegalActionException {
  if (count > _audioSendArray.length) {
    _audioSendArray=new DoubleToken[count];
  }
  for (int i=0; i < count; i++) {
    if (_haveASample == false) {
      try {
        _audioInDoubleArray=_soundCapture.getSamples();
      }
 catch (      Exception ex) {
        throw new IllegalActionException("String_Node_Str" + ex.getMessage());
      }
      _getSamplesArrayPointer=0;
      if (_audioInDoubleArray != null) {
        _haveASample=true;
      }
    }
    if (_haveASample == true) {
      for (int j=0; j < _channels; j++) {
        _audioSendArray[i]=new DoubleToken(_audioInDoubleArray[j][_getSamplesArrayPointer]);
      }
      _getSamplesArrayPointer++;
      if ((_audioInDoubleArray[0].length - _getSamplesArrayPointer) <= 0) {
        _haveASample=false;
      }
    }
  }
  if (_audioInDoubleArray != null) {
    for (int j=0; j < _channels; j++) {
      output.send(j,_audioSendArray,count);
    }
    return COMPLETED;
  }
 else {
    for (int i=0; i < count; i++) {
      _audioSendArray[i]=new DoubleToken(0);
    }
    for (int j=0; j < _channels; j++) {
      output.send(j,_audioSendArray,count);
    }
    return STOP_ITERATING;
  }
}

Fixed version (ground truth):
/** 
 * Invoke <i>count</i> iterations of this actor. This method causes audio samples to be captured from the audio source, which can be a sound file or live capture from the audio input device (e.g., the microphone or line-in). One token is written to the output port in an iteration.  When live capture mode is used, this method should be invoked  often enough to prevent overflow of the internal audio capture  buffer. Overflow should be avoided, since it will result in loss  of data. <p> This method should be called instead of the prefire(),  fire(), and postfire() methods when this actor is used in a domain that supports vectorized actors. It is recommended for performance reasons that a large value of <i>count</i> be used  when this actor is used in live capture mode. This actor is  optimized to provide good performance even if the value of  <i>count</i> changes often.
 * @param count The number of iterations to perform.
 * @return COMPLETED if the actor was successfully iterated thespecified number of times. Return STOP_ITERATING if the end of the sound file is reached.
 * @exception IllegalActionException If there is a problem capturingaudio.
 */
public int iterate(int count) throws IllegalActionException {
  if (count > _audioSendArray.length) {
    _audioSendArray=new DoubleToken[count];
  }
  for (int i=0; i < count; i++) {
    if (_haveASample == false) {
      try {
        _audioInDoubleArray=_soundCapture.getSamples();
      }
 catch (      Exception ex) {
        throw new IllegalActionException("String_Node_Str" + ex.getMessage());
      }
      _getSamplesArrayPointer=0;
      if (_audioInDoubleArray != null) {
        _haveASample=true;
      }
    }
    if (_haveASample == true) {
      for (int j=0; j < _channels; j++) {
        _audioSendArray[i]=new DoubleToken(_audioInDoubleArray[j][_getSamplesArrayPointer]);
      }
      _getSamplesArrayPointer++;
      if ((_audioInDoubleArray[0].length - _getSamplesArrayPointer) <= 0) {
        _haveASample=false;
      }
    }
  }
  if (_audioInDoubleArray != null) {
    for (int j=0; j < _channels; j++) {
      output.send(j,_audioSendArray,count);
    }
    return COMPLETED;
  }
 else {
    for (int i=0; i < count; i++) {
      _audioSendArray[i]=new DoubleToken(0);
    }
    for (int j=0; j < _channels; j++) {
      output.send(j,_audioSendArray,count);
    }
    return STOP_ITERATING;
  }
}