sonic_lite.c
int sonicReadShortFromStream(short *samples, int maxSamples) {
  int numSamples = sonicStream.numOutputSamples;
  int remainingSamples = 0;

  if (numSamples == 0) {
    return 0;
  }
  if (numSamples > maxSamples) {
    remainingSamples = numSamples - maxSamples;
    numSamples = maxSamples;
  }
  memcpy(samples, sonicStream.outputBuffer, numSamples * sizeof(short));
  if (remainingSamples > 0) {
    memmove(sonicStream.outputBuffer, sonicStream.outputBuffer + numSamples,
            remainingSamples * sizeof(short));
  }
  sonicStream.numOutputSamples = remainingSamples;
  return numSamples;
}
/* Read short data out of the stream.  Sometimes no data will be available, and
   zero is returned, which is not an error condition. */
Read short data out of the stream.  Sometimes no data will be available, and
zero is returned, which is not an error condition.
Read short data out of the stream . Sometimes no data will be available and zero is returned which is not an error condition .
int sonicReadShortFromStream(short *samples, int maxSamples) {
  int numSamples = sonicStream.numOutputSamples;
  int remainingSamples = 0;
  if (numSamples == 0) {
    return 0;
  }
  if (numSamples > maxSamples) {
    remainingSamples = numSamples - maxSamples;
    numSamples = maxSamples;
  }
  memcpy(samples, sonicStream.outputBuffer, numSamples * sizeof(short));
  if (remainingSamples > 0) {
    memmove(sonicStream.outputBuffer, sonicStream.outputBuffer + numSamples,
            remainingSamples * sizeof(short));
  }
  sonicStream.numOutputSamples = remainingSamples;
  return numSamples;
}
int sonicReadShortFromStream ( short * samples , int maxSamples ) { int numSamples = sonicStream . numOutputSamples ; int remainingSamples = 0 ; if ( numSamples == 0 ) { return 0 ; } if ( numSamples > maxSamples ) { remainingSamples = numSamples - maxSamples ; numSamples = maxSamples ; } memcpy ( samples , sonicStream . outputBuffer , numSamples * sizeof ( short ) ) ; if ( remainingSamples > 0 ) { memmove ( sonicStream . outputBuffer , sonicStream . outputBuffer + numSamples , remainingSamples * sizeof ( short ) ) ; } sonicStream . numOutputSamples = remainingSamples ; return numSamples ; }
Read short data out of the stream.
Read short data out of the stream .