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

Method write

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

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

Source from the content-addressed store, hash-verified

118
119//-----------------------------------------------------------------------------
120tresult PLUGIN_API MemoryStream::write (void* buffer, int32 numBytes, int32* numBytesWritten)
121{
122 if (allocationError)
123 return kOutOfMemory;
124 if (buffer == nullptr)
125 return kInvalidArgument;
126
127 // Does write exceed size ?
128 TSize requiredSize = cursor + numBytes;
129 if (requiredSize > size)
130 {
131 if (requiredSize > memorySize)
132 setSize (requiredSize);
133 else
134 size = requiredSize;
135 }
136
137 // Copy data
138 if (memory && cursor >= 0 && numBytes > 0)
139 {
140 memcpy (&memory[cursor], buffer, static_cast<size_t> (numBytes));
141 // Update cursor
142 cursor += numBytes;
143 }
144 else
145 numBytes = 0;
146
147 if (numBytesWritten)
148 *numBytesWritten = numBytes;
149
150 return kResultTrue;
151}
152
153//-----------------------------------------------------------------------------
154tresult PLUGIN_API MemoryStream::seek (int64 pos, int32 mode, int64* result)

Callers 4

DownloadAudioMethod · 0.45
ShiftMethod · 0.45
ExportAllegroMethod · 0.45
WriteXMLMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected