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

Method read

libraries/lib-vst3/memorystream.cpp:81–117  ·  view source on GitHub ↗

-----------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

79
80//-----------------------------------------------------------------------------
81tresult PLUGIN_API MemoryStream::read (void* data, int32 numBytes, int32* numBytesRead)
82{
83 if (memory == nullptr)
84 {
85 if (allocationError)
86 return kOutOfMemory;
87 numBytes = 0;
88 }
89 else
90 {
91 // Does read exceed size ?
92 if (cursor + numBytes > size)
93 {
94 int32 maxBytes = int32 (size - cursor);
95
96 // Has length become zero or negative ?
97 if (maxBytes <= 0)
98 {
99 cursor = size;
100 numBytes = 0;
101 }
102 else
103 numBytes = maxBytes;
104 }
105
106 if (numBytes)
107 {
108 memcpy (data, &memory[cursor], static_cast<size_t> (numBytes));
109 cursor += numBytes;
110 }
111 }
112
113 if (numBytesRead)
114 *numBytesRead = numBytes;
115
116 return kResultTrue;
117}
118
119//-----------------------------------------------------------------------------
120tresult PLUGIN_API MemoryStream::write (void* buffer, int32 numBytes, int32* numBytesWritten)

Callers 6

retrieveAudioMethod · 0.45
samplesMethod · 0.45
postResampleCBFunction · 0.45
ProcessMethod · 0.45
get_conanfile_hashFunction · 0.45
conan_runner.pyFile · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected