MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / read

Method read

source/core/StarAudio.cpp:638–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

636}
637
638size_t Audio::read(int16_t* buffer, size_t bufferSize) {
639 if (bufferSize == 0)
640 return 0;
641
642 size_t readTotal = 0;
643 while (readTotal < bufferSize) {
644 size_t toGo = bufferSize - readTotal;
645 size_t ramt = readPartial(buffer + readTotal, toGo);
646 readTotal += ramt;
647 // End of stream reached
648 if (ramt == 0)
649 break;
650 }
651 return readTotal;
652}
653
654size_t Audio::resample(unsigned destinationChannels, unsigned destinationSampleRate, int16_t* destinationBuffer, size_t destinationBufferSize, double velocity) {
655 unsigned destinationSamples = destinationBufferSize / destinationChannels;

Callers 2

readFuncMethod · 0.45
readPartialMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected