code: public void addSamples(int[] samples, int count) {
      assert(count*streamConfig.getChannelCount() <= samples.length);
      if(samples.length < count*streamConfig.getChannelCount())
        throw new IllegalArgumentException("count given exceeds samples array bounds");
      sampleLock.lock();
      try {
        //get number of channels
        int channels = streamConfig.getChannelCount();
        int maxBlock = streamConfig.getMaxBlockSize();
        if(unfilledRequest == null)
          unfilledRequest = prepareRequest(maxBlock,channels);
        int remaining = count;
        int offset = 0;
        while(remaining > 0) {
          int newRemaining = unfilledRequest.addInterleavedSamples(samples, offset, remaining, maxBlock);
          offset += (remaining-newRemaining)*channels;
          remaining = newRemaining;
          if(unfilledRequest.isFull(maxBlock)) {
            this.preparedRequests.add(unfilledRequest);
            unfilledRequest = null;
          }
          if(remaining > 0) {
            unfilledRequest = prepareRequest(maxBlock, channels);
          }
        }
      }finally {
        sampleLock.unlock();
      }
    }
docs: Add samples to the encoder, so they may then be encoded. This method uses
  breaks the samples into blocks, which will then be made available to
  encode.
  
  @param samples Array holding the samples to encode. For all multi-channel
  audio, the samples must be interleaved in this array. For example, with
  stereo: sample 0 will belong to the first channel, 1 the second, 2 the
  first, 3 the second, etc. Samples are interpreted according to the
  current configuration(for things such as channel and bits-per-sample).
  
  @param count Number of interchannel samples to add. For example, with
  stero: if this is 4000, then "samples" must contain 4000 left samples and
  4000 right samples, interleaved in the array.