20 : position(0), repeat(false), buffer(audio_buffer)
33 int buffer_samples = buffer->getNumSamples();
34 int buffer_channels = buffer->getNumChannels();
36 if (info.numSamples > 0) {
38 int number_to_copy = 0;
41 if (start + info.numSamples <= buffer_samples)
44 number_to_copy = info.numSamples;
46 else if (start > buffer_samples)
51 else if (buffer_samples - start > 0)
54 number_to_copy = buffer_samples - start;
63 if (number_to_copy > 0)
66 for (
int channel = 0; channel < buffer_channels; channel++)
67 info.buffer->copyFrom(channel, info.startSample, *buffer, channel, start, number_to_copy);
70 position += number_to_copy;
86 if (newPosition >= 0 && newPosition < buffer->getNumSamples())
87 position = newPosition;
101 return buffer->getNumSamples();
121 buffer = audio_buffer;